diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 96e93ef97ed..00000000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..f1d610b47e6 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +# Ignore artifacts: +lib +coverage +*.lock +.eslintrc.json +src/WABinary/index.ts +WAProto +WASignalGroup +Example/test.ts \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000000..7d37e835efe --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "@adiwajshing" +} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000000..a097926d2ff --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help improve the library +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Created a new connection +2. Closed & used saved credentials to log back in +3. Etc. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Environment (please complete the following information):** + - Is this on a server? + - What do your `connectOptions` look like? + - Do you have multiple clients on the same IP? + - Are you using a proxy? + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..407df68aa48 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +contact_links: + - name: Discussion + about: Discuss your problem here + url: https://github.com/adiwajshing/Baileys/discussions/new + - name: Discord + about: Join our discord to discuss together + url: https://discord.gg/WeJM5FP9GG diff --git a/.github/ISSUE_TEMPLATE/feature-requests.md b/.github/ISSUE_TEMPLATE/feature-requests.md new file mode 100644 index 00000000000..19e64952e52 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-requests.md @@ -0,0 +1,15 @@ +--- +name: Feature Requests +about: Template for general issues/feature requests +title: '' +labels: '' +assignees: '' + +--- + +**Before adding this issue, make sure you do the following to make sure this is not a duplicate:** +1. Search through the repo's previous issues +2. Read through the readme at least once +3. Search the docs for the feature you're looking for + +**Just describe the feature** diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..64a9bc0ef08 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: Check PR health + +on: [pull_request] + +jobs: + check-lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v2 + + - name: Install Node + uses: actions/setup-node@v1 + with: + node-version: 16.x + + - name: Install packages + run: yarn + + - name: Check linting + run: yarn lint diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000000..7c116882cfd --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,83 @@ +name: Publish Release + +on: "workflow_dispatch" + +jobs: + +# Test: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Commit +# uses: actions/checkout@v2 +# +# - name: Setup Node.js environment +# uses: actions/setup-node@v2.1.1 +# +# - name: Install Dependencies +# run: npm install +# +# - name: Run Tests +# run: npm run test + Build: + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + + - name: Parsing Package Info + id: packageInfo + run: | + echo "::set-output name=package-name::$(jq -r .name package.json)" + echo "::set-output name=package-version::$(jq -r .version package.json)" + echo "::set-output name=commit-msg::$(git log -1 --pretty=%B)" + + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.1 + + - name: Install Dependencies + run: yarn + + - name: Build + run: yarn run build:tsc + + - name: Create Release + id: releaseCreate + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # The name of the tag. This should come from the webhook payload, `github.GITHUB_REF` when a user pushes a new tag + tag_name: v${{ steps.packageInfo.outputs.package-version }} + # The name of the release. For example, `Release v1.0.1` + release_name: v${{ steps.packageInfo.outputs.package-version }} + # Text describing the contents of the tag. + body: ${{steps.packageInfo.outputs.commit-msg}} + # `true` to create a draft (unpublished) release, `false` to create a published one. Default: `false` + draft: false + # `true` to identify the release as a prerelease. `false` to identify the release as a full release. Default: `false` + prerelease: false + + - name: Make Package + run: npm pack + + - name: Rename Pack + run: mv *.tgz npmPackage.tgz + + - name: Git Release + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # The URL for uploading assets to the release + upload_url: ${{steps.releaseCreate.outputs.upload_url}} + # The path to the asset you want to upload + asset_path: npmPackage.tgz + asset_name: npmPackage.tgz + # The content-type of the asset you want to upload. See the supported Media Types here: https://www.iana.org/assignments/media-types/media-types.xhtml for more information + asset_content_type: application/x-compressed-tar + + - name: NPM Publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000000..dc509f9443f --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,17 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days' + stale-pr-message: 'This PR is stale because it has been open 6 days with no activity. Remove the stale label or comment or this will be closed in 2 days' + days-before-stale: 6 + days-before-close: 2 diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml new file mode 100644 index 00000000000..9d0d11d9933 --- /dev/null +++ b/.github/workflows/update-docs.yml @@ -0,0 +1,41 @@ +name: Update Docs + +on: + push: + branches: + - master +jobs: + Build: + runs-on: ubuntu-latest + outputs: + package-name: ${{ steps.packageInfo.outputs.package-name }} + package-version: ${{ steps.packageInfo.outputs.package-version }} + commit-msg: ${{ steps.packageInfo.outputs.commit-msg }} + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout Commit + uses: actions/checkout@v2 + + - name: Parsing Package Info + id: packageInfo + run: | + echo "::set-output name=package-name::$(jq -r .name package.json)" + echo "::set-output name=package-version::$(jq -r .version package.json)" + echo "::set-output name=commit-msg::$(git log -1 --pretty=%B)" + + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.1 + + - name: Install Dependencies + run: yarn + + - name: Build + run: yarn run build:all + + - name: Publish to Pages + uses: crazy-max/ghaction-github-pages@v2 + with: + target_branch: gh-pages + build_dir: docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/update-proto.yml b/.github/workflows/update-proto.yml new file mode 100644 index 00000000000..bc4ffb84ede --- /dev/null +++ b/.github/workflows/update-proto.yml @@ -0,0 +1,49 @@ +name: Update WAProto + +on: + schedule: + - cron: "10 1 * * 1" + +jobs: + update-proto: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v2 + + - name: Install Node + uses: actions/setup-node@v1 + with: + node-version: 16.x + + - name: Install packages + run: yarn --cwd proto-extract + + - name: Update WAProto.proto + id: wa_proto_info + run: | + yarn --cwd proto-extract start > wa-logs.txt + WA_VERSION=$(cat wa-logs.txt | perl -n -e'/Current version\: (.+)/ && print $1') + WA_JS_URL=$(cat wa-logs.txt | perl -n -e'/Found source JS URL\: (.+)/ && print $1') + echo "wa_version=$WA_VERSION" >> $GITHUB_OUTPUT + echo "wa_js_url=$WA_JS_URL" >> $GITHUB_OUTPUT + + - name: GenerateStatics + run: yarn --cwd proto-extract pbjs -t static-module -w commonjs -o ../WAProto/index.js ../WAProto/WAProto.proto + + - name: GenerateStatics types + run: yarn --cwd proto-extract pbts -o ../WAProto/index.d.ts ../WAProto/index.js + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: 'chore: update proto' + title: "Whatsapp v${{steps.wa_proto_info.outputs.wa_version}} change proto" + branch: "update-proto/v${{steps.wa_proto_info.outputs.wa_version}}" + branch-suffix: timestamp + delete-branch: true + labels: "update-proto" + body: "Automated changes\nFound source JS URL: ${{steps.wa_proto_info.outputs.wa_js_url}}\nCurrent version: v${{steps.wa_proto_info.outputs.wa_version}}" + add-paths: | + WAProto/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index bf1eb467e5f..05fa43d5ad4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,17 @@ node_modules -auth_info.json -test_pvt.js +auth_info*.json +baileys_auth_info* +baileys_store*.json +output.csv +*/.DS_Store +.DS_Store +.env +browser-messages.json +decoded-ws.json +lib +docs +browser-token.json +Proxy +messages*.json +test.ts +TestData \ No newline at end of file diff --git a/Example/example.ts b/Example/example.ts new file mode 100644 index 00000000000..eb6fd1553a9 --- /dev/null +++ b/Example/example.ts @@ -0,0 +1,187 @@ +import { Boom } from '@hapi/boom' +import NodeCache from 'node-cache' +import makeWASocket, { AnyMessageContent, delay, DisconnectReason, fetchLatestBaileysVersion, getAggregateVotesInPollMessage, makeCacheableSignalKeyStore, makeInMemoryStore, proto, useMultiFileAuthState, WAMessageContent, WAMessageKey } from '../src' +import MAIN_LOGGER from '../src/Utils/logger' + +const logger = MAIN_LOGGER.child({ }) +logger.level = 'trace' + +const useStore = !process.argv.includes('--no-store') +const doReplies = !process.argv.includes('--no-reply') + +// external map to store retry counts of messages when decryption/encryption fails +// keep this out of the socket itself, so as to prevent a message decryption/encryption loop across socket restarts +const msgRetryCounterCache = new NodeCache() + +// the store maintains the data of the WA connection in memory +// can be written out to a file & read from it +const store = useStore ? makeInMemoryStore({ logger }) : undefined +store?.readFromFile('./baileys_store_multi.json') +// save every 10s +setInterval(() => { + store?.writeToFile('./baileys_store_multi.json') +}, 10_000) + +// start a connection +const startSock = async() => { + const { state, saveCreds } = await useMultiFileAuthState('baileys_auth_info') + // fetch latest version of WA Web + const { version, isLatest } = await fetchLatestBaileysVersion() + console.log(`using WA v${version.join('.')}, isLatest: ${isLatest}`) + + const sock = makeWASocket({ + version, + logger, + printQRInTerminal: true, + auth: { + creds: state.creds, + /** caching makes the store faster to send/recv messages */ + keys: makeCacheableSignalKeyStore(state.keys, logger), + }, + msgRetryCounterCache, + generateHighQualityLinkPreview: true, + // ignore all broadcast messages -- to receive the same + // comment the line below out + // shouldIgnoreJid: jid => isJidBroadcast(jid), + // implement to handle retries & poll updates + getMessage, + }) + + store?.bind(sock.ev) + + const sendMessageWTyping = async(msg: AnyMessageContent, jid: string) => { + await sock.presenceSubscribe(jid) + await delay(500) + + await sock.sendPresenceUpdate('composing', jid) + await delay(2000) + + await sock.sendPresenceUpdate('paused', jid) + + await sock.sendMessage(jid, msg) + } + + // the process function lets you process all events that just occurred + // efficiently in a batch + sock.ev.process( + // events is a map for event name => event data + async(events) => { + // something about the connection changed + // maybe it closed, or we received all offline message or connection opened + if(events['connection.update']) { + const update = events['connection.update'] + const { connection, lastDisconnect } = update + if(connection === 'close') { + // reconnect if not logged out + if((lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut) { + startSock() + } else { + console.log('Connection closed. You are logged out.') + } + } + + console.log('connection update', update) + } + + // credentials updated -- save them + if(events['creds.update']) { + await saveCreds() + } + + if(events.call) { + console.log('recv call event', events.call) + } + + // history received + if(events['messaging-history.set']) { + const { chats, contacts, messages, isLatest } = events['messaging-history.set'] + console.log(`recv ${chats.length} chats, ${contacts.length} contacts, ${messages.length} msgs (is latest: ${isLatest})`) + } + + // received a new message + if(events['messages.upsert']) { + const upsert = events['messages.upsert'] + console.log('recv messages ', JSON.stringify(upsert, undefined, 2)) + + if(upsert.type === 'notify') { + for(const msg of upsert.messages) { + if(!msg.key.fromMe && doReplies) { + console.log('replying to', msg.key.remoteJid) + await sock!.readMessages([msg.key]) + await sendMessageWTyping({ text: 'Hello there!' }, msg.key.remoteJid!) + } + } + } + } + + // messages updated like status delivered, message deleted etc. + if(events['messages.update']) { + console.log( + JSON.stringify(events['messages.update'], undefined, 2) + ) + + for(const { key, update } of events['messages.update']) { + if(update.pollUpdates) { + const pollCreation = await getMessage(key) + if(pollCreation) { + console.log( + 'got poll update, aggregation: ', + getAggregateVotesInPollMessage({ + message: pollCreation, + pollUpdates: update.pollUpdates, + }) + ) + } + } + } + } + + if(events['message-receipt.update']) { + console.log(events['message-receipt.update']) + } + + if(events['messages.reaction']) { + console.log(events['messages.reaction']) + } + + if(events['presence.update']) { + console.log(events['presence.update']) + } + + if(events['chats.update']) { + console.log(events['chats.update']) + } + + if(events['contacts.update']) { + for(const contact of events['contacts.update']) { + if(typeof contact.imgUrl !== 'undefined') { + const newUrl = contact.imgUrl === null + ? null + : await sock!.profilePictureUrl(contact.id!).catch(() => null) + console.log( + `contact ${contact.id} has a new profile pic: ${newUrl}`, + ) + } + } + } + + if(events['chats.delete']) { + console.log('chats deleted ', events['chats.delete']) + } + } + ) + + return sock + + async function getMessage(key: WAMessageKey): Promise { + if(store) { + const msg = await store.loadMessage(key.remoteJid!, key.id!) + return msg?.message || undefined + } + + // only if store is present + return proto.Message.fromObject({}) + } +} + +startSock() \ No newline at end of file diff --git a/Media/.gitignore b/Media/.gitignore new file mode 100644 index 00000000000..77d2a2d528e --- /dev/null +++ b/Media/.gitignore @@ -0,0 +1,2 @@ +received_* +media_* \ No newline at end of file diff --git a/Media/cat.jpeg b/Media/cat.jpeg new file mode 100644 index 00000000000..5063d0996fe Binary files /dev/null and b/Media/cat.jpeg differ diff --git a/Media/icon.png b/Media/icon.png new file mode 100644 index 00000000000..e54d8fb06cd Binary files /dev/null and b/Media/icon.png differ diff --git a/Media/ma_gif.mp4 b/Media/ma_gif.mp4 new file mode 100644 index 00000000000..d48b0fe37ae Binary files /dev/null and b/Media/ma_gif.mp4 differ diff --git a/Media/meme.jpeg b/Media/meme.jpeg new file mode 100644 index 00000000000..e09535bcd05 Binary files /dev/null and b/Media/meme.jpeg differ diff --git a/Media/octopus.webp b/Media/octopus.webp new file mode 100644 index 00000000000..ddb9ac0a587 Binary files /dev/null and b/Media/octopus.webp differ diff --git a/Media/sonata.mp3 b/Media/sonata.mp3 new file mode 100644 index 00000000000..4bb36616bf3 Binary files /dev/null and b/Media/sonata.mp3 differ diff --git a/README.md b/README.md index f378a780b30..d251035b417 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,64 @@ -# Baileys - Reverse Engineered WhatsApp Web API in Node.js. Baileys does not require Selenium or any other browser to be interface with WhatsApp Web, it does so directly using WebSockets. +[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#table-of-contents) +# Baileys Up To Date - Thank you to [Sigalor](https://github.com/sigalor/whatsapp-web-reveng) for writing the guide reverse engineering WhatsApp Web and to the go reimplementation written by [Rhymen](https://github.com/Rhymen/go-whatsapp/tree/484cfe758705761d76724e01839d6fc473dc10c4) +

+ +

-Baileys is super easy to use: -1. Install from npm using - ``` npm install github:adiwajshing/Baileys ``` -2. Then import in your code using - ``` javascript - const WhatsAppWeb = require('Baileys') - ``` -3. Create an instance of Baileys & connect using - ``` javascript - let client = new WhatsAppWeb() - client.connect() - ``` - If the connection is successful, you will see a QR code printed on your terminal screen, scan it with WhatsApp on your phone and you'll be logged in! -4. Implement the following event handlers in your code: - ``` javascript - client.handlers.onConnected = () => { /* when you're successfully authenticated with the WhatsApp Web servers */ } - ``` - ``` javascript - client.handlers.onUnreadMessage = (message) => { /* called when you have a pending unread message or recieve a new message */ } - ``` - ``` javascript - client.handlers.onError = (error) => { /* called when there was an error */ } - ``` - ``` javascript - client.handlers.onDisconnect = () => { /* called when internet gets disconnected */ } - ``` -5. Send a text message using - ``` javascript - client.sendTextMessage(id, txtMessage) - ``` - The id is the phone number of the person the message is being sent to, it must be in the format '[country code][phone number]@s.whatsapp.net', for example '+19999999999@s.whatsapp.net' -6. Send a read reciept using - ``` javascript - client.sendReadReceipt(id, messageID) - ``` - The id is in the same format as mentioned earlier. The message ID is the unique identifier of the message that you are marking as read -7. Tell someone what your status is right now by using - ``` javascript - client.updatePresence(id, presence) - ``` - Presence can be one of the following: - ``` javascript - static Presence = { - available: "available", // "online" - unavailable: "unavailable", // offline - composing: "composing", // "typing..." - recording: "recording", // "recording..." - paused: "paused" // I have no clue - } - ``` -8. Once you want to close your session, you can get your authentication credentials using: - ``` javascript - const authJSON = client.base64EncodedAuthInfo() - ``` - and then save this JSON to a file -9. If you want to restore your session (i.e. log back in without having to scan the QR code), simply retreive your previously saved credentials and use - ``` javascript - const authJSON = JSON.parse( fs.readFileSync("auth_info.json") ) - client.login( authJSON ) - ``` - This will use the credentials to connect & log back in. No need to call ``` connect() ``` after calling this function -10. If you want to query whether a number is registered on WhatsApp, use: - ``` javascript - client.isOnWhatsApp ("[countrycode][some10digitnumber]@s.whatsapp.net", (exists, id) => { - if (exists) { - console.log(id + " is on WhatsApp") - } else { - console.log(id + " is not on WhatsApp :(") - } - }) - ``` - Of course, replace ``` [countrycode][some10digitnumber] ``` with an actual country code & number + > **Warning**: ini hanyalah repo baileys yang sudah ter update & fix jika ada problem. memudahkan bagi pemula jika ada pull req di repo utama yang belum di acc + + > **Note**: kalau ada problem atau masalah, tanya2 ke grup dibawah ini + + +GRUP INFO BAILEYS: [KLIK DISINI](https://chat.whatsapp.com/Htfi5uzYWOt0ekPu66YK4Y) + +#### update an sementara diberhentikan, sedang mengupdate library lainnya dan base baru direpo ini +### baca semua keterangan dibawah biar tahu -Do check out test.js to see example usage of all these functions. +## 🔥 connection options +> **Note**: setting tambahan connection option seperti dibawah ini terlebih dahulu +``` +const connectionOptions = { +printQRInTerminal: true, // memunculkan qr di terminal +syncFullHistory: false, // menerima riwayat lengkap +markOnlineOnConnect: false, // membuat wa bot of, true jika ingin selalu menyala +connectTimeoutMs: 60_000, // atur jangka waktu timeout +defaultQueryTimeoutMs: 0, // atur jangka waktu query (0: tidak ada batas) +keepAliveIntervalMs: 10000, // interval ws +generateHighQualityLinkPreview: true, // menambah kualitas thumbnail preview +// patch dibawah untuk tambahan jika hydrate/list tidak bekerja +patchMessageBeforeSending: (message) => { + const requiresPatch = !!( + message.buttonsMessage + || message.templateMessage + || message.listMessage + ); + if (requiresPatch) { + message = { + viewOnceMessage: { + message: { + messageContextInfo: { + deviceListMetadataVersion: 2, + deviceListMetadata: {}, + }, + ...message, + }, + }, + }; + } -# Note - I am in no way affiliated with WhatsApp. This was written for educational purposes. Use at your own discretion. \ No newline at end of file + return message; +}, +getMessage: async (key) => { + if (store) { + const msg = await store.loadMessage(key.remoteJid, key.id) + return msg.message || undefined + } + return { + conversation: "hello, i'm Amirul Dev" + } + }, +// get message diatas untuk mengatasi pesan gagal dikirim, "menunggu pesan", dapat dicoba lagi +} +``` diff --git a/WAProto/GenerateStatics.sh b/WAProto/GenerateStatics.sh new file mode 100644 index 00000000000..7d77a28c675 --- /dev/null +++ b/WAProto/GenerateStatics.sh @@ -0,0 +1,4 @@ +yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto; +yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js; + +#protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=env=node,useOptionals=true,forceLong=long --ts_proto_out=. ./src/Binary/WAMessage.proto; \ No newline at end of file diff --git a/WAProto/WAProto.proto b/WAProto/WAProto.proto new file mode 100644 index 00000000000..5b99f587464 --- /dev/null +++ b/WAProto/WAProto.proto @@ -0,0 +1,2549 @@ +syntax = "proto2"; +package proto; + +message ADVDeviceIdentity { + optional uint32 rawId = 1; + optional uint64 timestamp = 2; + optional uint32 keyIndex = 3; +} + +message ADVKeyIndexList { + optional uint32 rawId = 1; + optional uint64 timestamp = 2; + optional uint32 currentIndex = 3; + repeated uint32 validIndexes = 4 [packed=true]; +} + +message ADVSignedDeviceIdentity { + optional bytes details = 1; + optional bytes accountSignatureKey = 2; + optional bytes accountSignature = 3; + optional bytes deviceSignature = 4; +} + +message ADVSignedDeviceIdentityHMAC { + optional bytes details = 1; + optional bytes hmac = 2; +} + +message ADVSignedKeyIndexList { + optional bytes details = 1; + optional bytes accountSignature = 2; +} + +message ActionLink { + optional string url = 1; + optional string buttonTitle = 2; +} + +message AutoDownloadSettings { + optional bool downloadImages = 1; + optional bool downloadAudio = 2; + optional bool downloadVideo = 3; + optional bool downloadDocuments = 4; +} + +message AvatarUserSettings { + optional string fbid = 1; + optional string password = 2; +} + +message BizAccountLinkInfo { + optional uint64 whatsappBizAcctFbid = 1; + optional string whatsappAcctNumber = 2; + optional uint64 issueTime = 3; + optional HostStorageType hostStorage = 4; + optional AccountType accountType = 5; + enum AccountType { + ENTERPRISE = 0; + } + enum HostStorageType { + ON_PREMISE = 0; + FACEBOOK = 1; + } +} + +message BizAccountPayload { + optional VerifiedNameCertificate vnameCert = 1; + optional bytes bizAcctLinkInfo = 2; +} + +message BizIdentityInfo { + optional VerifiedLevelValue vlevel = 1; + optional VerifiedNameCertificate vnameCert = 2; + optional bool signed = 3; + optional bool revoked = 4; + optional HostStorageType hostStorage = 5; + optional ActualActorsType actualActors = 6; + optional uint64 privacyModeTs = 7; + optional uint64 featureControls = 8; + enum ActualActorsType { + SELF = 0; + BSP = 1; + } + enum HostStorageType { + ON_PREMISE = 0; + FACEBOOK = 1; + } + enum VerifiedLevelValue { + UNKNOWN = 0; + LOW = 1; + HIGH = 2; + } +} + +message CertChain { + optional NoiseCertificate leaf = 1; + optional NoiseCertificate intermediate = 2; + message NoiseCertificate { + optional bytes details = 1; + optional bytes signature = 2; + message Details { + optional uint32 serial = 1; + optional uint32 issuerSerial = 2; + optional bytes key = 3; + optional uint64 notBefore = 4; + optional uint64 notAfter = 5; + } + + } + +} + +message ClientPayload { + optional uint64 username = 1; + optional bool passive = 3; + optional UserAgent userAgent = 5; + optional WebInfo webInfo = 6; + optional string pushName = 7; + optional sfixed32 sessionId = 9; + optional bool shortConnect = 10; + optional ConnectType connectType = 12; + optional ConnectReason connectReason = 13; + repeated int32 shards = 14; + optional DNSSource dnsSource = 15; + optional uint32 connectAttemptCount = 16; + optional uint32 device = 18; + optional DevicePairingRegistrationData devicePairingData = 19; + optional Product product = 20; + optional bytes fbCat = 21; + optional bytes fbUserAgent = 22; + optional bool oc = 23; + optional int32 lc = 24; + optional IOSAppExtension iosAppExtension = 30; + optional uint64 fbAppId = 31; + optional bytes fbDeviceId = 32; + optional bool pull = 33; + optional bytes paddingBytes = 34; + optional int32 yearClass = 36; + optional int32 memClass = 37; + enum ConnectReason { + PUSH = 0; + USER_ACTIVATED = 1; + SCHEDULED = 2; + ERROR_RECONNECT = 3; + NETWORK_SWITCH = 4; + PING_RECONNECT = 5; + } + enum ConnectType { + CELLULAR_UNKNOWN = 0; + WIFI_UNKNOWN = 1; + CELLULAR_EDGE = 100; + CELLULAR_IDEN = 101; + CELLULAR_UMTS = 102; + CELLULAR_EVDO = 103; + CELLULAR_GPRS = 104; + CELLULAR_HSDPA = 105; + CELLULAR_HSUPA = 106; + CELLULAR_HSPA = 107; + CELLULAR_CDMA = 108; + CELLULAR_1XRTT = 109; + CELLULAR_EHRPD = 110; + CELLULAR_LTE = 111; + CELLULAR_HSPAP = 112; + } + message DNSSource { + optional DNSResolutionMethod dnsMethod = 15; + optional bool appCached = 16; + enum DNSResolutionMethod { + SYSTEM = 0; + GOOGLE = 1; + HARDCODED = 2; + OVERRIDE = 3; + FALLBACK = 4; + } + } + + message DevicePairingRegistrationData { + optional bytes eRegid = 1; + optional bytes eKeytype = 2; + optional bytes eIdent = 3; + optional bytes eSkeyId = 4; + optional bytes eSkeyVal = 5; + optional bytes eSkeySig = 6; + optional bytes buildHash = 7; + optional bytes deviceProps = 8; + } + + enum IOSAppExtension { + SHARE_EXTENSION = 0; + SERVICE_EXTENSION = 1; + INTENTS_EXTENSION = 2; + } + enum Product { + WHATSAPP = 0; + MESSENGER = 1; + } + message UserAgent { + optional Platform platform = 1; + optional AppVersion appVersion = 2; + optional string mcc = 3; + optional string mnc = 4; + optional string osVersion = 5; + optional string manufacturer = 6; + optional string device = 7; + optional string osBuildNumber = 8; + optional string phoneId = 9; + optional ReleaseChannel releaseChannel = 10; + optional string localeLanguageIso6391 = 11; + optional string localeCountryIso31661Alpha2 = 12; + optional string deviceBoard = 13; + message AppVersion { + optional uint32 primary = 1; + optional uint32 secondary = 2; + optional uint32 tertiary = 3; + optional uint32 quaternary = 4; + optional uint32 quinary = 5; + } + + enum Platform { + ANDROID = 0; + IOS = 1; + WINDOWS_PHONE = 2; + BLACKBERRY = 3; + BLACKBERRYX = 4; + S40 = 5; + S60 = 6; + PYTHON_CLIENT = 7; + TIZEN = 8; + ENTERPRISE = 9; + SMB_ANDROID = 10; + KAIOS = 11; + SMB_IOS = 12; + WINDOWS = 13; + WEB = 14; + PORTAL = 15; + GREEN_ANDROID = 16; + GREEN_IPHONE = 17; + BLUE_ANDROID = 18; + BLUE_IPHONE = 19; + FBLITE_ANDROID = 20; + MLITE_ANDROID = 21; + IGLITE_ANDROID = 22; + PAGE = 23; + MACOS = 24; + OCULUS_MSG = 25; + OCULUS_CALL = 26; + MILAN = 27; + CAPI = 28; + WEAROS = 29; + ARDEVICE = 30; + VRDEVICE = 31; + BLUE_WEB = 32; + } + enum ReleaseChannel { + RELEASE = 0; + BETA = 1; + ALPHA = 2; + DEBUG = 3; + } + } + + message WebInfo { + optional string refToken = 1; + optional string version = 2; + optional WebdPayload webdPayload = 3; + optional WebSubPlatform webSubPlatform = 4; + enum WebSubPlatform { + WEB_BROWSER = 0; + APP_STORE = 1; + WIN_STORE = 2; + DARWIN = 3; + WIN32 = 4; + } + message WebdPayload { + optional bool usesParticipantInKey = 1; + optional bool supportsStarredMessages = 2; + optional bool supportsDocumentMessages = 3; + optional bool supportsUrlMessages = 4; + optional bool supportsMediaRetry = 5; + optional bool supportsE2EImage = 6; + optional bool supportsE2EVideo = 7; + optional bool supportsE2EAudio = 8; + optional bool supportsE2EDocument = 9; + optional string documentTypes = 10; + optional bytes features = 11; + } + + } + +} + +message ContextInfo { + optional string stanzaId = 1; + optional string participant = 2; + optional Message quotedMessage = 3; + optional string remoteJid = 4; + repeated string mentionedJid = 15; + optional string conversionSource = 18; + optional bytes conversionData = 19; + optional uint32 conversionDelaySeconds = 20; + optional uint32 forwardingScore = 21; + optional bool isForwarded = 22; + optional AdReplyInfo quotedAd = 23; + optional MessageKey placeholderKey = 24; + optional uint32 expiration = 25; + optional int64 ephemeralSettingTimestamp = 26; + optional bytes ephemeralSharedSecret = 27; + optional ExternalAdReplyInfo externalAdReply = 28; + optional string entryPointConversionSource = 29; + optional string entryPointConversionApp = 30; + optional uint32 entryPointConversionDelaySeconds = 31; + optional DisappearingMode disappearingMode = 32; + optional ActionLink actionLink = 33; + optional string groupSubject = 34; + optional string parentGroupJid = 35; + optional string trustBannerType = 37; + optional uint32 trustBannerAction = 38; + optional bool isSampled = 39; + repeated GroupMention groupMentions = 40; + optional UTMInfo utm = 41; + message AdReplyInfo { + optional string advertiserName = 1; + optional MediaType mediaType = 2; + optional bytes jpegThumbnail = 16; + optional string caption = 17; + enum MediaType { + NONE = 0; + IMAGE = 1; + VIDEO = 2; + } + } + + message ExternalAdReplyInfo { + optional string title = 1; + optional string body = 2; + optional MediaType mediaType = 3; + optional string thumbnailUrl = 4; + optional string mediaUrl = 5; + optional bytes thumbnail = 6; + optional string sourceType = 7; + optional string sourceId = 8; + optional string sourceUrl = 9; + optional bool containsAutoReply = 10; + optional bool renderLargerThumbnail = 11; + optional bool showAdAttribution = 12; + optional string ctwaClid = 13; + enum MediaType { + NONE = 0; + IMAGE = 1; + VIDEO = 2; + } + } + + message UTMInfo { + optional string utmSource = 1; + optional string utmCampaign = 2; + } + +} + +message Conversation { + required string id = 1; + repeated HistorySyncMsg messages = 2; + optional string newJid = 3; + optional string oldJid = 4; + optional uint64 lastMsgTimestamp = 5; + optional uint32 unreadCount = 6; + optional bool readOnly = 7; + optional bool endOfHistoryTransfer = 8; + optional uint32 ephemeralExpiration = 9; + optional int64 ephemeralSettingTimestamp = 10; + optional EndOfHistoryTransferType endOfHistoryTransferType = 11; + optional uint64 conversationTimestamp = 12; + optional string name = 13; + optional string pHash = 14; + optional bool notSpam = 15; + optional bool archived = 16; + optional DisappearingMode disappearingMode = 17; + optional uint32 unreadMentionCount = 18; + optional bool markedAsUnread = 19; + repeated GroupParticipant participant = 20; + optional bytes tcToken = 21; + optional uint64 tcTokenTimestamp = 22; + optional bytes contactPrimaryIdentityKey = 23; + optional uint32 pinned = 24; + optional uint64 muteEndTime = 25; + optional WallpaperSettings wallpaper = 26; + optional MediaVisibility mediaVisibility = 27; + optional uint64 tcTokenSenderTimestamp = 28; + optional bool suspended = 29; + optional bool terminated = 30; + optional uint64 createdAt = 31; + optional string createdBy = 32; + optional string description = 33; + optional bool support = 34; + optional bool isParentGroup = 35; + optional string parentGroupId = 37; + optional bool isDefaultSubgroup = 36; + optional string displayName = 38; + optional string pnJid = 39; + optional bool shareOwnPn = 40; + optional bool pnhDuplicateLidThread = 41; + optional string lidJid = 42; + enum EndOfHistoryTransferType { + COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0; + COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1; + } +} + +message DeviceListMetadata { + optional bytes senderKeyHash = 1; + optional uint64 senderTimestamp = 2; + repeated uint32 senderKeyIndexes = 3 [packed=true]; + optional bytes recipientKeyHash = 8; + optional uint64 recipientTimestamp = 9; + repeated uint32 recipientKeyIndexes = 10 [packed=true]; +} + +message DeviceProps { + optional string os = 1; + optional AppVersion version = 2; + optional PlatformType platformType = 3; + optional bool requireFullSync = 4; + optional HistorySyncConfig historySyncConfig = 5; + message AppVersion { + optional uint32 primary = 1; + optional uint32 secondary = 2; + optional uint32 tertiary = 3; + optional uint32 quaternary = 4; + optional uint32 quinary = 5; + } + + message HistorySyncConfig { + optional uint32 fullSyncDaysLimit = 1; + optional uint32 fullSyncSizeMbLimit = 2; + optional uint32 storageQuotaMb = 3; + } + + enum PlatformType { + UNKNOWN = 0; + CHROME = 1; + FIREFOX = 2; + IE = 3; + OPERA = 4; + SAFARI = 5; + EDGE = 6; + DESKTOP = 7; + IPAD = 8; + ANDROID_TABLET = 9; + OHANA = 10; + ALOHA = 11; + CATALINA = 12; + TCL_TV = 13; + IOS_PHONE = 14; + IOS_CATALYST = 15; + ANDROID_PHONE = 16; + ANDROID_AMBIGUOUS = 17; + } +} + +message DisappearingMode { + optional Initiator initiator = 1; + enum Initiator { + CHANGED_IN_CHAT = 0; + INITIATED_BY_ME = 1; + INITIATED_BY_OTHER = 2; + } +} + +message EphemeralSetting { + optional sfixed32 duration = 1; + optional sfixed64 timestamp = 2; +} + +message ExitCode { + optional uint64 code = 1; + optional string text = 2; +} + +message ExternalBlobReference { + optional bytes mediaKey = 1; + optional string directPath = 2; + optional string handle = 3; + optional uint64 fileSizeBytes = 4; + optional bytes fileSha256 = 5; + optional bytes fileEncSha256 = 6; +} + +message GlobalSettings { + optional WallpaperSettings lightThemeWallpaper = 1; + optional MediaVisibility mediaVisibility = 2; + optional WallpaperSettings darkThemeWallpaper = 3; + optional AutoDownloadSettings autoDownloadWiFi = 4; + optional AutoDownloadSettings autoDownloadCellular = 5; + optional AutoDownloadSettings autoDownloadRoaming = 6; + optional bool showIndividualNotificationsPreview = 7; + optional bool showGroupNotificationsPreview = 8; + optional int32 disappearingModeDuration = 9; + optional int64 disappearingModeTimestamp = 10; + optional AvatarUserSettings avatarUserSettings = 11; +} + +message GroupMention { + optional string groupJid = 1; + optional string groupSubject = 2; +} + +message GroupParticipant { + required string userJid = 1; + optional Rank rank = 2; + enum Rank { + REGULAR = 0; + ADMIN = 1; + SUPERADMIN = 2; + } +} + +message HandshakeMessage { + optional ClientHello clientHello = 2; + optional ServerHello serverHello = 3; + optional ClientFinish clientFinish = 4; + message ClientFinish { + optional bytes static = 1; + optional bytes payload = 2; + } + + message ClientHello { + optional bytes ephemeral = 1; + optional bytes static = 2; + optional bytes payload = 3; + } + + message ServerHello { + optional bytes ephemeral = 1; + optional bytes static = 2; + optional bytes payload = 3; + } + +} + +message HistorySync { + required HistorySyncType syncType = 1; + repeated Conversation conversations = 2; + repeated WebMessageInfo statusV3Messages = 3; + optional uint32 chunkOrder = 5; + optional uint32 progress = 6; + repeated Pushname pushnames = 7; + optional GlobalSettings globalSettings = 8; + optional bytes threadIdUserSecret = 9; + optional uint32 threadDsTimeframeOffset = 10; + repeated StickerMetadata recentStickers = 11; + repeated PastParticipants pastParticipants = 12; + enum HistorySyncType { + INITIAL_BOOTSTRAP = 0; + INITIAL_STATUS_V3 = 1; + FULL = 2; + RECENT = 3; + PUSH_NAME = 4; + NON_BLOCKING_DATA = 5; + ON_DEMAND = 6; + } +} + +message HistorySyncMsg { + optional WebMessageInfo message = 1; + optional uint64 msgOrderId = 2; +} + +message HydratedTemplateButton { + optional uint32 index = 4; + oneof hydratedButton { + HydratedTemplateButton.HydratedQuickReplyButton quickReplyButton = 1; + HydratedTemplateButton.HydratedURLButton urlButton = 2; + HydratedTemplateButton.HydratedCallButton callButton = 3; + } + message HydratedCallButton { + optional string displayText = 1; + optional string phoneNumber = 2; + } + + message HydratedQuickReplyButton { + optional string displayText = 1; + optional string id = 2; + } + + message HydratedURLButton { + optional string displayText = 1; + optional string url = 2; + } + +} + +message IdentityKeyPairStructure { + optional bytes publicKey = 1; + optional bytes privateKey = 2; +} + +message InteractiveAnnotation { + repeated Point polygonVertices = 1; + oneof action { + Location location = 2; + } +} + +message KeepInChat { + optional KeepType keepType = 1; + optional int64 serverTimestamp = 2; + optional MessageKey key = 3; + optional string deviceJid = 4; + optional int64 clientTimestampMs = 5; + optional int64 serverTimestampMs = 6; +} + +enum KeepType { + UNKNOWN = 0; + KEEP_FOR_ALL = 1; + UNDO_KEEP_FOR_ALL = 2; +} +message KeyId { + optional bytes id = 1; +} + +message LocalizedName { + optional string lg = 1; + optional string lc = 2; + optional string verifiedName = 3; +} + +message Location { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional string name = 3; +} + +message MediaData { + optional string localPath = 1; +} + +message MediaRetryNotification { + optional string stanzaId = 1; + optional string directPath = 2; + optional ResultType result = 3; + enum ResultType { + GENERAL_ERROR = 0; + SUCCESS = 1; + NOT_FOUND = 2; + DECRYPTION_ERROR = 3; + } +} + +enum MediaVisibility { + DEFAULT = 0; + OFF = 1; + ON = 2; +} +message Message { + optional string conversation = 1; + optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2; + optional ImageMessage imageMessage = 3; + optional ContactMessage contactMessage = 4; + optional LocationMessage locationMessage = 5; + optional ExtendedTextMessage extendedTextMessage = 6; + optional DocumentMessage documentMessage = 7; + optional AudioMessage audioMessage = 8; + optional VideoMessage videoMessage = 9; + optional Call call = 10; + optional Chat chat = 11; + optional ProtocolMessage protocolMessage = 12; + optional ContactsArrayMessage contactsArrayMessage = 13; + optional HighlyStructuredMessage highlyStructuredMessage = 14; + optional SenderKeyDistributionMessage fastRatchetKeySenderKeyDistributionMessage = 15; + optional SendPaymentMessage sendPaymentMessage = 16; + optional LiveLocationMessage liveLocationMessage = 18; + optional RequestPaymentMessage requestPaymentMessage = 22; + optional DeclinePaymentRequestMessage declinePaymentRequestMessage = 23; + optional CancelPaymentRequestMessage cancelPaymentRequestMessage = 24; + optional TemplateMessage templateMessage = 25; + optional StickerMessage stickerMessage = 26; + optional GroupInviteMessage groupInviteMessage = 28; + optional TemplateButtonReplyMessage templateButtonReplyMessage = 29; + optional ProductMessage productMessage = 30; + optional DeviceSentMessage deviceSentMessage = 31; + optional MessageContextInfo messageContextInfo = 35; + optional ListMessage listMessage = 36; + optional FutureProofMessage viewOnceMessage = 37; + optional OrderMessage orderMessage = 38; + optional ListResponseMessage listResponseMessage = 39; + optional FutureProofMessage ephemeralMessage = 40; + optional InvoiceMessage invoiceMessage = 41; + optional ButtonsMessage buttonsMessage = 42; + optional ButtonsResponseMessage buttonsResponseMessage = 43; + optional PaymentInviteMessage paymentInviteMessage = 44; + optional InteractiveMessage interactiveMessage = 45; + optional ReactionMessage reactionMessage = 46; + optional StickerSyncRMRMessage stickerSyncRmrMessage = 47; + optional InteractiveResponseMessage interactiveResponseMessage = 48; + optional PollCreationMessage pollCreationMessage = 49; + optional PollUpdateMessage pollUpdateMessage = 50; + optional KeepInChatMessage keepInChatMessage = 51; + optional FutureProofMessage documentWithCaptionMessage = 53; + optional RequestPhoneNumberMessage requestPhoneNumberMessage = 54; + optional FutureProofMessage viewOnceMessageV2 = 55; + optional EncReactionMessage encReactionMessage = 56; + optional FutureProofMessage editedMessage = 58; + optional FutureProofMessage viewOnceMessageV2Extension = 59; + optional PollCreationMessage pollCreationMessageV2 = 60; + optional ScheduledCallCreationMessage scheduledCallCreationMessage = 61; + optional FutureProofMessage groupMentionedMessage = 62; + optional PinMessage pinMessage = 63; + optional PollCreationMessage pollCreationMessageV3 = 64; + optional ScheduledCallEditMessage scheduledCallEditMessage = 65; + optional VideoMessage ptvMessage = 66; + message AppStateFatalExceptionNotification { + repeated string collectionNames = 1; + optional int64 timestamp = 2; + } + + message AppStateSyncKey { + optional Message.AppStateSyncKeyId keyId = 1; + optional Message.AppStateSyncKeyData keyData = 2; + } + + message AppStateSyncKeyData { + optional bytes keyData = 1; + optional Message.AppStateSyncKeyFingerprint fingerprint = 2; + optional int64 timestamp = 3; + } + + message AppStateSyncKeyFingerprint { + optional uint32 rawId = 1; + optional uint32 currentIndex = 2; + repeated uint32 deviceIndexes = 3 [packed=true]; + } + + message AppStateSyncKeyId { + optional bytes keyId = 1; + } + + message AppStateSyncKeyRequest { + repeated Message.AppStateSyncKeyId keyIds = 1; + } + + message AppStateSyncKeyShare { + repeated Message.AppStateSyncKey keys = 1; + } + + message AudioMessage { + optional string url = 1; + optional string mimetype = 2; + optional bytes fileSha256 = 3; + optional uint64 fileLength = 4; + optional uint32 seconds = 5; + optional bool ptt = 6; + optional bytes mediaKey = 7; + optional bytes fileEncSha256 = 8; + optional string directPath = 9; + optional int64 mediaKeyTimestamp = 10; + optional ContextInfo contextInfo = 17; + optional bytes streamingSidecar = 18; + optional bytes waveform = 19; + optional fixed32 backgroundArgb = 20; + optional bool viewOnce = 21; + } + + message ButtonsMessage { + optional string contentText = 6; + optional string footerText = 7; + optional ContextInfo contextInfo = 8; + repeated Button buttons = 9; + optional HeaderType headerType = 10; + oneof header { + string text = 1; + Message.DocumentMessage documentMessage = 2; + Message.ImageMessage imageMessage = 3; + Message.VideoMessage videoMessage = 4; + Message.LocationMessage locationMessage = 5; + } + message Button { + optional string buttonId = 1; + optional ButtonText buttonText = 2; + optional Type type = 3; + optional NativeFlowInfo nativeFlowInfo = 4; + message ButtonText { + optional string displayText = 1; + } + + message NativeFlowInfo { + optional string name = 1; + optional string paramsJson = 2; + } + + enum Type { + UNKNOWN = 0; + RESPONSE = 1; + NATIVE_FLOW = 2; + } + } + + enum HeaderType { + UNKNOWN = 0; + EMPTY = 1; + TEXT = 2; + DOCUMENT = 3; + IMAGE = 4; + VIDEO = 5; + LOCATION = 6; + } + } + + message ButtonsResponseMessage { + optional string selectedButtonId = 1; + optional ContextInfo contextInfo = 3; + optional Type type = 4; + oneof response { + string selectedDisplayText = 2; + } + enum Type { + UNKNOWN = 0; + DISPLAY_TEXT = 1; + } + } + + message Call { + optional bytes callKey = 1; + optional string conversionSource = 2; + optional bytes conversionData = 3; + optional uint32 conversionDelaySeconds = 4; + } + + message CancelPaymentRequestMessage { + optional MessageKey key = 1; + } + + message Chat { + optional string displayName = 1; + optional string id = 2; + } + + message ContactMessage { + optional string displayName = 1; + optional string vcard = 16; + optional ContextInfo contextInfo = 17; + } + + message ContactsArrayMessage { + optional string displayName = 1; + repeated Message.ContactMessage contacts = 2; + optional ContextInfo contextInfo = 17; + } + + message DeclinePaymentRequestMessage { + optional MessageKey key = 1; + } + + message DeviceSentMessage { + optional string destinationJid = 1; + optional Message message = 2; + optional string phash = 3; + } + + message DocumentMessage { + optional string url = 1; + optional string mimetype = 2; + optional string title = 3; + optional bytes fileSha256 = 4; + optional uint64 fileLength = 5; + optional uint32 pageCount = 6; + optional bytes mediaKey = 7; + optional string fileName = 8; + optional bytes fileEncSha256 = 9; + optional string directPath = 10; + optional int64 mediaKeyTimestamp = 11; + optional bool contactVcard = 12; + optional string thumbnailDirectPath = 13; + optional bytes thumbnailSha256 = 14; + optional bytes thumbnailEncSha256 = 15; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional uint32 thumbnailHeight = 18; + optional uint32 thumbnailWidth = 19; + optional string caption = 20; + } + + message EncReactionMessage { + optional MessageKey targetMessageKey = 1; + optional bytes encPayload = 2; + optional bytes encIv = 3; + } + + message ExtendedTextMessage { + optional string text = 1; + optional string matchedText = 2; + optional string canonicalUrl = 4; + optional string description = 5; + optional string title = 6; + optional fixed32 textArgb = 7; + optional fixed32 backgroundArgb = 8; + optional FontType font = 9; + optional PreviewType previewType = 10; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bool doNotPlayInline = 18; + optional string thumbnailDirectPath = 19; + optional bytes thumbnailSha256 = 20; + optional bytes thumbnailEncSha256 = 21; + optional bytes mediaKey = 22; + optional int64 mediaKeyTimestamp = 23; + optional uint32 thumbnailHeight = 24; + optional uint32 thumbnailWidth = 25; + optional InviteLinkGroupType inviteLinkGroupType = 26; + optional string inviteLinkParentGroupSubjectV2 = 27; + optional bytes inviteLinkParentGroupThumbnailV2 = 28; + optional InviteLinkGroupType inviteLinkGroupTypeV2 = 29; + optional bool viewOnce = 30; + enum FontType { + SANS_SERIF = 0; + SERIF = 1; + NORICAN_REGULAR = 2; + BRYNDAN_WRITE = 3; + BEBASNEUE_REGULAR = 4; + OSWALD_HEAVY = 5; + DAMION_REGULAR = 6; + MORNINGBREEZE_REGULAR = 7; + CALISTOGA_REGULAR = 8; + EXO2_EXTRABOLD = 9; + COURIERPRIME_BOLD = 10; + } + enum InviteLinkGroupType { + DEFAULT = 0; + PARENT = 1; + SUB = 2; + DEFAULT_SUB = 3; + } + enum PreviewType { + NONE = 0; + VIDEO = 1; + } + } + + message FutureProofMessage { + optional Message message = 1; + } + + message GroupInviteMessage { + optional string groupJid = 1; + optional string inviteCode = 2; + optional int64 inviteExpiration = 3; + optional string groupName = 4; + optional bytes jpegThumbnail = 5; + optional string caption = 6; + optional ContextInfo contextInfo = 7; + optional GroupType groupType = 8; + enum GroupType { + DEFAULT = 0; + PARENT = 1; + } + } + + message HighlyStructuredMessage { + optional string namespace = 1; + optional string elementName = 2; + repeated string params = 3; + optional string fallbackLg = 4; + optional string fallbackLc = 5; + repeated HSMLocalizableParameter localizableParams = 6; + optional string deterministicLg = 7; + optional string deterministicLc = 8; + optional Message.TemplateMessage hydratedHsm = 9; + message HSMLocalizableParameter { + optional string default = 1; + oneof paramOneof { + Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency currency = 2; + Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime dateTime = 3; + } + message HSMCurrency { + optional string currencyCode = 1; + optional int64 amount1000 = 2; + } + + message HSMDateTime { + oneof datetimeOneof { + Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent component = 1; + Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch unixEpoch = 2; + } + message HSMDateTimeComponent { + optional DayOfWeekType dayOfWeek = 1; + optional uint32 year = 2; + optional uint32 month = 3; + optional uint32 dayOfMonth = 4; + optional uint32 hour = 5; + optional uint32 minute = 6; + optional CalendarType calendar = 7; + enum CalendarType { + GREGORIAN = 1; + SOLAR_HIJRI = 2; + } + enum DayOfWeekType { + MONDAY = 1; + TUESDAY = 2; + WEDNESDAY = 3; + THURSDAY = 4; + FRIDAY = 5; + SATURDAY = 6; + SUNDAY = 7; + } + } + + message HSMDateTimeUnixEpoch { + optional int64 timestamp = 1; + } + + } + + } + + } + + message HistorySyncNotification { + optional bytes fileSha256 = 1; + optional uint64 fileLength = 2; + optional bytes mediaKey = 3; + optional bytes fileEncSha256 = 4; + optional string directPath = 5; + optional HistorySyncType syncType = 6; + optional uint32 chunkOrder = 7; + optional string originalMessageId = 8; + optional uint32 progress = 9; + optional int64 oldestMsgInChunkTimestampSec = 10; + enum HistorySyncType { + INITIAL_BOOTSTRAP = 0; + INITIAL_STATUS_V3 = 1; + FULL = 2; + RECENT = 3; + PUSH_NAME = 4; + NON_BLOCKING_DATA = 5; + ON_DEMAND = 6; + } + } + + message ImageMessage { + optional string url = 1; + optional string mimetype = 2; + optional string caption = 3; + optional bytes fileSha256 = 4; + optional uint64 fileLength = 5; + optional uint32 height = 6; + optional uint32 width = 7; + optional bytes mediaKey = 8; + optional bytes fileEncSha256 = 9; + repeated InteractiveAnnotation interactiveAnnotations = 10; + optional string directPath = 11; + optional int64 mediaKeyTimestamp = 12; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bytes firstScanSidecar = 18; + optional uint32 firstScanLength = 19; + optional uint32 experimentGroupId = 20; + optional bytes scansSidecar = 21; + repeated uint32 scanLengths = 22; + optional bytes midQualityFileSha256 = 23; + optional bytes midQualityFileEncSha256 = 24; + optional bool viewOnce = 25; + optional string thumbnailDirectPath = 26; + optional bytes thumbnailSha256 = 27; + optional bytes thumbnailEncSha256 = 28; + optional string staticUrl = 29; + } + + message InitialSecurityNotificationSettingSync { + optional bool securityNotificationEnabled = 1; + } + + message InteractiveMessage { + optional Header header = 1; + optional Body body = 2; + optional Footer footer = 3; + optional ContextInfo contextInfo = 15; + oneof interactiveMessage { + Message.InteractiveMessage.ShopMessage shopStorefrontMessage = 4; + Message.InteractiveMessage.CollectionMessage collectionMessage = 5; + Message.InteractiveMessage.NativeFlowMessage nativeFlowMessage = 6; + } + message Body { + optional string text = 1; + } + + message CollectionMessage { + optional string bizJid = 1; + optional string id = 2; + optional int32 messageVersion = 3; + } + + message Footer { + optional string text = 1; + } + + message Header { + optional string title = 1; + optional string subtitle = 2; + optional bool hasMediaAttachment = 5; + oneof media { + Message.DocumentMessage documentMessage = 3; + Message.ImageMessage imageMessage = 4; + bytes jpegThumbnail = 6; + Message.VideoMessage videoMessage = 7; + } + } + + message NativeFlowMessage { + repeated NativeFlowButton buttons = 1; + optional string messageParamsJson = 2; + optional int32 messageVersion = 3; + message NativeFlowButton { + optional string name = 1; + optional string buttonParamsJson = 2; + } + + } + + message ShopMessage { + optional string id = 1; + optional Surface surface = 2; + optional int32 messageVersion = 3; + enum Surface { + UNKNOWN_SURFACE = 0; + FB = 1; + IG = 2; + WA = 3; + } + } + + } + + message InteractiveResponseMessage { + optional Body body = 1; + optional ContextInfo contextInfo = 15; + oneof interactiveResponseMessage { + Message.InteractiveResponseMessage.NativeFlowResponseMessage nativeFlowResponseMessage = 2; + } + message Body { + optional string text = 1; + } + + message NativeFlowResponseMessage { + optional string name = 1; + optional string paramsJson = 2; + optional int32 version = 3; + } + + } + + message InvoiceMessage { + optional string note = 1; + optional string token = 2; + optional AttachmentType attachmentType = 3; + optional string attachmentMimetype = 4; + optional bytes attachmentMediaKey = 5; + optional int64 attachmentMediaKeyTimestamp = 6; + optional bytes attachmentFileSha256 = 7; + optional bytes attachmentFileEncSha256 = 8; + optional string attachmentDirectPath = 9; + optional bytes attachmentJpegThumbnail = 10; + enum AttachmentType { + IMAGE = 0; + PDF = 1; + } + } + + message KeepInChatMessage { + optional MessageKey key = 1; + optional KeepType keepType = 2; + optional int64 timestampMs = 3; + } + + message ListMessage { + optional string title = 1; + optional string description = 2; + optional string buttonText = 3; + optional ListType listType = 4; + repeated Section sections = 5; + optional ProductListInfo productListInfo = 6; + optional string footerText = 7; + optional ContextInfo contextInfo = 8; + enum ListType { + UNKNOWN = 0; + SINGLE_SELECT = 1; + PRODUCT_LIST = 2; + } + message Product { + optional string productId = 1; + } + + message ProductListHeaderImage { + optional string productId = 1; + optional bytes jpegThumbnail = 2; + } + + message ProductListInfo { + repeated Message.ListMessage.ProductSection productSections = 1; + optional Message.ListMessage.ProductListHeaderImage headerImage = 2; + optional string businessOwnerJid = 3; + } + + message ProductSection { + optional string title = 1; + repeated Message.ListMessage.Product products = 2; + } + + message Row { + optional string title = 1; + optional string description = 2; + optional string rowId = 3; + } + + message Section { + optional string title = 1; + repeated Message.ListMessage.Row rows = 2; + } + + } + + message ListResponseMessage { + optional string title = 1; + optional ListType listType = 2; + optional SingleSelectReply singleSelectReply = 3; + optional ContextInfo contextInfo = 4; + optional string description = 5; + enum ListType { + UNKNOWN = 0; + SINGLE_SELECT = 1; + } + message SingleSelectReply { + optional string selectedRowId = 1; + } + + } + + message LiveLocationMessage { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional uint32 accuracyInMeters = 3; + optional float speedInMps = 4; + optional uint32 degreesClockwiseFromMagneticNorth = 5; + optional string caption = 6; + optional int64 sequenceNumber = 7; + optional uint32 timeOffset = 8; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + } + + message LocationMessage { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional string name = 3; + optional string address = 4; + optional string url = 5; + optional bool isLive = 6; + optional uint32 accuracyInMeters = 7; + optional float speedInMps = 8; + optional uint32 degreesClockwiseFromMagneticNorth = 9; + optional string comment = 11; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + } + + message OrderMessage { + optional string orderId = 1; + optional bytes thumbnail = 2; + optional int32 itemCount = 3; + optional OrderStatus status = 4; + optional OrderSurface surface = 5; + optional string message = 6; + optional string orderTitle = 7; + optional string sellerJid = 8; + optional string token = 9; + optional int64 totalAmount1000 = 10; + optional string totalCurrencyCode = 11; + optional ContextInfo contextInfo = 17; + enum OrderStatus { + INQUIRY = 1; + } + enum OrderSurface { + CATALOG = 1; + } + } + + message PaymentInviteMessage { + optional ServiceType serviceType = 1; + optional int64 expiryTimestamp = 2; + enum ServiceType { + UNKNOWN = 0; + FBPAY = 1; + NOVI = 2; + UPI = 3; + } + } + + message PeerDataOperationRequestMessage { + optional Message.PeerDataOperationRequestType peerDataOperationRequestType = 1; + repeated RequestStickerReupload requestStickerReupload = 2; + repeated RequestUrlPreview requestUrlPreview = 3; + optional HistorySyncOnDemandRequest historySyncOnDemandRequest = 4; + message HistorySyncOnDemandRequest { + optional string chatJid = 1; + optional string oldestMsgId = 2; + optional bool oldestMsgFromMe = 3; + optional int32 onDemandMsgCount = 4; + optional int64 oldestMsgTimestampMs = 5; + } + + message RequestStickerReupload { + optional string fileSha256 = 1; + } + + message RequestUrlPreview { + optional string url = 1; + } + + } + + message PeerDataOperationRequestResponseMessage { + optional Message.PeerDataOperationRequestType peerDataOperationRequestType = 1; + optional string stanzaId = 2; + repeated PeerDataOperationResult peerDataOperationResult = 3; + message PeerDataOperationResult { + optional MediaRetryNotification.ResultType mediaUploadResult = 1; + optional Message.StickerMessage stickerMessage = 2; + optional LinkPreviewResponse linkPreviewResponse = 3; + message LinkPreviewResponse { + optional string url = 1; + optional string title = 2; + optional string description = 3; + optional bytes thumbData = 4; + optional string canonicalUrl = 5; + optional string matchText = 6; + optional string previewType = 7; + } + + } + + } + + enum PeerDataOperationRequestType { + UPLOAD_STICKER = 0; + SEND_RECENT_STICKER_BOOTSTRAP = 1; + GENERATE_LINK_PREVIEW = 2; + HISTORY_SYNC_ON_DEMAND = 3; + } + message PinMessage { + optional MessageKey key = 1; + optional PinMessageType pinMessageType = 2; + optional int64 senderTimestampMs = 3; + enum PinMessageType { + UNKNOWN_PIN_MESSAGE_TYPE = 0; + PIN_FOR_ALL = 1; + UNPIN_FOR_ALL = 2; + } + } + + message PollCreationMessage { + optional bytes encKey = 1; + optional string name = 2; + repeated Option options = 3; + optional uint32 selectableOptionsCount = 4; + optional ContextInfo contextInfo = 5; + message Option { + optional string optionName = 1; + } + + } + + message PollEncValue { + optional bytes encPayload = 1; + optional bytes encIv = 2; + } + + message PollUpdateMessage { + optional MessageKey pollCreationMessageKey = 1; + optional Message.PollEncValue vote = 2; + optional Message.PollUpdateMessageMetadata metadata = 3; + optional int64 senderTimestampMs = 4; + } + + message PollUpdateMessageMetadata { + } + + message PollVoteMessage { + repeated bytes selectedOptions = 1; + } + + message ProductMessage { + optional ProductSnapshot product = 1; + optional string businessOwnerJid = 2; + optional CatalogSnapshot catalog = 4; + optional string body = 5; + optional string footer = 6; + optional ContextInfo contextInfo = 17; + message CatalogSnapshot { + optional Message.ImageMessage catalogImage = 1; + optional string title = 2; + optional string description = 3; + } + + message ProductSnapshot { + optional Message.ImageMessage productImage = 1; + optional string productId = 2; + optional string title = 3; + optional string description = 4; + optional string currencyCode = 5; + optional int64 priceAmount1000 = 6; + optional string retailerId = 7; + optional string url = 8; + optional uint32 productImageCount = 9; + optional string firstImageId = 11; + optional int64 salePriceAmount1000 = 12; + } + + } + + message ProtocolMessage { + optional MessageKey key = 1; + optional Type type = 2; + optional uint32 ephemeralExpiration = 4; + optional int64 ephemeralSettingTimestamp = 5; + optional Message.HistorySyncNotification historySyncNotification = 6; + optional Message.AppStateSyncKeyShare appStateSyncKeyShare = 7; + optional Message.AppStateSyncKeyRequest appStateSyncKeyRequest = 8; + optional Message.InitialSecurityNotificationSettingSync initialSecurityNotificationSettingSync = 9; + optional Message.AppStateFatalExceptionNotification appStateFatalExceptionNotification = 10; + optional DisappearingMode disappearingMode = 11; + optional Message editedMessage = 14; + optional int64 timestampMs = 15; + optional Message.PeerDataOperationRequestMessage peerDataOperationRequestMessage = 16; + optional Message.PeerDataOperationRequestResponseMessage peerDataOperationRequestResponseMessage = 17; + enum Type { + REVOKE = 0; + EPHEMERAL_SETTING = 3; + EPHEMERAL_SYNC_RESPONSE = 4; + HISTORY_SYNC_NOTIFICATION = 5; + APP_STATE_SYNC_KEY_SHARE = 6; + APP_STATE_SYNC_KEY_REQUEST = 7; + MSG_FANOUT_BACKFILL_REQUEST = 8; + INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9; + APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10; + SHARE_PHONE_NUMBER = 11; + MESSAGE_EDIT = 14; + PEER_DATA_OPERATION_REQUEST_MESSAGE = 16; + PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17; + } + } + + message ReactionMessage { + optional MessageKey key = 1; + optional string text = 2; + optional string groupingKey = 3; + optional int64 senderTimestampMs = 4; + } + + message RequestPaymentMessage { + optional Message noteMessage = 4; + optional string currencyCodeIso4217 = 1; + optional uint64 amount1000 = 2; + optional string requestFrom = 3; + optional int64 expiryTimestamp = 5; + optional Money amount = 6; + optional PaymentBackground background = 7; + } + + message RequestPhoneNumberMessage { + optional ContextInfo contextInfo = 1; + } + + message ScheduledCallCreationMessage { + optional int64 scheduledTimestampMs = 1; + optional CallType callType = 2; + optional string title = 3; + enum CallType { + UNKNOWN = 0; + VOICE = 1; + VIDEO = 2; + } + } + + message ScheduledCallEditMessage { + optional MessageKey key = 1; + optional EditType editType = 2; + enum EditType { + UNKNOWN = 0; + CANCEL = 1; + } + } + + message SendPaymentMessage { + optional Message noteMessage = 2; + optional MessageKey requestMessageKey = 3; + optional PaymentBackground background = 4; + } + + message SenderKeyDistributionMessage { + optional string groupId = 1; + optional bytes axolotlSenderKeyDistributionMessage = 2; + } + + message StickerMessage { + optional string url = 1; + optional bytes fileSha256 = 2; + optional bytes fileEncSha256 = 3; + optional bytes mediaKey = 4; + optional string mimetype = 5; + optional uint32 height = 6; + optional uint32 width = 7; + optional string directPath = 8; + optional uint64 fileLength = 9; + optional int64 mediaKeyTimestamp = 10; + optional uint32 firstFrameLength = 11; + optional bytes firstFrameSidecar = 12; + optional bool isAnimated = 13; + optional bytes pngThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional int64 stickerSentTs = 18; + optional bool isAvatar = 19; + } + + message StickerSyncRMRMessage { + repeated string filehash = 1; + optional string rmrSource = 2; + optional int64 requestTimestamp = 3; + } + + message TemplateButtonReplyMessage { + optional string selectedId = 1; + optional string selectedDisplayText = 2; + optional ContextInfo contextInfo = 3; + optional uint32 selectedIndex = 4; + } + + message TemplateMessage { + optional ContextInfo contextInfo = 3; + optional HydratedFourRowTemplate hydratedTemplate = 4; + optional string templateId = 9; + oneof format { + Message.TemplateMessage.FourRowTemplate fourRowTemplate = 1; + Message.TemplateMessage.HydratedFourRowTemplate hydratedFourRowTemplate = 2; + Message.InteractiveMessage interactiveMessageTemplate = 5; + } + message FourRowTemplate { + optional Message.HighlyStructuredMessage content = 6; + optional Message.HighlyStructuredMessage footer = 7; + repeated TemplateButton buttons = 8; + oneof title { + Message.DocumentMessage documentMessage = 1; + Message.HighlyStructuredMessage highlyStructuredMessage = 2; + Message.ImageMessage imageMessage = 3; + Message.VideoMessage videoMessage = 4; + Message.LocationMessage locationMessage = 5; + } + } + + message HydratedFourRowTemplate { + optional string hydratedContentText = 6; + optional string hydratedFooterText = 7; + repeated HydratedTemplateButton hydratedButtons = 8; + optional string templateId = 9; + oneof title { + Message.DocumentMessage documentMessage = 1; + string hydratedTitleText = 2; + Message.ImageMessage imageMessage = 3; + Message.VideoMessage videoMessage = 4; + Message.LocationMessage locationMessage = 5; + } + } + + } + + message VideoMessage { + optional string url = 1; + optional string mimetype = 2; + optional bytes fileSha256 = 3; + optional uint64 fileLength = 4; + optional uint32 seconds = 5; + optional bytes mediaKey = 6; + optional string caption = 7; + optional bool gifPlayback = 8; + optional uint32 height = 9; + optional uint32 width = 10; + optional bytes fileEncSha256 = 11; + repeated InteractiveAnnotation interactiveAnnotations = 12; + optional string directPath = 13; + optional int64 mediaKeyTimestamp = 14; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bytes streamingSidecar = 18; + optional Attribution gifAttribution = 19; + optional bool viewOnce = 20; + optional string thumbnailDirectPath = 21; + optional bytes thumbnailSha256 = 22; + optional bytes thumbnailEncSha256 = 23; + optional string staticUrl = 24; + enum Attribution { + NONE = 0; + GIPHY = 1; + TENOR = 2; + } + } + +} + +message MessageContextInfo { + optional DeviceListMetadata deviceListMetadata = 1; + optional int32 deviceListMetadataVersion = 2; + optional bytes messageSecret = 3; + optional bytes paddingBytes = 4; +} + +message MessageKey { + optional string remoteJid = 1; + optional bool fromMe = 2; + optional string id = 3; + optional string participant = 4; +} + +message Money { + optional int64 value = 1; + optional uint32 offset = 2; + optional string currencyCode = 3; +} + +message MsgOpaqueData { + optional string body = 1; + optional string caption = 3; + optional double lng = 5; + optional bool isLive = 6; + optional double lat = 7; + optional int32 paymentAmount1000 = 8; + optional string paymentNoteMsgBody = 9; + optional string canonicalUrl = 10; + optional string matchedText = 11; + optional string title = 12; + optional string description = 13; + optional bytes futureproofBuffer = 14; + optional string clientUrl = 15; + optional string loc = 16; + optional string pollName = 17; + repeated PollOption pollOptions = 18; + optional uint32 pollSelectableOptionsCount = 20; + optional bytes messageSecret = 21; + optional string originalSelfAuthor = 51; + optional int64 senderTimestampMs = 22; + optional string pollUpdateParentKey = 23; + optional PollEncValue encPollVote = 24; + optional bool isSentCagPollCreation = 28; + optional string encReactionTargetMessageKey = 25; + optional bytes encReactionEncPayload = 26; + optional bytes encReactionEncIv = 27; + message PollOption { + optional string name = 1; + } + +} + +message MsgRowOpaqueData { + optional MsgOpaqueData currentMsg = 1; + optional MsgOpaqueData quotedMsg = 2; +} + +message NoiseCertificate { + optional bytes details = 1; + optional bytes signature = 2; + message Details { + optional uint32 serial = 1; + optional string issuer = 2; + optional uint64 expires = 3; + optional string subject = 4; + optional bytes key = 5; + } + +} + +message NotificationMessageInfo { + optional MessageKey key = 1; + optional Message message = 2; + optional uint64 messageTimestamp = 3; + optional string participant = 4; +} + +message PastParticipant { + optional string userJid = 1; + optional LeaveReason leaveReason = 2; + optional uint64 leaveTs = 3; + enum LeaveReason { + LEFT = 0; + REMOVED = 1; + } +} + +message PastParticipants { + optional string groupJid = 1; + repeated PastParticipant pastParticipants = 2; +} + +message PaymentBackground { + optional string id = 1; + optional uint64 fileLength = 2; + optional uint32 width = 3; + optional uint32 height = 4; + optional string mimetype = 5; + optional fixed32 placeholderArgb = 6; + optional fixed32 textArgb = 7; + optional fixed32 subtextArgb = 8; + optional MediaData mediaData = 9; + optional Type type = 10; + message MediaData { + optional bytes mediaKey = 1; + optional int64 mediaKeyTimestamp = 2; + optional bytes fileSha256 = 3; + optional bytes fileEncSha256 = 4; + optional string directPath = 5; + } + + enum Type { + UNKNOWN = 0; + DEFAULT = 1; + } +} + +message PaymentInfo { + optional Currency currencyDeprecated = 1; + optional uint64 amount1000 = 2; + optional string receiverJid = 3; + optional Status status = 4; + optional uint64 transactionTimestamp = 5; + optional MessageKey requestMessageKey = 6; + optional uint64 expiryTimestamp = 7; + optional bool futureproofed = 8; + optional string currency = 9; + optional TxnStatus txnStatus = 10; + optional bool useNoviFiatFormat = 11; + optional Money primaryAmount = 12; + optional Money exchangeAmount = 13; + enum Currency { + UNKNOWN_CURRENCY = 0; + INR = 1; + } + enum Status { + UNKNOWN_STATUS = 0; + PROCESSING = 1; + SENT = 2; + NEED_TO_ACCEPT = 3; + COMPLETE = 4; + COULD_NOT_COMPLETE = 5; + REFUNDED = 6; + EXPIRED = 7; + REJECTED = 8; + CANCELLED = 9; + WAITING_FOR_PAYER = 10; + WAITING = 11; + } + enum TxnStatus { + UNKNOWN = 0; + PENDING_SETUP = 1; + PENDING_RECEIVER_SETUP = 2; + INIT = 3; + SUCCESS = 4; + COMPLETED = 5; + FAILED = 6; + FAILED_RISK = 7; + FAILED_PROCESSING = 8; + FAILED_RECEIVER_PROCESSING = 9; + FAILED_DA = 10; + FAILED_DA_FINAL = 11; + REFUNDED_TXN = 12; + REFUND_FAILED = 13; + REFUND_FAILED_PROCESSING = 14; + REFUND_FAILED_DA = 15; + EXPIRED_TXN = 16; + AUTH_CANCELED = 17; + AUTH_CANCEL_FAILED_PROCESSING = 18; + AUTH_CANCEL_FAILED = 19; + COLLECT_INIT = 20; + COLLECT_SUCCESS = 21; + COLLECT_FAILED = 22; + COLLECT_FAILED_RISK = 23; + COLLECT_REJECTED = 24; + COLLECT_EXPIRED = 25; + COLLECT_CANCELED = 26; + COLLECT_CANCELLING = 27; + IN_REVIEW = 28; + REVERSAL_SUCCESS = 29; + REVERSAL_PENDING = 30; + REFUND_PENDING = 31; + } +} + +message PhotoChange { + optional bytes oldPhoto = 1; + optional bytes newPhoto = 2; + optional uint32 newPhotoId = 3; +} + +message Point { + optional int32 xDeprecated = 1; + optional int32 yDeprecated = 2; + optional double x = 3; + optional double y = 4; +} + +message PollAdditionalMetadata { + optional bool pollInvalidated = 1; +} + +message PollEncValue { + optional bytes encPayload = 1; + optional bytes encIv = 2; +} + +message PollUpdate { + optional MessageKey pollUpdateMessageKey = 1; + optional Message.PollVoteMessage vote = 2; + optional int64 senderTimestampMs = 3; + optional int64 serverTimestampMs = 4; + optional bool unread = 5; +} + +message PreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; +} + +message Pushname { + optional string id = 1; + optional string pushname = 2; +} + +message Reaction { + optional MessageKey key = 1; + optional string text = 2; + optional string groupingKey = 3; + optional int64 senderTimestampMs = 4; + optional bool unread = 5; +} + +message RecentEmojiWeight { + optional string emoji = 1; + optional float weight = 2; +} + +message RecordStructure { + optional SessionStructure currentSession = 1; + repeated SessionStructure previousSessions = 2; +} + +message SenderKeyRecordStructure { + repeated SenderKeyStateStructure senderKeyStates = 1; +} + +message SenderKeyStateStructure { + optional uint32 senderKeyId = 1; + optional SenderChainKey senderChainKey = 2; + optional SenderSigningKey senderSigningKey = 3; + repeated SenderMessageKey senderMessageKeys = 4; + message SenderChainKey { + optional uint32 iteration = 1; + optional bytes seed = 2; + } + + message SenderMessageKey { + optional uint32 iteration = 1; + optional bytes seed = 2; + } + + message SenderSigningKey { + optional bytes public = 1; + optional bytes private = 2; + } + +} + +message ServerErrorReceipt { + optional string stanzaId = 1; +} + +message SessionStructure { + optional uint32 sessionVersion = 1; + optional bytes localIdentityPublic = 2; + optional bytes remoteIdentityPublic = 3; + optional bytes rootKey = 4; + optional uint32 previousCounter = 5; + optional Chain senderChain = 6; + repeated Chain receiverChains = 7; + optional PendingKeyExchange pendingKeyExchange = 8; + optional PendingPreKey pendingPreKey = 9; + optional uint32 remoteRegistrationId = 10; + optional uint32 localRegistrationId = 11; + optional bool needsRefresh = 12; + optional bytes aliceBaseKey = 13; + message Chain { + optional bytes senderRatchetKey = 1; + optional bytes senderRatchetKeyPrivate = 2; + optional ChainKey chainKey = 3; + repeated MessageKey messageKeys = 4; + message ChainKey { + optional uint32 index = 1; + optional bytes key = 2; + } + + message MessageKey { + optional uint32 index = 1; + optional bytes cipherKey = 2; + optional bytes macKey = 3; + optional bytes iv = 4; + } + + } + + message PendingKeyExchange { + optional uint32 sequence = 1; + optional bytes localBaseKey = 2; + optional bytes localBaseKeyPrivate = 3; + optional bytes localRatchetKey = 4; + optional bytes localRatchetKeyPrivate = 5; + optional bytes localIdentityKey = 7; + optional bytes localIdentityKeyPrivate = 8; + } + + message PendingPreKey { + optional uint32 preKeyId = 1; + optional int32 signedPreKeyId = 3; + optional bytes baseKey = 2; + } + +} + +message SignedPreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; + optional bytes signature = 4; + optional fixed64 timestamp = 5; +} + +message StatusPSA { + required uint64 campaignId = 44; + optional uint64 campaignExpirationTimestamp = 45; +} + +message StickerMetadata { + optional string url = 1; + optional bytes fileSha256 = 2; + optional bytes fileEncSha256 = 3; + optional bytes mediaKey = 4; + optional string mimetype = 5; + optional uint32 height = 6; + optional uint32 width = 7; + optional string directPath = 8; + optional uint64 fileLength = 9; + optional float weight = 10; + optional int64 lastStickerSentTs = 11; +} + +message SyncActionData { + optional bytes index = 1; + optional SyncActionValue value = 2; + optional bytes padding = 3; + optional int32 version = 4; +} + +message SyncActionValue { + optional int64 timestamp = 1; + optional StarAction starAction = 2; + optional ContactAction contactAction = 3; + optional MuteAction muteAction = 4; + optional PinAction pinAction = 5; + optional SecurityNotificationSetting securityNotificationSetting = 6; + optional PushNameSetting pushNameSetting = 7; + optional QuickReplyAction quickReplyAction = 8; + optional RecentEmojiWeightsAction recentEmojiWeightsAction = 11; + optional LabelEditAction labelEditAction = 14; + optional LabelAssociationAction labelAssociationAction = 15; + optional LocaleSetting localeSetting = 16; + optional ArchiveChatAction archiveChatAction = 17; + optional DeleteMessageForMeAction deleteMessageForMeAction = 18; + optional KeyExpiration keyExpiration = 19; + optional MarkChatAsReadAction markChatAsReadAction = 20; + optional ClearChatAction clearChatAction = 21; + optional DeleteChatAction deleteChatAction = 22; + optional UnarchiveChatsSetting unarchiveChatsSetting = 23; + optional PrimaryFeature primaryFeature = 24; + optional AndroidUnsupportedActions androidUnsupportedActions = 26; + optional AgentAction agentAction = 27; + optional SubscriptionAction subscriptionAction = 28; + optional UserStatusMuteAction userStatusMuteAction = 29; + optional TimeFormatAction timeFormatAction = 30; + optional NuxAction nuxAction = 31; + optional PrimaryVersionAction primaryVersionAction = 32; + optional StickerAction stickerAction = 33; + optional RemoveRecentStickerAction removeRecentStickerAction = 34; + optional ChatAssignmentAction chatAssignment = 35; + optional ChatAssignmentOpenedStatusAction chatAssignmentOpenedStatus = 36; + optional PnForLidChatAction pnForLidChatAction = 37; + message AgentAction { + optional string name = 1; + optional int32 deviceID = 2; + optional bool isDeleted = 3; + } + + message AndroidUnsupportedActions { + optional bool allowed = 1; + } + + message ArchiveChatAction { + optional bool archived = 1; + optional SyncActionValue.SyncActionMessageRange messageRange = 2; + } + + message ChatAssignmentAction { + optional string deviceAgentID = 1; + } + + message ChatAssignmentOpenedStatusAction { + optional bool chatOpened = 1; + } + + message ClearChatAction { + optional SyncActionValue.SyncActionMessageRange messageRange = 1; + } + + message ContactAction { + optional string fullName = 1; + optional string firstName = 2; + optional string lidJid = 3; + } + + message DeleteChatAction { + optional SyncActionValue.SyncActionMessageRange messageRange = 1; + } + + message DeleteMessageForMeAction { + optional bool deleteMedia = 1; + optional int64 messageTimestamp = 2; + } + + message KeyExpiration { + optional int32 expiredKeyEpoch = 1; + } + + message LabelAssociationAction { + optional bool labeled = 1; + } + + message LabelEditAction { + optional string name = 1; + optional int32 color = 2; + optional int32 predefinedId = 3; + optional bool deleted = 4; + } + + message LocaleSetting { + optional string locale = 1; + } + + message MarkChatAsReadAction { + optional bool read = 1; + optional SyncActionValue.SyncActionMessageRange messageRange = 2; + } + + message MuteAction { + optional bool muted = 1; + optional int64 muteEndTimestamp = 2; + optional bool autoMuted = 3; + } + + message NuxAction { + optional bool acknowledged = 1; + } + + message PinAction { + optional bool pinned = 1; + } + + message PnForLidChatAction { + optional string pnJid = 1; + } + + message PrimaryFeature { + repeated string flags = 1; + } + + message PrimaryVersionAction { + optional string version = 1; + } + + message PushNameSetting { + optional string name = 1; + } + + message QuickReplyAction { + optional string shortcut = 1; + optional string message = 2; + repeated string keywords = 3; + optional int32 count = 4; + optional bool deleted = 5; + } + + message RecentEmojiWeightsAction { + repeated RecentEmojiWeight weights = 1; + } + + message RemoveRecentStickerAction { + optional int64 lastStickerSentTs = 1; + } + + message SecurityNotificationSetting { + optional bool showNotification = 1; + } + + message StarAction { + optional bool starred = 1; + } + + message StickerAction { + optional string url = 1; + optional bytes fileEncSha256 = 2; + optional bytes mediaKey = 3; + optional string mimetype = 4; + optional uint32 height = 5; + optional uint32 width = 6; + optional string directPath = 7; + optional uint64 fileLength = 8; + optional bool isFavorite = 9; + optional uint32 deviceIdHint = 10; + } + + message SubscriptionAction { + optional bool isDeactivated = 1; + optional bool isAutoRenewing = 2; + optional int64 expirationDate = 3; + } + + message SyncActionMessage { + optional MessageKey key = 1; + optional int64 timestamp = 2; + } + + message SyncActionMessageRange { + optional int64 lastMessageTimestamp = 1; + optional int64 lastSystemMessageTimestamp = 2; + repeated SyncActionValue.SyncActionMessage messages = 3; + } + + message TimeFormatAction { + optional bool isTwentyFourHourFormatEnabled = 1; + } + + message UnarchiveChatsSetting { + optional bool unarchiveChats = 1; + } + + message UserStatusMuteAction { + optional bool muted = 1; + } + +} + +message SyncdIndex { + optional bytes blob = 1; +} + +message SyncdMutation { + optional SyncdOperation operation = 1; + optional SyncdRecord record = 2; + enum SyncdOperation { + SET = 0; + REMOVE = 1; + } +} + +message SyncdMutations { + repeated SyncdMutation mutations = 1; +} + +message SyncdPatch { + optional SyncdVersion version = 1; + repeated SyncdMutation mutations = 2; + optional ExternalBlobReference externalMutations = 3; + optional bytes snapshotMac = 4; + optional bytes patchMac = 5; + optional KeyId keyId = 6; + optional ExitCode exitCode = 7; + optional uint32 deviceIndex = 8; +} + +message SyncdRecord { + optional SyncdIndex index = 1; + optional SyncdValue value = 2; + optional KeyId keyId = 3; +} + +message SyncdSnapshot { + optional SyncdVersion version = 1; + repeated SyncdRecord records = 2; + optional bytes mac = 3; + optional KeyId keyId = 4; +} + +message SyncdValue { + optional bytes blob = 1; +} + +message SyncdVersion { + optional uint64 version = 1; +} + +message TemplateButton { + optional uint32 index = 4; + oneof button { + TemplateButton.QuickReplyButton quickReplyButton = 1; + TemplateButton.URLButton urlButton = 2; + TemplateButton.CallButton callButton = 3; + } + message CallButton { + optional Message.HighlyStructuredMessage displayText = 1; + optional Message.HighlyStructuredMessage phoneNumber = 2; + } + + message QuickReplyButton { + optional Message.HighlyStructuredMessage displayText = 1; + optional string id = 2; + } + + message URLButton { + optional Message.HighlyStructuredMessage displayText = 1; + optional Message.HighlyStructuredMessage url = 2; + } + +} + +message UserReceipt { + required string userJid = 1; + optional int64 receiptTimestamp = 2; + optional int64 readTimestamp = 3; + optional int64 playedTimestamp = 4; + repeated string pendingDeviceJid = 5; + repeated string deliveredDeviceJid = 6; +} + +message VerifiedNameCertificate { + optional bytes details = 1; + optional bytes signature = 2; + optional bytes serverSignature = 3; + message Details { + optional uint64 serial = 1; + optional string issuer = 2; + optional string verifiedName = 4; + repeated LocalizedName localizedNames = 8; + optional uint64 issueTime = 10; + } + +} + +message WallpaperSettings { + optional string filename = 1; + optional uint32 opacity = 2; +} + +message WebFeatures { + optional Flag labelsDisplay = 1; + optional Flag voipIndividualOutgoing = 2; + optional Flag groupsV3 = 3; + optional Flag groupsV3Create = 4; + optional Flag changeNumberV2 = 5; + optional Flag queryStatusV3Thumbnail = 6; + optional Flag liveLocations = 7; + optional Flag queryVname = 8; + optional Flag voipIndividualIncoming = 9; + optional Flag quickRepliesQuery = 10; + optional Flag payments = 11; + optional Flag stickerPackQuery = 12; + optional Flag liveLocationsFinal = 13; + optional Flag labelsEdit = 14; + optional Flag mediaUpload = 15; + optional Flag mediaUploadRichQuickReplies = 18; + optional Flag vnameV2 = 19; + optional Flag videoPlaybackUrl = 20; + optional Flag statusRanking = 21; + optional Flag voipIndividualVideo = 22; + optional Flag thirdPartyStickers = 23; + optional Flag frequentlyForwardedSetting = 24; + optional Flag groupsV4JoinPermission = 25; + optional Flag recentStickers = 26; + optional Flag catalog = 27; + optional Flag starredStickers = 28; + optional Flag voipGroupCall = 29; + optional Flag templateMessage = 30; + optional Flag templateMessageInteractivity = 31; + optional Flag ephemeralMessages = 32; + optional Flag e2ENotificationSync = 33; + optional Flag recentStickersV2 = 34; + optional Flag recentStickersV3 = 36; + optional Flag userNotice = 37; + optional Flag support = 39; + optional Flag groupUiiCleanup = 40; + optional Flag groupDogfoodingInternalOnly = 41; + optional Flag settingsSync = 42; + optional Flag archiveV2 = 43; + optional Flag ephemeralAllowGroupMembers = 44; + optional Flag ephemeral24HDuration = 45; + optional Flag mdForceUpgrade = 46; + optional Flag disappearingMode = 47; + optional Flag externalMdOptInAvailable = 48; + optional Flag noDeleteMessageTimeLimit = 49; + enum Flag { + NOT_STARTED = 0; + FORCE_UPGRADE = 1; + DEVELOPMENT = 2; + PRODUCTION = 3; + } +} + +message WebMessageInfo { + required MessageKey key = 1; + optional Message message = 2; + optional uint64 messageTimestamp = 3; + optional Status status = 4; + optional string participant = 5; + optional uint64 messageC2STimestamp = 6; + optional bool ignore = 16; + optional bool starred = 17; + optional bool broadcast = 18; + optional string pushName = 19; + optional bytes mediaCiphertextSha256 = 20; + optional bool multicast = 21; + optional bool urlText = 22; + optional bool urlNumber = 23; + optional StubType messageStubType = 24; + optional bool clearMedia = 25; + repeated string messageStubParameters = 26; + optional uint32 duration = 27; + repeated string labels = 28; + optional PaymentInfo paymentInfo = 29; + optional Message.LiveLocationMessage finalLiveLocation = 30; + optional PaymentInfo quotedPaymentInfo = 31; + optional uint64 ephemeralStartTimestamp = 32; + optional uint32 ephemeralDuration = 33; + optional bool ephemeralOffToOn = 34; + optional bool ephemeralOutOfSync = 35; + optional BizPrivacyStatus bizPrivacyStatus = 36; + optional string verifiedBizName = 37; + optional MediaData mediaData = 38; + optional PhotoChange photoChange = 39; + repeated UserReceipt userReceipt = 40; + repeated Reaction reactions = 41; + optional MediaData quotedStickerData = 42; + optional bytes futureproofData = 43; + optional StatusPSA statusPsa = 44; + repeated PollUpdate pollUpdates = 45; + optional PollAdditionalMetadata pollAdditionalMetadata = 46; + optional string agentId = 47; + optional bool statusAlreadyViewed = 48; + optional bytes messageSecret = 49; + optional KeepInChat keepInChat = 50; + optional string originalSelfAuthorUserJidString = 51; + optional uint64 revokeMessageTimestamp = 52; + enum BizPrivacyStatus { + E2EE = 0; + FB = 2; + BSP = 1; + BSP_AND_FB = 3; + } + enum Status { + ERROR = 0; + PENDING = 1; + SERVER_ACK = 2; + DELIVERY_ACK = 3; + READ = 4; + PLAYED = 5; + } + enum StubType { + UNKNOWN = 0; + REVOKE = 1; + CIPHERTEXT = 2; + FUTUREPROOF = 3; + NON_VERIFIED_TRANSITION = 4; + UNVERIFIED_TRANSITION = 5; + VERIFIED_TRANSITION = 6; + VERIFIED_LOW_UNKNOWN = 7; + VERIFIED_HIGH = 8; + VERIFIED_INITIAL_UNKNOWN = 9; + VERIFIED_INITIAL_LOW = 10; + VERIFIED_INITIAL_HIGH = 11; + VERIFIED_TRANSITION_ANY_TO_NONE = 12; + VERIFIED_TRANSITION_ANY_TO_HIGH = 13; + VERIFIED_TRANSITION_HIGH_TO_LOW = 14; + VERIFIED_TRANSITION_HIGH_TO_UNKNOWN = 15; + VERIFIED_TRANSITION_UNKNOWN_TO_LOW = 16; + VERIFIED_TRANSITION_LOW_TO_UNKNOWN = 17; + VERIFIED_TRANSITION_NONE_TO_LOW = 18; + VERIFIED_TRANSITION_NONE_TO_UNKNOWN = 19; + GROUP_CREATE = 20; + GROUP_CHANGE_SUBJECT = 21; + GROUP_CHANGE_ICON = 22; + GROUP_CHANGE_INVITE_LINK = 23; + GROUP_CHANGE_DESCRIPTION = 24; + GROUP_CHANGE_RESTRICT = 25; + GROUP_CHANGE_ANNOUNCE = 26; + GROUP_PARTICIPANT_ADD = 27; + GROUP_PARTICIPANT_REMOVE = 28; + GROUP_PARTICIPANT_PROMOTE = 29; + GROUP_PARTICIPANT_DEMOTE = 30; + GROUP_PARTICIPANT_INVITE = 31; + GROUP_PARTICIPANT_LEAVE = 32; + GROUP_PARTICIPANT_CHANGE_NUMBER = 33; + BROADCAST_CREATE = 34; + BROADCAST_ADD = 35; + BROADCAST_REMOVE = 36; + GENERIC_NOTIFICATION = 37; + E2E_IDENTITY_CHANGED = 38; + E2E_ENCRYPTED = 39; + CALL_MISSED_VOICE = 40; + CALL_MISSED_VIDEO = 41; + INDIVIDUAL_CHANGE_NUMBER = 42; + GROUP_DELETE = 43; + GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE = 44; + CALL_MISSED_GROUP_VOICE = 45; + CALL_MISSED_GROUP_VIDEO = 46; + PAYMENT_CIPHERTEXT = 47; + PAYMENT_FUTUREPROOF = 48; + PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED = 49; + PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED = 50; + PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED = 51; + PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP = 52; + PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP = 53; + PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER = 54; + PAYMENT_ACTION_SEND_PAYMENT_REMINDER = 55; + PAYMENT_ACTION_SEND_PAYMENT_INVITATION = 56; + PAYMENT_ACTION_REQUEST_DECLINED = 57; + PAYMENT_ACTION_REQUEST_EXPIRED = 58; + PAYMENT_ACTION_REQUEST_CANCELLED = 59; + BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM = 60; + BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP = 61; + BIZ_INTRO_TOP = 62; + BIZ_INTRO_BOTTOM = 63; + BIZ_NAME_CHANGE = 64; + BIZ_MOVE_TO_CONSUMER_APP = 65; + BIZ_TWO_TIER_MIGRATION_TOP = 66; + BIZ_TWO_TIER_MIGRATION_BOTTOM = 67; + OVERSIZED = 68; + GROUP_CHANGE_NO_FREQUENTLY_FORWARDED = 69; + GROUP_V4_ADD_INVITE_SENT = 70; + GROUP_PARTICIPANT_ADD_REQUEST_JOIN = 71; + CHANGE_EPHEMERAL_SETTING = 72; + E2E_DEVICE_CHANGED = 73; + VIEWED_ONCE = 74; + E2E_ENCRYPTED_NOW = 75; + BLUE_MSG_BSP_FB_TO_BSP_PREMISE = 76; + BLUE_MSG_BSP_FB_TO_SELF_FB = 77; + BLUE_MSG_BSP_FB_TO_SELF_PREMISE = 78; + BLUE_MSG_BSP_FB_UNVERIFIED = 79; + BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 80; + BLUE_MSG_BSP_FB_VERIFIED = 81; + BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 82; + BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE = 83; + BLUE_MSG_BSP_PREMISE_UNVERIFIED = 84; + BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 85; + BLUE_MSG_BSP_PREMISE_VERIFIED = 86; + BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 87; + BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED = 88; + BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED = 89; + BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED = 90; + BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED = 91; + BLUE_MSG_SELF_FB_TO_BSP_PREMISE = 92; + BLUE_MSG_SELF_FB_TO_SELF_PREMISE = 93; + BLUE_MSG_SELF_FB_UNVERIFIED = 94; + BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 95; + BLUE_MSG_SELF_FB_VERIFIED = 96; + BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 97; + BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE = 98; + BLUE_MSG_SELF_PREMISE_UNVERIFIED = 99; + BLUE_MSG_SELF_PREMISE_VERIFIED = 100; + BLUE_MSG_TO_BSP_FB = 101; + BLUE_MSG_TO_CONSUMER = 102; + BLUE_MSG_TO_SELF_FB = 103; + BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED = 104; + BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 105; + BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED = 106; + BLUE_MSG_UNVERIFIED_TO_VERIFIED = 107; + BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED = 108; + BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 109; + BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED = 110; + BLUE_MSG_VERIFIED_TO_UNVERIFIED = 111; + BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 112; + BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED = 113; + BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 114; + BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED = 115; + BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 116; + BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 117; + E2E_IDENTITY_UNAVAILABLE = 118; + GROUP_CREATING = 119; + GROUP_CREATE_FAILED = 120; + GROUP_BOUNCED = 121; + BLOCK_CONTACT = 122; + EPHEMERAL_SETTING_NOT_APPLIED = 123; + SYNC_FAILED = 124; + SYNCING = 125; + BIZ_PRIVACY_MODE_INIT_FB = 126; + BIZ_PRIVACY_MODE_INIT_BSP = 127; + BIZ_PRIVACY_MODE_TO_FB = 128; + BIZ_PRIVACY_MODE_TO_BSP = 129; + DISAPPEARING_MODE = 130; + E2E_DEVICE_FETCH_FAILED = 131; + ADMIN_REVOKE = 132; + GROUP_INVITE_LINK_GROWTH_LOCKED = 133; + COMMUNITY_LINK_PARENT_GROUP = 134; + COMMUNITY_LINK_SIBLING_GROUP = 135; + COMMUNITY_LINK_SUB_GROUP = 136; + COMMUNITY_UNLINK_PARENT_GROUP = 137; + COMMUNITY_UNLINK_SIBLING_GROUP = 138; + COMMUNITY_UNLINK_SUB_GROUP = 139; + GROUP_PARTICIPANT_ACCEPT = 140; + GROUP_PARTICIPANT_LINKED_GROUP_JOIN = 141; + COMMUNITY_CREATE = 142; + EPHEMERAL_KEEP_IN_CHAT = 143; + GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST = 144; + GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE = 145; + INTEGRITY_UNLINK_PARENT_GROUP = 146; + COMMUNITY_PARTICIPANT_PROMOTE = 147; + COMMUNITY_PARTICIPANT_DEMOTE = 148; + COMMUNITY_PARENT_GROUP_DELETED = 149; + COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL = 150; + GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP = 151; + MASKED_THREAD_CREATED = 152; + MASKED_THREAD_UNMASKED = 153; + BIZ_CHAT_ASSIGNMENT = 154; + CHAT_PSA = 155; + CHAT_POLL_CREATION_MESSAGE = 156; + CAG_MASKED_THREAD_CREATED = 157; + COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED = 158; + CAG_INVITE_AUTO_ADD = 159; + BIZ_CHAT_ASSIGNMENT_UNASSIGN = 160; + CAG_INVITE_AUTO_JOINED = 161; + } +} + +message WebNotificationsInfo { + optional uint64 timestamp = 2; + optional uint32 unreadChats = 3; + optional uint32 notifyMessageCount = 4; + repeated WebMessageInfo notifyMessages = 5; +} diff --git a/WAProto/index.d.ts b/WAProto/index.d.ts new file mode 100644 index 00000000000..5cc6b4ac951 --- /dev/null +++ b/WAProto/index.d.ts @@ -0,0 +1,28559 @@ +import * as $protobuf from "protobufjs"; +/** Namespace proto. */ +export namespace proto { + + /** Properties of a ADVDeviceIdentity. */ + interface IADVDeviceIdentity { + + /** ADVDeviceIdentity rawId */ + rawId?: (number|null); + + /** ADVDeviceIdentity timestamp */ + timestamp?: (number|Long|null); + + /** ADVDeviceIdentity keyIndex */ + keyIndex?: (number|null); + } + + /** Represents a ADVDeviceIdentity. */ + class ADVDeviceIdentity implements IADVDeviceIdentity { + + /** + * Constructs a new ADVDeviceIdentity. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IADVDeviceIdentity); + + /** ADVDeviceIdentity rawId. */ + public rawId: number; + + /** ADVDeviceIdentity timestamp. */ + public timestamp: (number|Long); + + /** ADVDeviceIdentity keyIndex. */ + public keyIndex: number; + + /** + * Creates a new ADVDeviceIdentity instance using the specified properties. + * @param [properties] Properties to set + * @returns ADVDeviceIdentity instance + */ + public static create(properties?: proto.IADVDeviceIdentity): proto.ADVDeviceIdentity; + + /** + * Encodes the specified ADVDeviceIdentity message. Does not implicitly {@link proto.ADVDeviceIdentity.verify|verify} messages. + * @param message ADVDeviceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IADVDeviceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ADVDeviceIdentity message, length delimited. Does not implicitly {@link proto.ADVDeviceIdentity.verify|verify} messages. + * @param message ADVDeviceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IADVDeviceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ADVDeviceIdentity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ADVDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ADVDeviceIdentity; + + /** + * Decodes a ADVDeviceIdentity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ADVDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ADVDeviceIdentity; + + /** + * Verifies a ADVDeviceIdentity message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ADVDeviceIdentity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ADVDeviceIdentity + */ + public static fromObject(object: { [k: string]: any }): proto.ADVDeviceIdentity; + + /** + * Creates a plain object from a ADVDeviceIdentity message. Also converts values to other types if specified. + * @param message ADVDeviceIdentity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ADVDeviceIdentity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ADVDeviceIdentity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ADVKeyIndexList. */ + interface IADVKeyIndexList { + + /** ADVKeyIndexList rawId */ + rawId?: (number|null); + + /** ADVKeyIndexList timestamp */ + timestamp?: (number|Long|null); + + /** ADVKeyIndexList currentIndex */ + currentIndex?: (number|null); + + /** ADVKeyIndexList validIndexes */ + validIndexes?: (number[]|null); + } + + /** Represents a ADVKeyIndexList. */ + class ADVKeyIndexList implements IADVKeyIndexList { + + /** + * Constructs a new ADVKeyIndexList. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IADVKeyIndexList); + + /** ADVKeyIndexList rawId. */ + public rawId: number; + + /** ADVKeyIndexList timestamp. */ + public timestamp: (number|Long); + + /** ADVKeyIndexList currentIndex. */ + public currentIndex: number; + + /** ADVKeyIndexList validIndexes. */ + public validIndexes: number[]; + + /** + * Creates a new ADVKeyIndexList instance using the specified properties. + * @param [properties] Properties to set + * @returns ADVKeyIndexList instance + */ + public static create(properties?: proto.IADVKeyIndexList): proto.ADVKeyIndexList; + + /** + * Encodes the specified ADVKeyIndexList message. Does not implicitly {@link proto.ADVKeyIndexList.verify|verify} messages. + * @param message ADVKeyIndexList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IADVKeyIndexList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ADVKeyIndexList message, length delimited. Does not implicitly {@link proto.ADVKeyIndexList.verify|verify} messages. + * @param message ADVKeyIndexList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IADVKeyIndexList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ADVKeyIndexList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ADVKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ADVKeyIndexList; + + /** + * Decodes a ADVKeyIndexList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ADVKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ADVKeyIndexList; + + /** + * Verifies a ADVKeyIndexList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ADVKeyIndexList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ADVKeyIndexList + */ + public static fromObject(object: { [k: string]: any }): proto.ADVKeyIndexList; + + /** + * Creates a plain object from a ADVKeyIndexList message. Also converts values to other types if specified. + * @param message ADVKeyIndexList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ADVKeyIndexList, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ADVKeyIndexList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ADVSignedDeviceIdentity. */ + interface IADVSignedDeviceIdentity { + + /** ADVSignedDeviceIdentity details */ + details?: (Uint8Array|null); + + /** ADVSignedDeviceIdentity accountSignatureKey */ + accountSignatureKey?: (Uint8Array|null); + + /** ADVSignedDeviceIdentity accountSignature */ + accountSignature?: (Uint8Array|null); + + /** ADVSignedDeviceIdentity deviceSignature */ + deviceSignature?: (Uint8Array|null); + } + + /** Represents a ADVSignedDeviceIdentity. */ + class ADVSignedDeviceIdentity implements IADVSignedDeviceIdentity { + + /** + * Constructs a new ADVSignedDeviceIdentity. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IADVSignedDeviceIdentity); + + /** ADVSignedDeviceIdentity details. */ + public details: Uint8Array; + + /** ADVSignedDeviceIdentity accountSignatureKey. */ + public accountSignatureKey: Uint8Array; + + /** ADVSignedDeviceIdentity accountSignature. */ + public accountSignature: Uint8Array; + + /** ADVSignedDeviceIdentity deviceSignature. */ + public deviceSignature: Uint8Array; + + /** + * Creates a new ADVSignedDeviceIdentity instance using the specified properties. + * @param [properties] Properties to set + * @returns ADVSignedDeviceIdentity instance + */ + public static create(properties?: proto.IADVSignedDeviceIdentity): proto.ADVSignedDeviceIdentity; + + /** + * Encodes the specified ADVSignedDeviceIdentity message. Does not implicitly {@link proto.ADVSignedDeviceIdentity.verify|verify} messages. + * @param message ADVSignedDeviceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IADVSignedDeviceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ADVSignedDeviceIdentity message, length delimited. Does not implicitly {@link proto.ADVSignedDeviceIdentity.verify|verify} messages. + * @param message ADVSignedDeviceIdentity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IADVSignedDeviceIdentity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ADVSignedDeviceIdentity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ADVSignedDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ADVSignedDeviceIdentity; + + /** + * Decodes a ADVSignedDeviceIdentity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ADVSignedDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ADVSignedDeviceIdentity; + + /** + * Verifies a ADVSignedDeviceIdentity message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ADVSignedDeviceIdentity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ADVSignedDeviceIdentity + */ + public static fromObject(object: { [k: string]: any }): proto.ADVSignedDeviceIdentity; + + /** + * Creates a plain object from a ADVSignedDeviceIdentity message. Also converts values to other types if specified. + * @param message ADVSignedDeviceIdentity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ADVSignedDeviceIdentity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ADVSignedDeviceIdentity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ADVSignedDeviceIdentityHMAC. */ + interface IADVSignedDeviceIdentityHMAC { + + /** ADVSignedDeviceIdentityHMAC details */ + details?: (Uint8Array|null); + + /** ADVSignedDeviceIdentityHMAC hmac */ + hmac?: (Uint8Array|null); + } + + /** Represents a ADVSignedDeviceIdentityHMAC. */ + class ADVSignedDeviceIdentityHMAC implements IADVSignedDeviceIdentityHMAC { + + /** + * Constructs a new ADVSignedDeviceIdentityHMAC. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IADVSignedDeviceIdentityHMAC); + + /** ADVSignedDeviceIdentityHMAC details. */ + public details: Uint8Array; + + /** ADVSignedDeviceIdentityHMAC hmac. */ + public hmac: Uint8Array; + + /** + * Creates a new ADVSignedDeviceIdentityHMAC instance using the specified properties. + * @param [properties] Properties to set + * @returns ADVSignedDeviceIdentityHMAC instance + */ + public static create(properties?: proto.IADVSignedDeviceIdentityHMAC): proto.ADVSignedDeviceIdentityHMAC; + + /** + * Encodes the specified ADVSignedDeviceIdentityHMAC message. Does not implicitly {@link proto.ADVSignedDeviceIdentityHMAC.verify|verify} messages. + * @param message ADVSignedDeviceIdentityHMAC message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IADVSignedDeviceIdentityHMAC, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ADVSignedDeviceIdentityHMAC message, length delimited. Does not implicitly {@link proto.ADVSignedDeviceIdentityHMAC.verify|verify} messages. + * @param message ADVSignedDeviceIdentityHMAC message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IADVSignedDeviceIdentityHMAC, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ADVSignedDeviceIdentityHMAC message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ADVSignedDeviceIdentityHMAC + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ADVSignedDeviceIdentityHMAC; + + /** + * Decodes a ADVSignedDeviceIdentityHMAC message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ADVSignedDeviceIdentityHMAC + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ADVSignedDeviceIdentityHMAC; + + /** + * Verifies a ADVSignedDeviceIdentityHMAC message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ADVSignedDeviceIdentityHMAC message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ADVSignedDeviceIdentityHMAC + */ + public static fromObject(object: { [k: string]: any }): proto.ADVSignedDeviceIdentityHMAC; + + /** + * Creates a plain object from a ADVSignedDeviceIdentityHMAC message. Also converts values to other types if specified. + * @param message ADVSignedDeviceIdentityHMAC + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ADVSignedDeviceIdentityHMAC, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ADVSignedDeviceIdentityHMAC to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ADVSignedKeyIndexList. */ + interface IADVSignedKeyIndexList { + + /** ADVSignedKeyIndexList details */ + details?: (Uint8Array|null); + + /** ADVSignedKeyIndexList accountSignature */ + accountSignature?: (Uint8Array|null); + } + + /** Represents a ADVSignedKeyIndexList. */ + class ADVSignedKeyIndexList implements IADVSignedKeyIndexList { + + /** + * Constructs a new ADVSignedKeyIndexList. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IADVSignedKeyIndexList); + + /** ADVSignedKeyIndexList details. */ + public details: Uint8Array; + + /** ADVSignedKeyIndexList accountSignature. */ + public accountSignature: Uint8Array; + + /** + * Creates a new ADVSignedKeyIndexList instance using the specified properties. + * @param [properties] Properties to set + * @returns ADVSignedKeyIndexList instance + */ + public static create(properties?: proto.IADVSignedKeyIndexList): proto.ADVSignedKeyIndexList; + + /** + * Encodes the specified ADVSignedKeyIndexList message. Does not implicitly {@link proto.ADVSignedKeyIndexList.verify|verify} messages. + * @param message ADVSignedKeyIndexList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IADVSignedKeyIndexList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ADVSignedKeyIndexList message, length delimited. Does not implicitly {@link proto.ADVSignedKeyIndexList.verify|verify} messages. + * @param message ADVSignedKeyIndexList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IADVSignedKeyIndexList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ADVSignedKeyIndexList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ADVSignedKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ADVSignedKeyIndexList; + + /** + * Decodes a ADVSignedKeyIndexList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ADVSignedKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ADVSignedKeyIndexList; + + /** + * Verifies a ADVSignedKeyIndexList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ADVSignedKeyIndexList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ADVSignedKeyIndexList + */ + public static fromObject(object: { [k: string]: any }): proto.ADVSignedKeyIndexList; + + /** + * Creates a plain object from a ADVSignedKeyIndexList message. Also converts values to other types if specified. + * @param message ADVSignedKeyIndexList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ADVSignedKeyIndexList, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ADVSignedKeyIndexList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ActionLink. */ + interface IActionLink { + + /** ActionLink url */ + url?: (string|null); + + /** ActionLink buttonTitle */ + buttonTitle?: (string|null); + } + + /** Represents an ActionLink. */ + class ActionLink implements IActionLink { + + /** + * Constructs a new ActionLink. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IActionLink); + + /** ActionLink url. */ + public url: string; + + /** ActionLink buttonTitle. */ + public buttonTitle: string; + + /** + * Creates a new ActionLink instance using the specified properties. + * @param [properties] Properties to set + * @returns ActionLink instance + */ + public static create(properties?: proto.IActionLink): proto.ActionLink; + + /** + * Encodes the specified ActionLink message. Does not implicitly {@link proto.ActionLink.verify|verify} messages. + * @param message ActionLink message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IActionLink, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ActionLink message, length delimited. Does not implicitly {@link proto.ActionLink.verify|verify} messages. + * @param message ActionLink message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IActionLink, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ActionLink message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ActionLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ActionLink; + + /** + * Decodes an ActionLink message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ActionLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ActionLink; + + /** + * Verifies an ActionLink message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ActionLink message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ActionLink + */ + public static fromObject(object: { [k: string]: any }): proto.ActionLink; + + /** + * Creates a plain object from an ActionLink message. Also converts values to other types if specified. + * @param message ActionLink + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ActionLink, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ActionLink to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AutoDownloadSettings. */ + interface IAutoDownloadSettings { + + /** AutoDownloadSettings downloadImages */ + downloadImages?: (boolean|null); + + /** AutoDownloadSettings downloadAudio */ + downloadAudio?: (boolean|null); + + /** AutoDownloadSettings downloadVideo */ + downloadVideo?: (boolean|null); + + /** AutoDownloadSettings downloadDocuments */ + downloadDocuments?: (boolean|null); + } + + /** Represents an AutoDownloadSettings. */ + class AutoDownloadSettings implements IAutoDownloadSettings { + + /** + * Constructs a new AutoDownloadSettings. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IAutoDownloadSettings); + + /** AutoDownloadSettings downloadImages. */ + public downloadImages: boolean; + + /** AutoDownloadSettings downloadAudio. */ + public downloadAudio: boolean; + + /** AutoDownloadSettings downloadVideo. */ + public downloadVideo: boolean; + + /** AutoDownloadSettings downloadDocuments. */ + public downloadDocuments: boolean; + + /** + * Creates a new AutoDownloadSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns AutoDownloadSettings instance + */ + public static create(properties?: proto.IAutoDownloadSettings): proto.AutoDownloadSettings; + + /** + * Encodes the specified AutoDownloadSettings message. Does not implicitly {@link proto.AutoDownloadSettings.verify|verify} messages. + * @param message AutoDownloadSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IAutoDownloadSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutoDownloadSettings message, length delimited. Does not implicitly {@link proto.AutoDownloadSettings.verify|verify} messages. + * @param message AutoDownloadSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IAutoDownloadSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutoDownloadSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutoDownloadSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.AutoDownloadSettings; + + /** + * Decodes an AutoDownloadSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutoDownloadSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.AutoDownloadSettings; + + /** + * Verifies an AutoDownloadSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AutoDownloadSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutoDownloadSettings + */ + public static fromObject(object: { [k: string]: any }): proto.AutoDownloadSettings; + + /** + * Creates a plain object from an AutoDownloadSettings message. Also converts values to other types if specified. + * @param message AutoDownloadSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.AutoDownloadSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutoDownloadSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AvatarUserSettings. */ + interface IAvatarUserSettings { + + /** AvatarUserSettings fbid */ + fbid?: (string|null); + + /** AvatarUserSettings password */ + password?: (string|null); + } + + /** Represents an AvatarUserSettings. */ + class AvatarUserSettings implements IAvatarUserSettings { + + /** + * Constructs a new AvatarUserSettings. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IAvatarUserSettings); + + /** AvatarUserSettings fbid. */ + public fbid: string; + + /** AvatarUserSettings password. */ + public password: string; + + /** + * Creates a new AvatarUserSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns AvatarUserSettings instance + */ + public static create(properties?: proto.IAvatarUserSettings): proto.AvatarUserSettings; + + /** + * Encodes the specified AvatarUserSettings message. Does not implicitly {@link proto.AvatarUserSettings.verify|verify} messages. + * @param message AvatarUserSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IAvatarUserSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AvatarUserSettings message, length delimited. Does not implicitly {@link proto.AvatarUserSettings.verify|verify} messages. + * @param message AvatarUserSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IAvatarUserSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AvatarUserSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AvatarUserSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.AvatarUserSettings; + + /** + * Decodes an AvatarUserSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AvatarUserSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.AvatarUserSettings; + + /** + * Verifies an AvatarUserSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AvatarUserSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AvatarUserSettings + */ + public static fromObject(object: { [k: string]: any }): proto.AvatarUserSettings; + + /** + * Creates a plain object from an AvatarUserSettings message. Also converts values to other types if specified. + * @param message AvatarUserSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.AvatarUserSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AvatarUserSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BizAccountLinkInfo. */ + interface IBizAccountLinkInfo { + + /** BizAccountLinkInfo whatsappBizAcctFbid */ + whatsappBizAcctFbid?: (number|Long|null); + + /** BizAccountLinkInfo whatsappAcctNumber */ + whatsappAcctNumber?: (string|null); + + /** BizAccountLinkInfo issueTime */ + issueTime?: (number|Long|null); + + /** BizAccountLinkInfo hostStorage */ + hostStorage?: (proto.BizAccountLinkInfo.HostStorageType|null); + + /** BizAccountLinkInfo accountType */ + accountType?: (proto.BizAccountLinkInfo.AccountType|null); + } + + /** Represents a BizAccountLinkInfo. */ + class BizAccountLinkInfo implements IBizAccountLinkInfo { + + /** + * Constructs a new BizAccountLinkInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IBizAccountLinkInfo); + + /** BizAccountLinkInfo whatsappBizAcctFbid. */ + public whatsappBizAcctFbid: (number|Long); + + /** BizAccountLinkInfo whatsappAcctNumber. */ + public whatsappAcctNumber: string; + + /** BizAccountLinkInfo issueTime. */ + public issueTime: (number|Long); + + /** BizAccountLinkInfo hostStorage. */ + public hostStorage: proto.BizAccountLinkInfo.HostStorageType; + + /** BizAccountLinkInfo accountType. */ + public accountType: proto.BizAccountLinkInfo.AccountType; + + /** + * Creates a new BizAccountLinkInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns BizAccountLinkInfo instance + */ + public static create(properties?: proto.IBizAccountLinkInfo): proto.BizAccountLinkInfo; + + /** + * Encodes the specified BizAccountLinkInfo message. Does not implicitly {@link proto.BizAccountLinkInfo.verify|verify} messages. + * @param message BizAccountLinkInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IBizAccountLinkInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BizAccountLinkInfo message, length delimited. Does not implicitly {@link proto.BizAccountLinkInfo.verify|verify} messages. + * @param message BizAccountLinkInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IBizAccountLinkInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BizAccountLinkInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BizAccountLinkInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.BizAccountLinkInfo; + + /** + * Decodes a BizAccountLinkInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BizAccountLinkInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.BizAccountLinkInfo; + + /** + * Verifies a BizAccountLinkInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BizAccountLinkInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BizAccountLinkInfo + */ + public static fromObject(object: { [k: string]: any }): proto.BizAccountLinkInfo; + + /** + * Creates a plain object from a BizAccountLinkInfo message. Also converts values to other types if specified. + * @param message BizAccountLinkInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.BizAccountLinkInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BizAccountLinkInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BizAccountLinkInfo { + + /** AccountType enum. */ + enum AccountType { + ENTERPRISE = 0 + } + + /** HostStorageType enum. */ + enum HostStorageType { + ON_PREMISE = 0, + FACEBOOK = 1 + } + } + + /** Properties of a BizAccountPayload. */ + interface IBizAccountPayload { + + /** BizAccountPayload vnameCert */ + vnameCert?: (proto.IVerifiedNameCertificate|null); + + /** BizAccountPayload bizAcctLinkInfo */ + bizAcctLinkInfo?: (Uint8Array|null); + } + + /** Represents a BizAccountPayload. */ + class BizAccountPayload implements IBizAccountPayload { + + /** + * Constructs a new BizAccountPayload. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IBizAccountPayload); + + /** BizAccountPayload vnameCert. */ + public vnameCert?: (proto.IVerifiedNameCertificate|null); + + /** BizAccountPayload bizAcctLinkInfo. */ + public bizAcctLinkInfo: Uint8Array; + + /** + * Creates a new BizAccountPayload instance using the specified properties. + * @param [properties] Properties to set + * @returns BizAccountPayload instance + */ + public static create(properties?: proto.IBizAccountPayload): proto.BizAccountPayload; + + /** + * Encodes the specified BizAccountPayload message. Does not implicitly {@link proto.BizAccountPayload.verify|verify} messages. + * @param message BizAccountPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IBizAccountPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BizAccountPayload message, length delimited. Does not implicitly {@link proto.BizAccountPayload.verify|verify} messages. + * @param message BizAccountPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IBizAccountPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BizAccountPayload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BizAccountPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.BizAccountPayload; + + /** + * Decodes a BizAccountPayload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BizAccountPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.BizAccountPayload; + + /** + * Verifies a BizAccountPayload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BizAccountPayload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BizAccountPayload + */ + public static fromObject(object: { [k: string]: any }): proto.BizAccountPayload; + + /** + * Creates a plain object from a BizAccountPayload message. Also converts values to other types if specified. + * @param message BizAccountPayload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.BizAccountPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BizAccountPayload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BizIdentityInfo. */ + interface IBizIdentityInfo { + + /** BizIdentityInfo vlevel */ + vlevel?: (proto.BizIdentityInfo.VerifiedLevelValue|null); + + /** BizIdentityInfo vnameCert */ + vnameCert?: (proto.IVerifiedNameCertificate|null); + + /** BizIdentityInfo signed */ + signed?: (boolean|null); + + /** BizIdentityInfo revoked */ + revoked?: (boolean|null); + + /** BizIdentityInfo hostStorage */ + hostStorage?: (proto.BizIdentityInfo.HostStorageType|null); + + /** BizIdentityInfo actualActors */ + actualActors?: (proto.BizIdentityInfo.ActualActorsType|null); + + /** BizIdentityInfo privacyModeTs */ + privacyModeTs?: (number|Long|null); + + /** BizIdentityInfo featureControls */ + featureControls?: (number|Long|null); + } + + /** Represents a BizIdentityInfo. */ + class BizIdentityInfo implements IBizIdentityInfo { + + /** + * Constructs a new BizIdentityInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IBizIdentityInfo); + + /** BizIdentityInfo vlevel. */ + public vlevel: proto.BizIdentityInfo.VerifiedLevelValue; + + /** BizIdentityInfo vnameCert. */ + public vnameCert?: (proto.IVerifiedNameCertificate|null); + + /** BizIdentityInfo signed. */ + public signed: boolean; + + /** BizIdentityInfo revoked. */ + public revoked: boolean; + + /** BizIdentityInfo hostStorage. */ + public hostStorage: proto.BizIdentityInfo.HostStorageType; + + /** BizIdentityInfo actualActors. */ + public actualActors: proto.BizIdentityInfo.ActualActorsType; + + /** BizIdentityInfo privacyModeTs. */ + public privacyModeTs: (number|Long); + + /** BizIdentityInfo featureControls. */ + public featureControls: (number|Long); + + /** + * Creates a new BizIdentityInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns BizIdentityInfo instance + */ + public static create(properties?: proto.IBizIdentityInfo): proto.BizIdentityInfo; + + /** + * Encodes the specified BizIdentityInfo message. Does not implicitly {@link proto.BizIdentityInfo.verify|verify} messages. + * @param message BizIdentityInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IBizIdentityInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BizIdentityInfo message, length delimited. Does not implicitly {@link proto.BizIdentityInfo.verify|verify} messages. + * @param message BizIdentityInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IBizIdentityInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BizIdentityInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BizIdentityInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.BizIdentityInfo; + + /** + * Decodes a BizIdentityInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BizIdentityInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.BizIdentityInfo; + + /** + * Verifies a BizIdentityInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BizIdentityInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BizIdentityInfo + */ + public static fromObject(object: { [k: string]: any }): proto.BizIdentityInfo; + + /** + * Creates a plain object from a BizIdentityInfo message. Also converts values to other types if specified. + * @param message BizIdentityInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.BizIdentityInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BizIdentityInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BizIdentityInfo { + + /** ActualActorsType enum. */ + enum ActualActorsType { + SELF = 0, + BSP = 1 + } + + /** HostStorageType enum. */ + enum HostStorageType { + ON_PREMISE = 0, + FACEBOOK = 1 + } + + /** VerifiedLevelValue enum. */ + enum VerifiedLevelValue { + UNKNOWN = 0, + LOW = 1, + HIGH = 2 + } + } + + /** Properties of a CertChain. */ + interface ICertChain { + + /** CertChain leaf */ + leaf?: (proto.CertChain.INoiseCertificate|null); + + /** CertChain intermediate */ + intermediate?: (proto.CertChain.INoiseCertificate|null); + } + + /** Represents a CertChain. */ + class CertChain implements ICertChain { + + /** + * Constructs a new CertChain. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ICertChain); + + /** CertChain leaf. */ + public leaf?: (proto.CertChain.INoiseCertificate|null); + + /** CertChain intermediate. */ + public intermediate?: (proto.CertChain.INoiseCertificate|null); + + /** + * Creates a new CertChain instance using the specified properties. + * @param [properties] Properties to set + * @returns CertChain instance + */ + public static create(properties?: proto.ICertChain): proto.CertChain; + + /** + * Encodes the specified CertChain message. Does not implicitly {@link proto.CertChain.verify|verify} messages. + * @param message CertChain message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ICertChain, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CertChain message, length delimited. Does not implicitly {@link proto.CertChain.verify|verify} messages. + * @param message CertChain message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ICertChain, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CertChain message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CertChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.CertChain; + + /** + * Decodes a CertChain message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CertChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.CertChain; + + /** + * Verifies a CertChain message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CertChain message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CertChain + */ + public static fromObject(object: { [k: string]: any }): proto.CertChain; + + /** + * Creates a plain object from a CertChain message. Also converts values to other types if specified. + * @param message CertChain + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.CertChain, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CertChain to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace CertChain { + + /** Properties of a NoiseCertificate. */ + interface INoiseCertificate { + + /** NoiseCertificate details */ + details?: (Uint8Array|null); + + /** NoiseCertificate signature */ + signature?: (Uint8Array|null); + } + + /** Represents a NoiseCertificate. */ + class NoiseCertificate implements INoiseCertificate { + + /** + * Constructs a new NoiseCertificate. + * @param [properties] Properties to set + */ + constructor(properties?: proto.CertChain.INoiseCertificate); + + /** NoiseCertificate details. */ + public details: Uint8Array; + + /** NoiseCertificate signature. */ + public signature: Uint8Array; + + /** + * Creates a new NoiseCertificate instance using the specified properties. + * @param [properties] Properties to set + * @returns NoiseCertificate instance + */ + public static create(properties?: proto.CertChain.INoiseCertificate): proto.CertChain.NoiseCertificate; + + /** + * Encodes the specified NoiseCertificate message. Does not implicitly {@link proto.CertChain.NoiseCertificate.verify|verify} messages. + * @param message NoiseCertificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.CertChain.INoiseCertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NoiseCertificate message, length delimited. Does not implicitly {@link proto.CertChain.NoiseCertificate.verify|verify} messages. + * @param message NoiseCertificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.CertChain.INoiseCertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.CertChain.NoiseCertificate; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.CertChain.NoiseCertificate; + + /** + * Verifies a NoiseCertificate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NoiseCertificate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NoiseCertificate + */ + public static fromObject(object: { [k: string]: any }): proto.CertChain.NoiseCertificate; + + /** + * Creates a plain object from a NoiseCertificate message. Also converts values to other types if specified. + * @param message NoiseCertificate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.CertChain.NoiseCertificate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NoiseCertificate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace NoiseCertificate { + + /** Properties of a Details. */ + interface IDetails { + + /** Details serial */ + serial?: (number|null); + + /** Details issuerSerial */ + issuerSerial?: (number|null); + + /** Details key */ + key?: (Uint8Array|null); + + /** Details notBefore */ + notBefore?: (number|Long|null); + + /** Details notAfter */ + notAfter?: (number|Long|null); + } + + /** Represents a Details. */ + class Details implements IDetails { + + /** + * Constructs a new Details. + * @param [properties] Properties to set + */ + constructor(properties?: proto.CertChain.NoiseCertificate.IDetails); + + /** Details serial. */ + public serial: number; + + /** Details issuerSerial. */ + public issuerSerial: number; + + /** Details key. */ + public key: Uint8Array; + + /** Details notBefore. */ + public notBefore: (number|Long); + + /** Details notAfter. */ + public notAfter: (number|Long); + + /** + * Creates a new Details instance using the specified properties. + * @param [properties] Properties to set + * @returns Details instance + */ + public static create(properties?: proto.CertChain.NoiseCertificate.IDetails): proto.CertChain.NoiseCertificate.Details; + + /** + * Encodes the specified Details message. Does not implicitly {@link proto.CertChain.NoiseCertificate.Details.verify|verify} messages. + * @param message Details message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.CertChain.NoiseCertificate.IDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Details message, length delimited. Does not implicitly {@link proto.CertChain.NoiseCertificate.Details.verify|verify} messages. + * @param message Details message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.CertChain.NoiseCertificate.IDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Details message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.CertChain.NoiseCertificate.Details; + + /** + * Decodes a Details message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.CertChain.NoiseCertificate.Details; + + /** + * Verifies a Details message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Details message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Details + */ + public static fromObject(object: { [k: string]: any }): proto.CertChain.NoiseCertificate.Details; + + /** + * Creates a plain object from a Details message. Also converts values to other types if specified. + * @param message Details + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.CertChain.NoiseCertificate.Details, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Details to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + + /** Properties of a ClientPayload. */ + interface IClientPayload { + + /** ClientPayload username */ + username?: (number|Long|null); + + /** ClientPayload passive */ + passive?: (boolean|null); + + /** ClientPayload userAgent */ + userAgent?: (proto.ClientPayload.IUserAgent|null); + + /** ClientPayload webInfo */ + webInfo?: (proto.ClientPayload.IWebInfo|null); + + /** ClientPayload pushName */ + pushName?: (string|null); + + /** ClientPayload sessionId */ + sessionId?: (number|null); + + /** ClientPayload shortConnect */ + shortConnect?: (boolean|null); + + /** ClientPayload connectType */ + connectType?: (proto.ClientPayload.ConnectType|null); + + /** ClientPayload connectReason */ + connectReason?: (proto.ClientPayload.ConnectReason|null); + + /** ClientPayload shards */ + shards?: (number[]|null); + + /** ClientPayload dnsSource */ + dnsSource?: (proto.ClientPayload.IDNSSource|null); + + /** ClientPayload connectAttemptCount */ + connectAttemptCount?: (number|null); + + /** ClientPayload device */ + device?: (number|null); + + /** ClientPayload devicePairingData */ + devicePairingData?: (proto.ClientPayload.IDevicePairingRegistrationData|null); + + /** ClientPayload product */ + product?: (proto.ClientPayload.Product|null); + + /** ClientPayload fbCat */ + fbCat?: (Uint8Array|null); + + /** ClientPayload fbUserAgent */ + fbUserAgent?: (Uint8Array|null); + + /** ClientPayload oc */ + oc?: (boolean|null); + + /** ClientPayload lc */ + lc?: (number|null); + + /** ClientPayload iosAppExtension */ + iosAppExtension?: (proto.ClientPayload.IOSAppExtension|null); + + /** ClientPayload fbAppId */ + fbAppId?: (number|Long|null); + + /** ClientPayload fbDeviceId */ + fbDeviceId?: (Uint8Array|null); + + /** ClientPayload pull */ + pull?: (boolean|null); + + /** ClientPayload paddingBytes */ + paddingBytes?: (Uint8Array|null); + + /** ClientPayload yearClass */ + yearClass?: (number|null); + + /** ClientPayload memClass */ + memClass?: (number|null); + } + + /** Represents a ClientPayload. */ + class ClientPayload implements IClientPayload { + + /** + * Constructs a new ClientPayload. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IClientPayload); + + /** ClientPayload username. */ + public username: (number|Long); + + /** ClientPayload passive. */ + public passive: boolean; + + /** ClientPayload userAgent. */ + public userAgent?: (proto.ClientPayload.IUserAgent|null); + + /** ClientPayload webInfo. */ + public webInfo?: (proto.ClientPayload.IWebInfo|null); + + /** ClientPayload pushName. */ + public pushName: string; + + /** ClientPayload sessionId. */ + public sessionId: number; + + /** ClientPayload shortConnect. */ + public shortConnect: boolean; + + /** ClientPayload connectType. */ + public connectType: proto.ClientPayload.ConnectType; + + /** ClientPayload connectReason. */ + public connectReason: proto.ClientPayload.ConnectReason; + + /** ClientPayload shards. */ + public shards: number[]; + + /** ClientPayload dnsSource. */ + public dnsSource?: (proto.ClientPayload.IDNSSource|null); + + /** ClientPayload connectAttemptCount. */ + public connectAttemptCount: number; + + /** ClientPayload device. */ + public device: number; + + /** ClientPayload devicePairingData. */ + public devicePairingData?: (proto.ClientPayload.IDevicePairingRegistrationData|null); + + /** ClientPayload product. */ + public product: proto.ClientPayload.Product; + + /** ClientPayload fbCat. */ + public fbCat: Uint8Array; + + /** ClientPayload fbUserAgent. */ + public fbUserAgent: Uint8Array; + + /** ClientPayload oc. */ + public oc: boolean; + + /** ClientPayload lc. */ + public lc: number; + + /** ClientPayload iosAppExtension. */ + public iosAppExtension: proto.ClientPayload.IOSAppExtension; + + /** ClientPayload fbAppId. */ + public fbAppId: (number|Long); + + /** ClientPayload fbDeviceId. */ + public fbDeviceId: Uint8Array; + + /** ClientPayload pull. */ + public pull: boolean; + + /** ClientPayload paddingBytes. */ + public paddingBytes: Uint8Array; + + /** ClientPayload yearClass. */ + public yearClass: number; + + /** ClientPayload memClass. */ + public memClass: number; + + /** + * Creates a new ClientPayload instance using the specified properties. + * @param [properties] Properties to set + * @returns ClientPayload instance + */ + public static create(properties?: proto.IClientPayload): proto.ClientPayload; + + /** + * Encodes the specified ClientPayload message. Does not implicitly {@link proto.ClientPayload.verify|verify} messages. + * @param message ClientPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IClientPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClientPayload message, length delimited. Does not implicitly {@link proto.ClientPayload.verify|verify} messages. + * @param message ClientPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IClientPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClientPayload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClientPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload; + + /** + * Decodes a ClientPayload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClientPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload; + + /** + * Verifies a ClientPayload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClientPayload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClientPayload + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload; + + /** + * Creates a plain object from a ClientPayload message. Also converts values to other types if specified. + * @param message ClientPayload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClientPayload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ClientPayload { + + /** ConnectReason enum. */ + enum ConnectReason { + PUSH = 0, + USER_ACTIVATED = 1, + SCHEDULED = 2, + ERROR_RECONNECT = 3, + NETWORK_SWITCH = 4, + PING_RECONNECT = 5 + } + + /** ConnectType enum. */ + enum ConnectType { + CELLULAR_UNKNOWN = 0, + WIFI_UNKNOWN = 1, + CELLULAR_EDGE = 100, + CELLULAR_IDEN = 101, + CELLULAR_UMTS = 102, + CELLULAR_EVDO = 103, + CELLULAR_GPRS = 104, + CELLULAR_HSDPA = 105, + CELLULAR_HSUPA = 106, + CELLULAR_HSPA = 107, + CELLULAR_CDMA = 108, + CELLULAR_1XRTT = 109, + CELLULAR_EHRPD = 110, + CELLULAR_LTE = 111, + CELLULAR_HSPAP = 112 + } + + /** Properties of a DNSSource. */ + interface IDNSSource { + + /** DNSSource dnsMethod */ + dnsMethod?: (proto.ClientPayload.DNSSource.DNSResolutionMethod|null); + + /** DNSSource appCached */ + appCached?: (boolean|null); + } + + /** Represents a DNSSource. */ + class DNSSource implements IDNSSource { + + /** + * Constructs a new DNSSource. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ClientPayload.IDNSSource); + + /** DNSSource dnsMethod. */ + public dnsMethod: proto.ClientPayload.DNSSource.DNSResolutionMethod; + + /** DNSSource appCached. */ + public appCached: boolean; + + /** + * Creates a new DNSSource instance using the specified properties. + * @param [properties] Properties to set + * @returns DNSSource instance + */ + public static create(properties?: proto.ClientPayload.IDNSSource): proto.ClientPayload.DNSSource; + + /** + * Encodes the specified DNSSource message. Does not implicitly {@link proto.ClientPayload.DNSSource.verify|verify} messages. + * @param message DNSSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ClientPayload.IDNSSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DNSSource message, length delimited. Does not implicitly {@link proto.ClientPayload.DNSSource.verify|verify} messages. + * @param message DNSSource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ClientPayload.IDNSSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DNSSource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DNSSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload.DNSSource; + + /** + * Decodes a DNSSource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DNSSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload.DNSSource; + + /** + * Verifies a DNSSource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DNSSource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DNSSource + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload.DNSSource; + + /** + * Creates a plain object from a DNSSource message. Also converts values to other types if specified. + * @param message DNSSource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload.DNSSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DNSSource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DNSSource { + + /** DNSResolutionMethod enum. */ + enum DNSResolutionMethod { + SYSTEM = 0, + GOOGLE = 1, + HARDCODED = 2, + OVERRIDE = 3, + FALLBACK = 4 + } + } + + /** Properties of a DevicePairingRegistrationData. */ + interface IDevicePairingRegistrationData { + + /** DevicePairingRegistrationData eRegid */ + eRegid?: (Uint8Array|null); + + /** DevicePairingRegistrationData eKeytype */ + eKeytype?: (Uint8Array|null); + + /** DevicePairingRegistrationData eIdent */ + eIdent?: (Uint8Array|null); + + /** DevicePairingRegistrationData eSkeyId */ + eSkeyId?: (Uint8Array|null); + + /** DevicePairingRegistrationData eSkeyVal */ + eSkeyVal?: (Uint8Array|null); + + /** DevicePairingRegistrationData eSkeySig */ + eSkeySig?: (Uint8Array|null); + + /** DevicePairingRegistrationData buildHash */ + buildHash?: (Uint8Array|null); + + /** DevicePairingRegistrationData deviceProps */ + deviceProps?: (Uint8Array|null); + } + + /** Represents a DevicePairingRegistrationData. */ + class DevicePairingRegistrationData implements IDevicePairingRegistrationData { + + /** + * Constructs a new DevicePairingRegistrationData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ClientPayload.IDevicePairingRegistrationData); + + /** DevicePairingRegistrationData eRegid. */ + public eRegid: Uint8Array; + + /** DevicePairingRegistrationData eKeytype. */ + public eKeytype: Uint8Array; + + /** DevicePairingRegistrationData eIdent. */ + public eIdent: Uint8Array; + + /** DevicePairingRegistrationData eSkeyId. */ + public eSkeyId: Uint8Array; + + /** DevicePairingRegistrationData eSkeyVal. */ + public eSkeyVal: Uint8Array; + + /** DevicePairingRegistrationData eSkeySig. */ + public eSkeySig: Uint8Array; + + /** DevicePairingRegistrationData buildHash. */ + public buildHash: Uint8Array; + + /** DevicePairingRegistrationData deviceProps. */ + public deviceProps: Uint8Array; + + /** + * Creates a new DevicePairingRegistrationData instance using the specified properties. + * @param [properties] Properties to set + * @returns DevicePairingRegistrationData instance + */ + public static create(properties?: proto.ClientPayload.IDevicePairingRegistrationData): proto.ClientPayload.DevicePairingRegistrationData; + + /** + * Encodes the specified DevicePairingRegistrationData message. Does not implicitly {@link proto.ClientPayload.DevicePairingRegistrationData.verify|verify} messages. + * @param message DevicePairingRegistrationData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ClientPayload.IDevicePairingRegistrationData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DevicePairingRegistrationData message, length delimited. Does not implicitly {@link proto.ClientPayload.DevicePairingRegistrationData.verify|verify} messages. + * @param message DevicePairingRegistrationData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ClientPayload.IDevicePairingRegistrationData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DevicePairingRegistrationData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DevicePairingRegistrationData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload.DevicePairingRegistrationData; + + /** + * Decodes a DevicePairingRegistrationData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DevicePairingRegistrationData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload.DevicePairingRegistrationData; + + /** + * Verifies a DevicePairingRegistrationData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DevicePairingRegistrationData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DevicePairingRegistrationData + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload.DevicePairingRegistrationData; + + /** + * Creates a plain object from a DevicePairingRegistrationData message. Also converts values to other types if specified. + * @param message DevicePairingRegistrationData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload.DevicePairingRegistrationData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DevicePairingRegistrationData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** IOSAppExtension enum. */ + enum IOSAppExtension { + SHARE_EXTENSION = 0, + SERVICE_EXTENSION = 1, + INTENTS_EXTENSION = 2 + } + + /** Product enum. */ + enum Product { + WHATSAPP = 0, + MESSENGER = 1 + } + + /** Properties of a UserAgent. */ + interface IUserAgent { + + /** UserAgent platform */ + platform?: (proto.ClientPayload.UserAgent.Platform|null); + + /** UserAgent appVersion */ + appVersion?: (proto.ClientPayload.UserAgent.IAppVersion|null); + + /** UserAgent mcc */ + mcc?: (string|null); + + /** UserAgent mnc */ + mnc?: (string|null); + + /** UserAgent osVersion */ + osVersion?: (string|null); + + /** UserAgent manufacturer */ + manufacturer?: (string|null); + + /** UserAgent device */ + device?: (string|null); + + /** UserAgent osBuildNumber */ + osBuildNumber?: (string|null); + + /** UserAgent phoneId */ + phoneId?: (string|null); + + /** UserAgent releaseChannel */ + releaseChannel?: (proto.ClientPayload.UserAgent.ReleaseChannel|null); + + /** UserAgent localeLanguageIso6391 */ + localeLanguageIso6391?: (string|null); + + /** UserAgent localeCountryIso31661Alpha2 */ + localeCountryIso31661Alpha2?: (string|null); + + /** UserAgent deviceBoard */ + deviceBoard?: (string|null); + } + + /** Represents a UserAgent. */ + class UserAgent implements IUserAgent { + + /** + * Constructs a new UserAgent. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ClientPayload.IUserAgent); + + /** UserAgent platform. */ + public platform: proto.ClientPayload.UserAgent.Platform; + + /** UserAgent appVersion. */ + public appVersion?: (proto.ClientPayload.UserAgent.IAppVersion|null); + + /** UserAgent mcc. */ + public mcc: string; + + /** UserAgent mnc. */ + public mnc: string; + + /** UserAgent osVersion. */ + public osVersion: string; + + /** UserAgent manufacturer. */ + public manufacturer: string; + + /** UserAgent device. */ + public device: string; + + /** UserAgent osBuildNumber. */ + public osBuildNumber: string; + + /** UserAgent phoneId. */ + public phoneId: string; + + /** UserAgent releaseChannel. */ + public releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel; + + /** UserAgent localeLanguageIso6391. */ + public localeLanguageIso6391: string; + + /** UserAgent localeCountryIso31661Alpha2. */ + public localeCountryIso31661Alpha2: string; + + /** UserAgent deviceBoard. */ + public deviceBoard: string; + + /** + * Creates a new UserAgent instance using the specified properties. + * @param [properties] Properties to set + * @returns UserAgent instance + */ + public static create(properties?: proto.ClientPayload.IUserAgent): proto.ClientPayload.UserAgent; + + /** + * Encodes the specified UserAgent message. Does not implicitly {@link proto.ClientPayload.UserAgent.verify|verify} messages. + * @param message UserAgent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ClientPayload.IUserAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserAgent message, length delimited. Does not implicitly {@link proto.ClientPayload.UserAgent.verify|verify} messages. + * @param message UserAgent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ClientPayload.IUserAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserAgent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload.UserAgent; + + /** + * Decodes a UserAgent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload.UserAgent; + + /** + * Verifies a UserAgent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserAgent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserAgent + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload.UserAgent; + + /** + * Creates a plain object from a UserAgent message. Also converts values to other types if specified. + * @param message UserAgent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload.UserAgent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserAgent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace UserAgent { + + /** Properties of an AppVersion. */ + interface IAppVersion { + + /** AppVersion primary */ + primary?: (number|null); + + /** AppVersion secondary */ + secondary?: (number|null); + + /** AppVersion tertiary */ + tertiary?: (number|null); + + /** AppVersion quaternary */ + quaternary?: (number|null); + + /** AppVersion quinary */ + quinary?: (number|null); + } + + /** Represents an AppVersion. */ + class AppVersion implements IAppVersion { + + /** + * Constructs a new AppVersion. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ClientPayload.UserAgent.IAppVersion); + + /** AppVersion primary. */ + public primary: number; + + /** AppVersion secondary. */ + public secondary: number; + + /** AppVersion tertiary. */ + public tertiary: number; + + /** AppVersion quaternary. */ + public quaternary: number; + + /** AppVersion quinary. */ + public quinary: number; + + /** + * Creates a new AppVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns AppVersion instance + */ + public static create(properties?: proto.ClientPayload.UserAgent.IAppVersion): proto.ClientPayload.UserAgent.AppVersion; + + /** + * Encodes the specified AppVersion message. Does not implicitly {@link proto.ClientPayload.UserAgent.AppVersion.verify|verify} messages. + * @param message AppVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ClientPayload.UserAgent.IAppVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppVersion message, length delimited. Does not implicitly {@link proto.ClientPayload.UserAgent.AppVersion.verify|verify} messages. + * @param message AppVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ClientPayload.UserAgent.IAppVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload.UserAgent.AppVersion; + + /** + * Decodes an AppVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload.UserAgent.AppVersion; + + /** + * Verifies an AppVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppVersion + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload.UserAgent.AppVersion; + + /** + * Creates a plain object from an AppVersion message. Also converts values to other types if specified. + * @param message AppVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload.UserAgent.AppVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Platform enum. */ + enum Platform { + ANDROID = 0, + IOS = 1, + WINDOWS_PHONE = 2, + BLACKBERRY = 3, + BLACKBERRYX = 4, + S40 = 5, + S60 = 6, + PYTHON_CLIENT = 7, + TIZEN = 8, + ENTERPRISE = 9, + SMB_ANDROID = 10, + KAIOS = 11, + SMB_IOS = 12, + WINDOWS = 13, + WEB = 14, + PORTAL = 15, + GREEN_ANDROID = 16, + GREEN_IPHONE = 17, + BLUE_ANDROID = 18, + BLUE_IPHONE = 19, + FBLITE_ANDROID = 20, + MLITE_ANDROID = 21, + IGLITE_ANDROID = 22, + PAGE = 23, + MACOS = 24, + OCULUS_MSG = 25, + OCULUS_CALL = 26, + MILAN = 27, + CAPI = 28, + WEAROS = 29, + ARDEVICE = 30, + VRDEVICE = 31, + BLUE_WEB = 32 + } + + /** ReleaseChannel enum. */ + enum ReleaseChannel { + RELEASE = 0, + BETA = 1, + ALPHA = 2, + DEBUG = 3 + } + } + + /** Properties of a WebInfo. */ + interface IWebInfo { + + /** WebInfo refToken */ + refToken?: (string|null); + + /** WebInfo version */ + version?: (string|null); + + /** WebInfo webdPayload */ + webdPayload?: (proto.ClientPayload.WebInfo.IWebdPayload|null); + + /** WebInfo webSubPlatform */ + webSubPlatform?: (proto.ClientPayload.WebInfo.WebSubPlatform|null); + } + + /** Represents a WebInfo. */ + class WebInfo implements IWebInfo { + + /** + * Constructs a new WebInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ClientPayload.IWebInfo); + + /** WebInfo refToken. */ + public refToken: string; + + /** WebInfo version. */ + public version: string; + + /** WebInfo webdPayload. */ + public webdPayload?: (proto.ClientPayload.WebInfo.IWebdPayload|null); + + /** WebInfo webSubPlatform. */ + public webSubPlatform: proto.ClientPayload.WebInfo.WebSubPlatform; + + /** + * Creates a new WebInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns WebInfo instance + */ + public static create(properties?: proto.ClientPayload.IWebInfo): proto.ClientPayload.WebInfo; + + /** + * Encodes the specified WebInfo message. Does not implicitly {@link proto.ClientPayload.WebInfo.verify|verify} messages. + * @param message WebInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ClientPayload.IWebInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebInfo message, length delimited. Does not implicitly {@link proto.ClientPayload.WebInfo.verify|verify} messages. + * @param message WebInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ClientPayload.IWebInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload.WebInfo; + + /** + * Decodes a WebInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload.WebInfo; + + /** + * Verifies a WebInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebInfo + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload.WebInfo; + + /** + * Creates a plain object from a WebInfo message. Also converts values to other types if specified. + * @param message WebInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload.WebInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WebInfo { + + /** WebSubPlatform enum. */ + enum WebSubPlatform { + WEB_BROWSER = 0, + APP_STORE = 1, + WIN_STORE = 2, + DARWIN = 3, + WIN32 = 4 + } + + /** Properties of a WebdPayload. */ + interface IWebdPayload { + + /** WebdPayload usesParticipantInKey */ + usesParticipantInKey?: (boolean|null); + + /** WebdPayload supportsStarredMessages */ + supportsStarredMessages?: (boolean|null); + + /** WebdPayload supportsDocumentMessages */ + supportsDocumentMessages?: (boolean|null); + + /** WebdPayload supportsUrlMessages */ + supportsUrlMessages?: (boolean|null); + + /** WebdPayload supportsMediaRetry */ + supportsMediaRetry?: (boolean|null); + + /** WebdPayload supportsE2EImage */ + supportsE2EImage?: (boolean|null); + + /** WebdPayload supportsE2EVideo */ + supportsE2EVideo?: (boolean|null); + + /** WebdPayload supportsE2EAudio */ + supportsE2EAudio?: (boolean|null); + + /** WebdPayload supportsE2EDocument */ + supportsE2EDocument?: (boolean|null); + + /** WebdPayload documentTypes */ + documentTypes?: (string|null); + + /** WebdPayload features */ + features?: (Uint8Array|null); + } + + /** Represents a WebdPayload. */ + class WebdPayload implements IWebdPayload { + + /** + * Constructs a new WebdPayload. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ClientPayload.WebInfo.IWebdPayload); + + /** WebdPayload usesParticipantInKey. */ + public usesParticipantInKey: boolean; + + /** WebdPayload supportsStarredMessages. */ + public supportsStarredMessages: boolean; + + /** WebdPayload supportsDocumentMessages. */ + public supportsDocumentMessages: boolean; + + /** WebdPayload supportsUrlMessages. */ + public supportsUrlMessages: boolean; + + /** WebdPayload supportsMediaRetry. */ + public supportsMediaRetry: boolean; + + /** WebdPayload supportsE2EImage. */ + public supportsE2EImage: boolean; + + /** WebdPayload supportsE2EVideo. */ + public supportsE2EVideo: boolean; + + /** WebdPayload supportsE2EAudio. */ + public supportsE2EAudio: boolean; + + /** WebdPayload supportsE2EDocument. */ + public supportsE2EDocument: boolean; + + /** WebdPayload documentTypes. */ + public documentTypes: string; + + /** WebdPayload features. */ + public features: Uint8Array; + + /** + * Creates a new WebdPayload instance using the specified properties. + * @param [properties] Properties to set + * @returns WebdPayload instance + */ + public static create(properties?: proto.ClientPayload.WebInfo.IWebdPayload): proto.ClientPayload.WebInfo.WebdPayload; + + /** + * Encodes the specified WebdPayload message. Does not implicitly {@link proto.ClientPayload.WebInfo.WebdPayload.verify|verify} messages. + * @param message WebdPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ClientPayload.WebInfo.IWebdPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebdPayload message, length delimited. Does not implicitly {@link proto.ClientPayload.WebInfo.WebdPayload.verify|verify} messages. + * @param message WebdPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ClientPayload.WebInfo.IWebdPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebdPayload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebdPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ClientPayload.WebInfo.WebdPayload; + + /** + * Decodes a WebdPayload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebdPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ClientPayload.WebInfo.WebdPayload; + + /** + * Verifies a WebdPayload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebdPayload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebdPayload + */ + public static fromObject(object: { [k: string]: any }): proto.ClientPayload.WebInfo.WebdPayload; + + /** + * Creates a plain object from a WebdPayload message. Also converts values to other types if specified. + * @param message WebdPayload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ClientPayload.WebInfo.WebdPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebdPayload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + + /** Properties of a ContextInfo. */ + interface IContextInfo { + + /** ContextInfo stanzaId */ + stanzaId?: (string|null); + + /** ContextInfo participant */ + participant?: (string|null); + + /** ContextInfo quotedMessage */ + quotedMessage?: (proto.IMessage|null); + + /** ContextInfo remoteJid */ + remoteJid?: (string|null); + + /** ContextInfo mentionedJid */ + mentionedJid?: (string[]|null); + + /** ContextInfo conversionSource */ + conversionSource?: (string|null); + + /** ContextInfo conversionData */ + conversionData?: (Uint8Array|null); + + /** ContextInfo conversionDelaySeconds */ + conversionDelaySeconds?: (number|null); + + /** ContextInfo forwardingScore */ + forwardingScore?: (number|null); + + /** ContextInfo isForwarded */ + isForwarded?: (boolean|null); + + /** ContextInfo quotedAd */ + quotedAd?: (proto.ContextInfo.IAdReplyInfo|null); + + /** ContextInfo placeholderKey */ + placeholderKey?: (proto.IMessageKey|null); + + /** ContextInfo expiration */ + expiration?: (number|null); + + /** ContextInfo ephemeralSettingTimestamp */ + ephemeralSettingTimestamp?: (number|Long|null); + + /** ContextInfo ephemeralSharedSecret */ + ephemeralSharedSecret?: (Uint8Array|null); + + /** ContextInfo externalAdReply */ + externalAdReply?: (proto.ContextInfo.IExternalAdReplyInfo|null); + + /** ContextInfo entryPointConversionSource */ + entryPointConversionSource?: (string|null); + + /** ContextInfo entryPointConversionApp */ + entryPointConversionApp?: (string|null); + + /** ContextInfo entryPointConversionDelaySeconds */ + entryPointConversionDelaySeconds?: (number|null); + + /** ContextInfo disappearingMode */ + disappearingMode?: (proto.IDisappearingMode|null); + + /** ContextInfo actionLink */ + actionLink?: (proto.IActionLink|null); + + /** ContextInfo groupSubject */ + groupSubject?: (string|null); + + /** ContextInfo parentGroupJid */ + parentGroupJid?: (string|null); + + /** ContextInfo trustBannerType */ + trustBannerType?: (string|null); + + /** ContextInfo trustBannerAction */ + trustBannerAction?: (number|null); + + /** ContextInfo isSampled */ + isSampled?: (boolean|null); + + /** ContextInfo groupMentions */ + groupMentions?: (proto.IGroupMention[]|null); + + /** ContextInfo utm */ + utm?: (proto.ContextInfo.IUTMInfo|null); + } + + /** Represents a ContextInfo. */ + class ContextInfo implements IContextInfo { + + /** + * Constructs a new ContextInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IContextInfo); + + /** ContextInfo stanzaId. */ + public stanzaId: string; + + /** ContextInfo participant. */ + public participant: string; + + /** ContextInfo quotedMessage. */ + public quotedMessage?: (proto.IMessage|null); + + /** ContextInfo remoteJid. */ + public remoteJid: string; + + /** ContextInfo mentionedJid. */ + public mentionedJid: string[]; + + /** ContextInfo conversionSource. */ + public conversionSource: string; + + /** ContextInfo conversionData. */ + public conversionData: Uint8Array; + + /** ContextInfo conversionDelaySeconds. */ + public conversionDelaySeconds: number; + + /** ContextInfo forwardingScore. */ + public forwardingScore: number; + + /** ContextInfo isForwarded. */ + public isForwarded: boolean; + + /** ContextInfo quotedAd. */ + public quotedAd?: (proto.ContextInfo.IAdReplyInfo|null); + + /** ContextInfo placeholderKey. */ + public placeholderKey?: (proto.IMessageKey|null); + + /** ContextInfo expiration. */ + public expiration: number; + + /** ContextInfo ephemeralSettingTimestamp. */ + public ephemeralSettingTimestamp: (number|Long); + + /** ContextInfo ephemeralSharedSecret. */ + public ephemeralSharedSecret: Uint8Array; + + /** ContextInfo externalAdReply. */ + public externalAdReply?: (proto.ContextInfo.IExternalAdReplyInfo|null); + + /** ContextInfo entryPointConversionSource. */ + public entryPointConversionSource: string; + + /** ContextInfo entryPointConversionApp. */ + public entryPointConversionApp: string; + + /** ContextInfo entryPointConversionDelaySeconds. */ + public entryPointConversionDelaySeconds: number; + + /** ContextInfo disappearingMode. */ + public disappearingMode?: (proto.IDisappearingMode|null); + + /** ContextInfo actionLink. */ + public actionLink?: (proto.IActionLink|null); + + /** ContextInfo groupSubject. */ + public groupSubject: string; + + /** ContextInfo parentGroupJid. */ + public parentGroupJid: string; + + /** ContextInfo trustBannerType. */ + public trustBannerType: string; + + /** ContextInfo trustBannerAction. */ + public trustBannerAction: number; + + /** ContextInfo isSampled. */ + public isSampled: boolean; + + /** ContextInfo groupMentions. */ + public groupMentions: proto.IGroupMention[]; + + /** ContextInfo utm. */ + public utm?: (proto.ContextInfo.IUTMInfo|null); + + /** + * Creates a new ContextInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ContextInfo instance + */ + public static create(properties?: proto.IContextInfo): proto.ContextInfo; + + /** + * Encodes the specified ContextInfo message. Does not implicitly {@link proto.ContextInfo.verify|verify} messages. + * @param message ContextInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IContextInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContextInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.verify|verify} messages. + * @param message ContextInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IContextInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContextInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ContextInfo; + + /** + * Decodes a ContextInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ContextInfo; + + /** + * Verifies a ContextInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContextInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContextInfo + */ + public static fromObject(object: { [k: string]: any }): proto.ContextInfo; + + /** + * Creates a plain object from a ContextInfo message. Also converts values to other types if specified. + * @param message ContextInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ContextInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContextInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ContextInfo { + + /** Properties of an AdReplyInfo. */ + interface IAdReplyInfo { + + /** AdReplyInfo advertiserName */ + advertiserName?: (string|null); + + /** AdReplyInfo mediaType */ + mediaType?: (proto.ContextInfo.AdReplyInfo.MediaType|null); + + /** AdReplyInfo jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** AdReplyInfo caption */ + caption?: (string|null); + } + + /** Represents an AdReplyInfo. */ + class AdReplyInfo implements IAdReplyInfo { + + /** + * Constructs a new AdReplyInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ContextInfo.IAdReplyInfo); + + /** AdReplyInfo advertiserName. */ + public advertiserName: string; + + /** AdReplyInfo mediaType. */ + public mediaType: proto.ContextInfo.AdReplyInfo.MediaType; + + /** AdReplyInfo jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** AdReplyInfo caption. */ + public caption: string; + + /** + * Creates a new AdReplyInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns AdReplyInfo instance + */ + public static create(properties?: proto.ContextInfo.IAdReplyInfo): proto.ContextInfo.AdReplyInfo; + + /** + * Encodes the specified AdReplyInfo message. Does not implicitly {@link proto.ContextInfo.AdReplyInfo.verify|verify} messages. + * @param message AdReplyInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ContextInfo.IAdReplyInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AdReplyInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.AdReplyInfo.verify|verify} messages. + * @param message AdReplyInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ContextInfo.IAdReplyInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AdReplyInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ContextInfo.AdReplyInfo; + + /** + * Decodes an AdReplyInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ContextInfo.AdReplyInfo; + + /** + * Verifies an AdReplyInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AdReplyInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AdReplyInfo + */ + public static fromObject(object: { [k: string]: any }): proto.ContextInfo.AdReplyInfo; + + /** + * Creates a plain object from an AdReplyInfo message. Also converts values to other types if specified. + * @param message AdReplyInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ContextInfo.AdReplyInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AdReplyInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AdReplyInfo { + + /** MediaType enum. */ + enum MediaType { + NONE = 0, + IMAGE = 1, + VIDEO = 2 + } + } + + /** Properties of an ExternalAdReplyInfo. */ + interface IExternalAdReplyInfo { + + /** ExternalAdReplyInfo title */ + title?: (string|null); + + /** ExternalAdReplyInfo body */ + body?: (string|null); + + /** ExternalAdReplyInfo mediaType */ + mediaType?: (proto.ContextInfo.ExternalAdReplyInfo.MediaType|null); + + /** ExternalAdReplyInfo thumbnailUrl */ + thumbnailUrl?: (string|null); + + /** ExternalAdReplyInfo mediaUrl */ + mediaUrl?: (string|null); + + /** ExternalAdReplyInfo thumbnail */ + thumbnail?: (Uint8Array|null); + + /** ExternalAdReplyInfo sourceType */ + sourceType?: (string|null); + + /** ExternalAdReplyInfo sourceId */ + sourceId?: (string|null); + + /** ExternalAdReplyInfo sourceUrl */ + sourceUrl?: (string|null); + + /** ExternalAdReplyInfo containsAutoReply */ + containsAutoReply?: (boolean|null); + + /** ExternalAdReplyInfo renderLargerThumbnail */ + renderLargerThumbnail?: (boolean|null); + + /** ExternalAdReplyInfo showAdAttribution */ + showAdAttribution?: (boolean|null); + + /** ExternalAdReplyInfo ctwaClid */ + ctwaClid?: (string|null); + } + + /** Represents an ExternalAdReplyInfo. */ + class ExternalAdReplyInfo implements IExternalAdReplyInfo { + + /** + * Constructs a new ExternalAdReplyInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ContextInfo.IExternalAdReplyInfo); + + /** ExternalAdReplyInfo title. */ + public title: string; + + /** ExternalAdReplyInfo body. */ + public body: string; + + /** ExternalAdReplyInfo mediaType. */ + public mediaType: proto.ContextInfo.ExternalAdReplyInfo.MediaType; + + /** ExternalAdReplyInfo thumbnailUrl. */ + public thumbnailUrl: string; + + /** ExternalAdReplyInfo mediaUrl. */ + public mediaUrl: string; + + /** ExternalAdReplyInfo thumbnail. */ + public thumbnail: Uint8Array; + + /** ExternalAdReplyInfo sourceType. */ + public sourceType: string; + + /** ExternalAdReplyInfo sourceId. */ + public sourceId: string; + + /** ExternalAdReplyInfo sourceUrl. */ + public sourceUrl: string; + + /** ExternalAdReplyInfo containsAutoReply. */ + public containsAutoReply: boolean; + + /** ExternalAdReplyInfo renderLargerThumbnail. */ + public renderLargerThumbnail: boolean; + + /** ExternalAdReplyInfo showAdAttribution. */ + public showAdAttribution: boolean; + + /** ExternalAdReplyInfo ctwaClid. */ + public ctwaClid: string; + + /** + * Creates a new ExternalAdReplyInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ExternalAdReplyInfo instance + */ + public static create(properties?: proto.ContextInfo.IExternalAdReplyInfo): proto.ContextInfo.ExternalAdReplyInfo; + + /** + * Encodes the specified ExternalAdReplyInfo message. Does not implicitly {@link proto.ContextInfo.ExternalAdReplyInfo.verify|verify} messages. + * @param message ExternalAdReplyInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ContextInfo.IExternalAdReplyInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExternalAdReplyInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.ExternalAdReplyInfo.verify|verify} messages. + * @param message ExternalAdReplyInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ContextInfo.IExternalAdReplyInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExternalAdReplyInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExternalAdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ContextInfo.ExternalAdReplyInfo; + + /** + * Decodes an ExternalAdReplyInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExternalAdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ContextInfo.ExternalAdReplyInfo; + + /** + * Verifies an ExternalAdReplyInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExternalAdReplyInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExternalAdReplyInfo + */ + public static fromObject(object: { [k: string]: any }): proto.ContextInfo.ExternalAdReplyInfo; + + /** + * Creates a plain object from an ExternalAdReplyInfo message. Also converts values to other types if specified. + * @param message ExternalAdReplyInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ContextInfo.ExternalAdReplyInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExternalAdReplyInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ExternalAdReplyInfo { + + /** MediaType enum. */ + enum MediaType { + NONE = 0, + IMAGE = 1, + VIDEO = 2 + } + } + + /** Properties of a UTMInfo. */ + interface IUTMInfo { + + /** UTMInfo utmSource */ + utmSource?: (string|null); + + /** UTMInfo utmCampaign */ + utmCampaign?: (string|null); + } + + /** Represents a UTMInfo. */ + class UTMInfo implements IUTMInfo { + + /** + * Constructs a new UTMInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ContextInfo.IUTMInfo); + + /** UTMInfo utmSource. */ + public utmSource: string; + + /** UTMInfo utmCampaign. */ + public utmCampaign: string; + + /** + * Creates a new UTMInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns UTMInfo instance + */ + public static create(properties?: proto.ContextInfo.IUTMInfo): proto.ContextInfo.UTMInfo; + + /** + * Encodes the specified UTMInfo message. Does not implicitly {@link proto.ContextInfo.UTMInfo.verify|verify} messages. + * @param message UTMInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ContextInfo.IUTMInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UTMInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.UTMInfo.verify|verify} messages. + * @param message UTMInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ContextInfo.IUTMInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UTMInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UTMInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ContextInfo.UTMInfo; + + /** + * Decodes a UTMInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UTMInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ContextInfo.UTMInfo; + + /** + * Verifies a UTMInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UTMInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UTMInfo + */ + public static fromObject(object: { [k: string]: any }): proto.ContextInfo.UTMInfo; + + /** + * Creates a plain object from a UTMInfo message. Also converts values to other types if specified. + * @param message UTMInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ContextInfo.UTMInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UTMInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a Conversation. */ + interface IConversation { + + /** Conversation id */ + id: string; + + /** Conversation messages */ + messages?: (proto.IHistorySyncMsg[]|null); + + /** Conversation newJid */ + newJid?: (string|null); + + /** Conversation oldJid */ + oldJid?: (string|null); + + /** Conversation lastMsgTimestamp */ + lastMsgTimestamp?: (number|Long|null); + + /** Conversation unreadCount */ + unreadCount?: (number|null); + + /** Conversation readOnly */ + readOnly?: (boolean|null); + + /** Conversation endOfHistoryTransfer */ + endOfHistoryTransfer?: (boolean|null); + + /** Conversation ephemeralExpiration */ + ephemeralExpiration?: (number|null); + + /** Conversation ephemeralSettingTimestamp */ + ephemeralSettingTimestamp?: (number|Long|null); + + /** Conversation endOfHistoryTransferType */ + endOfHistoryTransferType?: (proto.Conversation.EndOfHistoryTransferType|null); + + /** Conversation conversationTimestamp */ + conversationTimestamp?: (number|Long|null); + + /** Conversation name */ + name?: (string|null); + + /** Conversation pHash */ + pHash?: (string|null); + + /** Conversation notSpam */ + notSpam?: (boolean|null); + + /** Conversation archived */ + archived?: (boolean|null); + + /** Conversation disappearingMode */ + disappearingMode?: (proto.IDisappearingMode|null); + + /** Conversation unreadMentionCount */ + unreadMentionCount?: (number|null); + + /** Conversation markedAsUnread */ + markedAsUnread?: (boolean|null); + + /** Conversation participant */ + participant?: (proto.IGroupParticipant[]|null); + + /** Conversation tcToken */ + tcToken?: (Uint8Array|null); + + /** Conversation tcTokenTimestamp */ + tcTokenTimestamp?: (number|Long|null); + + /** Conversation contactPrimaryIdentityKey */ + contactPrimaryIdentityKey?: (Uint8Array|null); + + /** Conversation pinned */ + pinned?: (number|null); + + /** Conversation muteEndTime */ + muteEndTime?: (number|Long|null); + + /** Conversation wallpaper */ + wallpaper?: (proto.IWallpaperSettings|null); + + /** Conversation mediaVisibility */ + mediaVisibility?: (proto.MediaVisibility|null); + + /** Conversation tcTokenSenderTimestamp */ + tcTokenSenderTimestamp?: (number|Long|null); + + /** Conversation suspended */ + suspended?: (boolean|null); + + /** Conversation terminated */ + terminated?: (boolean|null); + + /** Conversation createdAt */ + createdAt?: (number|Long|null); + + /** Conversation createdBy */ + createdBy?: (string|null); + + /** Conversation description */ + description?: (string|null); + + /** Conversation support */ + support?: (boolean|null); + + /** Conversation isParentGroup */ + isParentGroup?: (boolean|null); + + /** Conversation parentGroupId */ + parentGroupId?: (string|null); + + /** Conversation isDefaultSubgroup */ + isDefaultSubgroup?: (boolean|null); + + /** Conversation displayName */ + displayName?: (string|null); + + /** Conversation pnJid */ + pnJid?: (string|null); + + /** Conversation shareOwnPn */ + shareOwnPn?: (boolean|null); + + /** Conversation pnhDuplicateLidThread */ + pnhDuplicateLidThread?: (boolean|null); + + /** Conversation lidJid */ + lidJid?: (string|null); + } + + /** Represents a Conversation. */ + class Conversation implements IConversation { + + /** + * Constructs a new Conversation. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IConversation); + + /** Conversation id. */ + public id: string; + + /** Conversation messages. */ + public messages: proto.IHistorySyncMsg[]; + + /** Conversation newJid. */ + public newJid: string; + + /** Conversation oldJid. */ + public oldJid: string; + + /** Conversation lastMsgTimestamp. */ + public lastMsgTimestamp: (number|Long); + + /** Conversation unreadCount. */ + public unreadCount: number; + + /** Conversation readOnly. */ + public readOnly: boolean; + + /** Conversation endOfHistoryTransfer. */ + public endOfHistoryTransfer: boolean; + + /** Conversation ephemeralExpiration. */ + public ephemeralExpiration: number; + + /** Conversation ephemeralSettingTimestamp. */ + public ephemeralSettingTimestamp: (number|Long); + + /** Conversation endOfHistoryTransferType. */ + public endOfHistoryTransferType: proto.Conversation.EndOfHistoryTransferType; + + /** Conversation conversationTimestamp. */ + public conversationTimestamp: (number|Long); + + /** Conversation name. */ + public name: string; + + /** Conversation pHash. */ + public pHash: string; + + /** Conversation notSpam. */ + public notSpam: boolean; + + /** Conversation archived. */ + public archived: boolean; + + /** Conversation disappearingMode. */ + public disappearingMode?: (proto.IDisappearingMode|null); + + /** Conversation unreadMentionCount. */ + public unreadMentionCount: number; + + /** Conversation markedAsUnread. */ + public markedAsUnread: boolean; + + /** Conversation participant. */ + public participant: proto.IGroupParticipant[]; + + /** Conversation tcToken. */ + public tcToken: Uint8Array; + + /** Conversation tcTokenTimestamp. */ + public tcTokenTimestamp: (number|Long); + + /** Conversation contactPrimaryIdentityKey. */ + public contactPrimaryIdentityKey: Uint8Array; + + /** Conversation pinned. */ + public pinned: number; + + /** Conversation muteEndTime. */ + public muteEndTime: (number|Long); + + /** Conversation wallpaper. */ + public wallpaper?: (proto.IWallpaperSettings|null); + + /** Conversation mediaVisibility. */ + public mediaVisibility: proto.MediaVisibility; + + /** Conversation tcTokenSenderTimestamp. */ + public tcTokenSenderTimestamp: (number|Long); + + /** Conversation suspended. */ + public suspended: boolean; + + /** Conversation terminated. */ + public terminated: boolean; + + /** Conversation createdAt. */ + public createdAt: (number|Long); + + /** Conversation createdBy. */ + public createdBy: string; + + /** Conversation description. */ + public description: string; + + /** Conversation support. */ + public support: boolean; + + /** Conversation isParentGroup. */ + public isParentGroup: boolean; + + /** Conversation parentGroupId. */ + public parentGroupId: string; + + /** Conversation isDefaultSubgroup. */ + public isDefaultSubgroup: boolean; + + /** Conversation displayName. */ + public displayName: string; + + /** Conversation pnJid. */ + public pnJid: string; + + /** Conversation shareOwnPn. */ + public shareOwnPn: boolean; + + /** Conversation pnhDuplicateLidThread. */ + public pnhDuplicateLidThread: boolean; + + /** Conversation lidJid. */ + public lidJid: string; + + /** + * Creates a new Conversation instance using the specified properties. + * @param [properties] Properties to set + * @returns Conversation instance + */ + public static create(properties?: proto.IConversation): proto.Conversation; + + /** + * Encodes the specified Conversation message. Does not implicitly {@link proto.Conversation.verify|verify} messages. + * @param message Conversation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IConversation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Conversation message, length delimited. Does not implicitly {@link proto.Conversation.verify|verify} messages. + * @param message Conversation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IConversation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Conversation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Conversation; + + /** + * Decodes a Conversation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Conversation; + + /** + * Verifies a Conversation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Conversation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Conversation + */ + public static fromObject(object: { [k: string]: any }): proto.Conversation; + + /** + * Creates a plain object from a Conversation message. Also converts values to other types if specified. + * @param message Conversation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Conversation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Conversation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Conversation { + + /** EndOfHistoryTransferType enum. */ + enum EndOfHistoryTransferType { + COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0, + COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1 + } + } + + /** Properties of a DeviceListMetadata. */ + interface IDeviceListMetadata { + + /** DeviceListMetadata senderKeyHash */ + senderKeyHash?: (Uint8Array|null); + + /** DeviceListMetadata senderTimestamp */ + senderTimestamp?: (number|Long|null); + + /** DeviceListMetadata senderKeyIndexes */ + senderKeyIndexes?: (number[]|null); + + /** DeviceListMetadata recipientKeyHash */ + recipientKeyHash?: (Uint8Array|null); + + /** DeviceListMetadata recipientTimestamp */ + recipientTimestamp?: (number|Long|null); + + /** DeviceListMetadata recipientKeyIndexes */ + recipientKeyIndexes?: (number[]|null); + } + + /** Represents a DeviceListMetadata. */ + class DeviceListMetadata implements IDeviceListMetadata { + + /** + * Constructs a new DeviceListMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IDeviceListMetadata); + + /** DeviceListMetadata senderKeyHash. */ + public senderKeyHash: Uint8Array; + + /** DeviceListMetadata senderTimestamp. */ + public senderTimestamp: (number|Long); + + /** DeviceListMetadata senderKeyIndexes. */ + public senderKeyIndexes: number[]; + + /** DeviceListMetadata recipientKeyHash. */ + public recipientKeyHash: Uint8Array; + + /** DeviceListMetadata recipientTimestamp. */ + public recipientTimestamp: (number|Long); + + /** DeviceListMetadata recipientKeyIndexes. */ + public recipientKeyIndexes: number[]; + + /** + * Creates a new DeviceListMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeviceListMetadata instance + */ + public static create(properties?: proto.IDeviceListMetadata): proto.DeviceListMetadata; + + /** + * Encodes the specified DeviceListMetadata message. Does not implicitly {@link proto.DeviceListMetadata.verify|verify} messages. + * @param message DeviceListMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IDeviceListMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeviceListMetadata message, length delimited. Does not implicitly {@link proto.DeviceListMetadata.verify|verify} messages. + * @param message DeviceListMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IDeviceListMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeviceListMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeviceListMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.DeviceListMetadata; + + /** + * Decodes a DeviceListMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeviceListMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.DeviceListMetadata; + + /** + * Verifies a DeviceListMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeviceListMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeviceListMetadata + */ + public static fromObject(object: { [k: string]: any }): proto.DeviceListMetadata; + + /** + * Creates a plain object from a DeviceListMetadata message. Also converts values to other types if specified. + * @param message DeviceListMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.DeviceListMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeviceListMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeviceProps. */ + interface IDeviceProps { + + /** DeviceProps os */ + os?: (string|null); + + /** DeviceProps version */ + version?: (proto.DeviceProps.IAppVersion|null); + + /** DeviceProps platformType */ + platformType?: (proto.DeviceProps.PlatformType|null); + + /** DeviceProps requireFullSync */ + requireFullSync?: (boolean|null); + + /** DeviceProps historySyncConfig */ + historySyncConfig?: (proto.DeviceProps.IHistorySyncConfig|null); + } + + /** Represents a DeviceProps. */ + class DeviceProps implements IDeviceProps { + + /** + * Constructs a new DeviceProps. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IDeviceProps); + + /** DeviceProps os. */ + public os: string; + + /** DeviceProps version. */ + public version?: (proto.DeviceProps.IAppVersion|null); + + /** DeviceProps platformType. */ + public platformType: proto.DeviceProps.PlatformType; + + /** DeviceProps requireFullSync. */ + public requireFullSync: boolean; + + /** DeviceProps historySyncConfig. */ + public historySyncConfig?: (proto.DeviceProps.IHistorySyncConfig|null); + + /** + * Creates a new DeviceProps instance using the specified properties. + * @param [properties] Properties to set + * @returns DeviceProps instance + */ + public static create(properties?: proto.IDeviceProps): proto.DeviceProps; + + /** + * Encodes the specified DeviceProps message. Does not implicitly {@link proto.DeviceProps.verify|verify} messages. + * @param message DeviceProps message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IDeviceProps, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeviceProps message, length delimited. Does not implicitly {@link proto.DeviceProps.verify|verify} messages. + * @param message DeviceProps message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IDeviceProps, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeviceProps message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeviceProps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.DeviceProps; + + /** + * Decodes a DeviceProps message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeviceProps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.DeviceProps; + + /** + * Verifies a DeviceProps message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeviceProps message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeviceProps + */ + public static fromObject(object: { [k: string]: any }): proto.DeviceProps; + + /** + * Creates a plain object from a DeviceProps message. Also converts values to other types if specified. + * @param message DeviceProps + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.DeviceProps, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeviceProps to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DeviceProps { + + /** Properties of an AppVersion. */ + interface IAppVersion { + + /** AppVersion primary */ + primary?: (number|null); + + /** AppVersion secondary */ + secondary?: (number|null); + + /** AppVersion tertiary */ + tertiary?: (number|null); + + /** AppVersion quaternary */ + quaternary?: (number|null); + + /** AppVersion quinary */ + quinary?: (number|null); + } + + /** Represents an AppVersion. */ + class AppVersion implements IAppVersion { + + /** + * Constructs a new AppVersion. + * @param [properties] Properties to set + */ + constructor(properties?: proto.DeviceProps.IAppVersion); + + /** AppVersion primary. */ + public primary: number; + + /** AppVersion secondary. */ + public secondary: number; + + /** AppVersion tertiary. */ + public tertiary: number; + + /** AppVersion quaternary. */ + public quaternary: number; + + /** AppVersion quinary. */ + public quinary: number; + + /** + * Creates a new AppVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns AppVersion instance + */ + public static create(properties?: proto.DeviceProps.IAppVersion): proto.DeviceProps.AppVersion; + + /** + * Encodes the specified AppVersion message. Does not implicitly {@link proto.DeviceProps.AppVersion.verify|verify} messages. + * @param message AppVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.DeviceProps.IAppVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppVersion message, length delimited. Does not implicitly {@link proto.DeviceProps.AppVersion.verify|verify} messages. + * @param message AppVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.DeviceProps.IAppVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.DeviceProps.AppVersion; + + /** + * Decodes an AppVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.DeviceProps.AppVersion; + + /** + * Verifies an AppVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppVersion + */ + public static fromObject(object: { [k: string]: any }): proto.DeviceProps.AppVersion; + + /** + * Creates a plain object from an AppVersion message. Also converts values to other types if specified. + * @param message AppVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.DeviceProps.AppVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HistorySyncConfig. */ + interface IHistorySyncConfig { + + /** HistorySyncConfig fullSyncDaysLimit */ + fullSyncDaysLimit?: (number|null); + + /** HistorySyncConfig fullSyncSizeMbLimit */ + fullSyncSizeMbLimit?: (number|null); + + /** HistorySyncConfig storageQuotaMb */ + storageQuotaMb?: (number|null); + } + + /** Represents a HistorySyncConfig. */ + class HistorySyncConfig implements IHistorySyncConfig { + + /** + * Constructs a new HistorySyncConfig. + * @param [properties] Properties to set + */ + constructor(properties?: proto.DeviceProps.IHistorySyncConfig); + + /** HistorySyncConfig fullSyncDaysLimit. */ + public fullSyncDaysLimit: number; + + /** HistorySyncConfig fullSyncSizeMbLimit. */ + public fullSyncSizeMbLimit: number; + + /** HistorySyncConfig storageQuotaMb. */ + public storageQuotaMb: number; + + /** + * Creates a new HistorySyncConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns HistorySyncConfig instance + */ + public static create(properties?: proto.DeviceProps.IHistorySyncConfig): proto.DeviceProps.HistorySyncConfig; + + /** + * Encodes the specified HistorySyncConfig message. Does not implicitly {@link proto.DeviceProps.HistorySyncConfig.verify|verify} messages. + * @param message HistorySyncConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.DeviceProps.IHistorySyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HistorySyncConfig message, length delimited. Does not implicitly {@link proto.DeviceProps.HistorySyncConfig.verify|verify} messages. + * @param message HistorySyncConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.DeviceProps.IHistorySyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HistorySyncConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HistorySyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.DeviceProps.HistorySyncConfig; + + /** + * Decodes a HistorySyncConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HistorySyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.DeviceProps.HistorySyncConfig; + + /** + * Verifies a HistorySyncConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HistorySyncConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HistorySyncConfig + */ + public static fromObject(object: { [k: string]: any }): proto.DeviceProps.HistorySyncConfig; + + /** + * Creates a plain object from a HistorySyncConfig message. Also converts values to other types if specified. + * @param message HistorySyncConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.DeviceProps.HistorySyncConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HistorySyncConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** PlatformType enum. */ + enum PlatformType { + UNKNOWN = 0, + CHROME = 1, + FIREFOX = 2, + IE = 3, + OPERA = 4, + SAFARI = 5, + EDGE = 6, + DESKTOP = 7, + IPAD = 8, + ANDROID_TABLET = 9, + OHANA = 10, + ALOHA = 11, + CATALINA = 12, + TCL_TV = 13, + IOS_PHONE = 14, + IOS_CATALYST = 15, + ANDROID_PHONE = 16, + ANDROID_AMBIGUOUS = 17 + } + } + + /** Properties of a DisappearingMode. */ + interface IDisappearingMode { + + /** DisappearingMode initiator */ + initiator?: (proto.DisappearingMode.Initiator|null); + } + + /** Represents a DisappearingMode. */ + class DisappearingMode implements IDisappearingMode { + + /** + * Constructs a new DisappearingMode. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IDisappearingMode); + + /** DisappearingMode initiator. */ + public initiator: proto.DisappearingMode.Initiator; + + /** + * Creates a new DisappearingMode instance using the specified properties. + * @param [properties] Properties to set + * @returns DisappearingMode instance + */ + public static create(properties?: proto.IDisappearingMode): proto.DisappearingMode; + + /** + * Encodes the specified DisappearingMode message. Does not implicitly {@link proto.DisappearingMode.verify|verify} messages. + * @param message DisappearingMode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IDisappearingMode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisappearingMode message, length delimited. Does not implicitly {@link proto.DisappearingMode.verify|verify} messages. + * @param message DisappearingMode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IDisappearingMode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisappearingMode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisappearingMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.DisappearingMode; + + /** + * Decodes a DisappearingMode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisappearingMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.DisappearingMode; + + /** + * Verifies a DisappearingMode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DisappearingMode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisappearingMode + */ + public static fromObject(object: { [k: string]: any }): proto.DisappearingMode; + + /** + * Creates a plain object from a DisappearingMode message. Also converts values to other types if specified. + * @param message DisappearingMode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.DisappearingMode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisappearingMode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DisappearingMode { + + /** Initiator enum. */ + enum Initiator { + CHANGED_IN_CHAT = 0, + INITIATED_BY_ME = 1, + INITIATED_BY_OTHER = 2 + } + } + + /** Properties of an EphemeralSetting. */ + interface IEphemeralSetting { + + /** EphemeralSetting duration */ + duration?: (number|null); + + /** EphemeralSetting timestamp */ + timestamp?: (number|Long|null); + } + + /** Represents an EphemeralSetting. */ + class EphemeralSetting implements IEphemeralSetting { + + /** + * Constructs a new EphemeralSetting. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IEphemeralSetting); + + /** EphemeralSetting duration. */ + public duration: number; + + /** EphemeralSetting timestamp. */ + public timestamp: (number|Long); + + /** + * Creates a new EphemeralSetting instance using the specified properties. + * @param [properties] Properties to set + * @returns EphemeralSetting instance + */ + public static create(properties?: proto.IEphemeralSetting): proto.EphemeralSetting; + + /** + * Encodes the specified EphemeralSetting message. Does not implicitly {@link proto.EphemeralSetting.verify|verify} messages. + * @param message EphemeralSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IEphemeralSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EphemeralSetting message, length delimited. Does not implicitly {@link proto.EphemeralSetting.verify|verify} messages. + * @param message EphemeralSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IEphemeralSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EphemeralSetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EphemeralSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.EphemeralSetting; + + /** + * Decodes an EphemeralSetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EphemeralSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.EphemeralSetting; + + /** + * Verifies an EphemeralSetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EphemeralSetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EphemeralSetting + */ + public static fromObject(object: { [k: string]: any }): proto.EphemeralSetting; + + /** + * Creates a plain object from an EphemeralSetting message. Also converts values to other types if specified. + * @param message EphemeralSetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.EphemeralSetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EphemeralSetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExitCode. */ + interface IExitCode { + + /** ExitCode code */ + code?: (number|Long|null); + + /** ExitCode text */ + text?: (string|null); + } + + /** Represents an ExitCode. */ + class ExitCode implements IExitCode { + + /** + * Constructs a new ExitCode. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IExitCode); + + /** ExitCode code. */ + public code: (number|Long); + + /** ExitCode text. */ + public text: string; + + /** + * Creates a new ExitCode instance using the specified properties. + * @param [properties] Properties to set + * @returns ExitCode instance + */ + public static create(properties?: proto.IExitCode): proto.ExitCode; + + /** + * Encodes the specified ExitCode message. Does not implicitly {@link proto.ExitCode.verify|verify} messages. + * @param message ExitCode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IExitCode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExitCode message, length delimited. Does not implicitly {@link proto.ExitCode.verify|verify} messages. + * @param message ExitCode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IExitCode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExitCode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExitCode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ExitCode; + + /** + * Decodes an ExitCode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExitCode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ExitCode; + + /** + * Verifies an ExitCode message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExitCode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExitCode + */ + public static fromObject(object: { [k: string]: any }): proto.ExitCode; + + /** + * Creates a plain object from an ExitCode message. Also converts values to other types if specified. + * @param message ExitCode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ExitCode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExitCode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExternalBlobReference. */ + interface IExternalBlobReference { + + /** ExternalBlobReference mediaKey */ + mediaKey?: (Uint8Array|null); + + /** ExternalBlobReference directPath */ + directPath?: (string|null); + + /** ExternalBlobReference handle */ + handle?: (string|null); + + /** ExternalBlobReference fileSizeBytes */ + fileSizeBytes?: (number|Long|null); + + /** ExternalBlobReference fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** ExternalBlobReference fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + } + + /** Represents an ExternalBlobReference. */ + class ExternalBlobReference implements IExternalBlobReference { + + /** + * Constructs a new ExternalBlobReference. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IExternalBlobReference); + + /** ExternalBlobReference mediaKey. */ + public mediaKey: Uint8Array; + + /** ExternalBlobReference directPath. */ + public directPath: string; + + /** ExternalBlobReference handle. */ + public handle: string; + + /** ExternalBlobReference fileSizeBytes. */ + public fileSizeBytes: (number|Long); + + /** ExternalBlobReference fileSha256. */ + public fileSha256: Uint8Array; + + /** ExternalBlobReference fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** + * Creates a new ExternalBlobReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ExternalBlobReference instance + */ + public static create(properties?: proto.IExternalBlobReference): proto.ExternalBlobReference; + + /** + * Encodes the specified ExternalBlobReference message. Does not implicitly {@link proto.ExternalBlobReference.verify|verify} messages. + * @param message ExternalBlobReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IExternalBlobReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExternalBlobReference message, length delimited. Does not implicitly {@link proto.ExternalBlobReference.verify|verify} messages. + * @param message ExternalBlobReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IExternalBlobReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExternalBlobReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExternalBlobReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ExternalBlobReference; + + /** + * Decodes an ExternalBlobReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExternalBlobReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ExternalBlobReference; + + /** + * Verifies an ExternalBlobReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExternalBlobReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExternalBlobReference + */ + public static fromObject(object: { [k: string]: any }): proto.ExternalBlobReference; + + /** + * Creates a plain object from an ExternalBlobReference message. Also converts values to other types if specified. + * @param message ExternalBlobReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ExternalBlobReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExternalBlobReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GlobalSettings. */ + interface IGlobalSettings { + + /** GlobalSettings lightThemeWallpaper */ + lightThemeWallpaper?: (proto.IWallpaperSettings|null); + + /** GlobalSettings mediaVisibility */ + mediaVisibility?: (proto.MediaVisibility|null); + + /** GlobalSettings darkThemeWallpaper */ + darkThemeWallpaper?: (proto.IWallpaperSettings|null); + + /** GlobalSettings autoDownloadWiFi */ + autoDownloadWiFi?: (proto.IAutoDownloadSettings|null); + + /** GlobalSettings autoDownloadCellular */ + autoDownloadCellular?: (proto.IAutoDownloadSettings|null); + + /** GlobalSettings autoDownloadRoaming */ + autoDownloadRoaming?: (proto.IAutoDownloadSettings|null); + + /** GlobalSettings showIndividualNotificationsPreview */ + showIndividualNotificationsPreview?: (boolean|null); + + /** GlobalSettings showGroupNotificationsPreview */ + showGroupNotificationsPreview?: (boolean|null); + + /** GlobalSettings disappearingModeDuration */ + disappearingModeDuration?: (number|null); + + /** GlobalSettings disappearingModeTimestamp */ + disappearingModeTimestamp?: (number|Long|null); + + /** GlobalSettings avatarUserSettings */ + avatarUserSettings?: (proto.IAvatarUserSettings|null); + } + + /** Represents a GlobalSettings. */ + class GlobalSettings implements IGlobalSettings { + + /** + * Constructs a new GlobalSettings. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IGlobalSettings); + + /** GlobalSettings lightThemeWallpaper. */ + public lightThemeWallpaper?: (proto.IWallpaperSettings|null); + + /** GlobalSettings mediaVisibility. */ + public mediaVisibility: proto.MediaVisibility; + + /** GlobalSettings darkThemeWallpaper. */ + public darkThemeWallpaper?: (proto.IWallpaperSettings|null); + + /** GlobalSettings autoDownloadWiFi. */ + public autoDownloadWiFi?: (proto.IAutoDownloadSettings|null); + + /** GlobalSettings autoDownloadCellular. */ + public autoDownloadCellular?: (proto.IAutoDownloadSettings|null); + + /** GlobalSettings autoDownloadRoaming. */ + public autoDownloadRoaming?: (proto.IAutoDownloadSettings|null); + + /** GlobalSettings showIndividualNotificationsPreview. */ + public showIndividualNotificationsPreview: boolean; + + /** GlobalSettings showGroupNotificationsPreview. */ + public showGroupNotificationsPreview: boolean; + + /** GlobalSettings disappearingModeDuration. */ + public disappearingModeDuration: number; + + /** GlobalSettings disappearingModeTimestamp. */ + public disappearingModeTimestamp: (number|Long); + + /** GlobalSettings avatarUserSettings. */ + public avatarUserSettings?: (proto.IAvatarUserSettings|null); + + /** + * Creates a new GlobalSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns GlobalSettings instance + */ + public static create(properties?: proto.IGlobalSettings): proto.GlobalSettings; + + /** + * Encodes the specified GlobalSettings message. Does not implicitly {@link proto.GlobalSettings.verify|verify} messages. + * @param message GlobalSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IGlobalSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GlobalSettings message, length delimited. Does not implicitly {@link proto.GlobalSettings.verify|verify} messages. + * @param message GlobalSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IGlobalSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GlobalSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GlobalSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.GlobalSettings; + + /** + * Decodes a GlobalSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GlobalSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.GlobalSettings; + + /** + * Verifies a GlobalSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GlobalSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GlobalSettings + */ + public static fromObject(object: { [k: string]: any }): proto.GlobalSettings; + + /** + * Creates a plain object from a GlobalSettings message. Also converts values to other types if specified. + * @param message GlobalSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.GlobalSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GlobalSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GroupMention. */ + interface IGroupMention { + + /** GroupMention groupJid */ + groupJid?: (string|null); + + /** GroupMention groupSubject */ + groupSubject?: (string|null); + } + + /** Represents a GroupMention. */ + class GroupMention implements IGroupMention { + + /** + * Constructs a new GroupMention. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IGroupMention); + + /** GroupMention groupJid. */ + public groupJid: string; + + /** GroupMention groupSubject. */ + public groupSubject: string; + + /** + * Creates a new GroupMention instance using the specified properties. + * @param [properties] Properties to set + * @returns GroupMention instance + */ + public static create(properties?: proto.IGroupMention): proto.GroupMention; + + /** + * Encodes the specified GroupMention message. Does not implicitly {@link proto.GroupMention.verify|verify} messages. + * @param message GroupMention message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IGroupMention, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GroupMention message, length delimited. Does not implicitly {@link proto.GroupMention.verify|verify} messages. + * @param message GroupMention message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IGroupMention, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GroupMention message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GroupMention + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.GroupMention; + + /** + * Decodes a GroupMention message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GroupMention + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.GroupMention; + + /** + * Verifies a GroupMention message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GroupMention message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GroupMention + */ + public static fromObject(object: { [k: string]: any }): proto.GroupMention; + + /** + * Creates a plain object from a GroupMention message. Also converts values to other types if specified. + * @param message GroupMention + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.GroupMention, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GroupMention to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GroupParticipant. */ + interface IGroupParticipant { + + /** GroupParticipant userJid */ + userJid: string; + + /** GroupParticipant rank */ + rank?: (proto.GroupParticipant.Rank|null); + } + + /** Represents a GroupParticipant. */ + class GroupParticipant implements IGroupParticipant { + + /** + * Constructs a new GroupParticipant. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IGroupParticipant); + + /** GroupParticipant userJid. */ + public userJid: string; + + /** GroupParticipant rank. */ + public rank: proto.GroupParticipant.Rank; + + /** + * Creates a new GroupParticipant instance using the specified properties. + * @param [properties] Properties to set + * @returns GroupParticipant instance + */ + public static create(properties?: proto.IGroupParticipant): proto.GroupParticipant; + + /** + * Encodes the specified GroupParticipant message. Does not implicitly {@link proto.GroupParticipant.verify|verify} messages. + * @param message GroupParticipant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IGroupParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GroupParticipant message, length delimited. Does not implicitly {@link proto.GroupParticipant.verify|verify} messages. + * @param message GroupParticipant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IGroupParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GroupParticipant message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GroupParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.GroupParticipant; + + /** + * Decodes a GroupParticipant message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GroupParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.GroupParticipant; + + /** + * Verifies a GroupParticipant message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GroupParticipant message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GroupParticipant + */ + public static fromObject(object: { [k: string]: any }): proto.GroupParticipant; + + /** + * Creates a plain object from a GroupParticipant message. Also converts values to other types if specified. + * @param message GroupParticipant + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.GroupParticipant, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GroupParticipant to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace GroupParticipant { + + /** Rank enum. */ + enum Rank { + REGULAR = 0, + ADMIN = 1, + SUPERADMIN = 2 + } + } + + /** Properties of a HandshakeMessage. */ + interface IHandshakeMessage { + + /** HandshakeMessage clientHello */ + clientHello?: (proto.HandshakeMessage.IClientHello|null); + + /** HandshakeMessage serverHello */ + serverHello?: (proto.HandshakeMessage.IServerHello|null); + + /** HandshakeMessage clientFinish */ + clientFinish?: (proto.HandshakeMessage.IClientFinish|null); + } + + /** Represents a HandshakeMessage. */ + class HandshakeMessage implements IHandshakeMessage { + + /** + * Constructs a new HandshakeMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IHandshakeMessage); + + /** HandshakeMessage clientHello. */ + public clientHello?: (proto.HandshakeMessage.IClientHello|null); + + /** HandshakeMessage serverHello. */ + public serverHello?: (proto.HandshakeMessage.IServerHello|null); + + /** HandshakeMessage clientFinish. */ + public clientFinish?: (proto.HandshakeMessage.IClientFinish|null); + + /** + * Creates a new HandshakeMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns HandshakeMessage instance + */ + public static create(properties?: proto.IHandshakeMessage): proto.HandshakeMessage; + + /** + * Encodes the specified HandshakeMessage message. Does not implicitly {@link proto.HandshakeMessage.verify|verify} messages. + * @param message HandshakeMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IHandshakeMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HandshakeMessage message, length delimited. Does not implicitly {@link proto.HandshakeMessage.verify|verify} messages. + * @param message HandshakeMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IHandshakeMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HandshakeMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HandshakeMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HandshakeMessage; + + /** + * Decodes a HandshakeMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HandshakeMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HandshakeMessage; + + /** + * Verifies a HandshakeMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HandshakeMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HandshakeMessage + */ + public static fromObject(object: { [k: string]: any }): proto.HandshakeMessage; + + /** + * Creates a plain object from a HandshakeMessage message. Also converts values to other types if specified. + * @param message HandshakeMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HandshakeMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HandshakeMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HandshakeMessage { + + /** Properties of a ClientFinish. */ + interface IClientFinish { + + /** ClientFinish static */ + "static"?: (Uint8Array|null); + + /** ClientFinish payload */ + payload?: (Uint8Array|null); + } + + /** Represents a ClientFinish. */ + class ClientFinish implements IClientFinish { + + /** + * Constructs a new ClientFinish. + * @param [properties] Properties to set + */ + constructor(properties?: proto.HandshakeMessage.IClientFinish); + + /** ClientFinish static. */ + public static: Uint8Array; + + /** ClientFinish payload. */ + public payload: Uint8Array; + + /** + * Creates a new ClientFinish instance using the specified properties. + * @param [properties] Properties to set + * @returns ClientFinish instance + */ + public static create(properties?: proto.HandshakeMessage.IClientFinish): proto.HandshakeMessage.ClientFinish; + + /** + * Encodes the specified ClientFinish message. Does not implicitly {@link proto.HandshakeMessage.ClientFinish.verify|verify} messages. + * @param message ClientFinish message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.HandshakeMessage.IClientFinish, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClientFinish message, length delimited. Does not implicitly {@link proto.HandshakeMessage.ClientFinish.verify|verify} messages. + * @param message ClientFinish message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.HandshakeMessage.IClientFinish, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClientFinish message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClientFinish + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HandshakeMessage.ClientFinish; + + /** + * Decodes a ClientFinish message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClientFinish + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HandshakeMessage.ClientFinish; + + /** + * Verifies a ClientFinish message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClientFinish message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClientFinish + */ + public static fromObject(object: { [k: string]: any }): proto.HandshakeMessage.ClientFinish; + + /** + * Creates a plain object from a ClientFinish message. Also converts values to other types if specified. + * @param message ClientFinish + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HandshakeMessage.ClientFinish, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClientFinish to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ClientHello. */ + interface IClientHello { + + /** ClientHello ephemeral */ + ephemeral?: (Uint8Array|null); + + /** ClientHello static */ + "static"?: (Uint8Array|null); + + /** ClientHello payload */ + payload?: (Uint8Array|null); + } + + /** Represents a ClientHello. */ + class ClientHello implements IClientHello { + + /** + * Constructs a new ClientHello. + * @param [properties] Properties to set + */ + constructor(properties?: proto.HandshakeMessage.IClientHello); + + /** ClientHello ephemeral. */ + public ephemeral: Uint8Array; + + /** ClientHello static. */ + public static: Uint8Array; + + /** ClientHello payload. */ + public payload: Uint8Array; + + /** + * Creates a new ClientHello instance using the specified properties. + * @param [properties] Properties to set + * @returns ClientHello instance + */ + public static create(properties?: proto.HandshakeMessage.IClientHello): proto.HandshakeMessage.ClientHello; + + /** + * Encodes the specified ClientHello message. Does not implicitly {@link proto.HandshakeMessage.ClientHello.verify|verify} messages. + * @param message ClientHello message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.HandshakeMessage.IClientHello, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClientHello message, length delimited. Does not implicitly {@link proto.HandshakeMessage.ClientHello.verify|verify} messages. + * @param message ClientHello message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.HandshakeMessage.IClientHello, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClientHello message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClientHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HandshakeMessage.ClientHello; + + /** + * Decodes a ClientHello message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClientHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HandshakeMessage.ClientHello; + + /** + * Verifies a ClientHello message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClientHello message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClientHello + */ + public static fromObject(object: { [k: string]: any }): proto.HandshakeMessage.ClientHello; + + /** + * Creates a plain object from a ClientHello message. Also converts values to other types if specified. + * @param message ClientHello + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HandshakeMessage.ClientHello, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClientHello to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServerHello. */ + interface IServerHello { + + /** ServerHello ephemeral */ + ephemeral?: (Uint8Array|null); + + /** ServerHello static */ + "static"?: (Uint8Array|null); + + /** ServerHello payload */ + payload?: (Uint8Array|null); + } + + /** Represents a ServerHello. */ + class ServerHello implements IServerHello { + + /** + * Constructs a new ServerHello. + * @param [properties] Properties to set + */ + constructor(properties?: proto.HandshakeMessage.IServerHello); + + /** ServerHello ephemeral. */ + public ephemeral: Uint8Array; + + /** ServerHello static. */ + public static: Uint8Array; + + /** ServerHello payload. */ + public payload: Uint8Array; + + /** + * Creates a new ServerHello instance using the specified properties. + * @param [properties] Properties to set + * @returns ServerHello instance + */ + public static create(properties?: proto.HandshakeMessage.IServerHello): proto.HandshakeMessage.ServerHello; + + /** + * Encodes the specified ServerHello message. Does not implicitly {@link proto.HandshakeMessage.ServerHello.verify|verify} messages. + * @param message ServerHello message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.HandshakeMessage.IServerHello, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServerHello message, length delimited. Does not implicitly {@link proto.HandshakeMessage.ServerHello.verify|verify} messages. + * @param message ServerHello message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.HandshakeMessage.IServerHello, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServerHello message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServerHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HandshakeMessage.ServerHello; + + /** + * Decodes a ServerHello message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServerHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HandshakeMessage.ServerHello; + + /** + * Verifies a ServerHello message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServerHello message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServerHello + */ + public static fromObject(object: { [k: string]: any }): proto.HandshakeMessage.ServerHello; + + /** + * Creates a plain object from a ServerHello message. Also converts values to other types if specified. + * @param message ServerHello + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HandshakeMessage.ServerHello, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServerHello to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a HistorySync. */ + interface IHistorySync { + + /** HistorySync syncType */ + syncType: proto.HistorySync.HistorySyncType; + + /** HistorySync conversations */ + conversations?: (proto.IConversation[]|null); + + /** HistorySync statusV3Messages */ + statusV3Messages?: (proto.IWebMessageInfo[]|null); + + /** HistorySync chunkOrder */ + chunkOrder?: (number|null); + + /** HistorySync progress */ + progress?: (number|null); + + /** HistorySync pushnames */ + pushnames?: (proto.IPushname[]|null); + + /** HistorySync globalSettings */ + globalSettings?: (proto.IGlobalSettings|null); + + /** HistorySync threadIdUserSecret */ + threadIdUserSecret?: (Uint8Array|null); + + /** HistorySync threadDsTimeframeOffset */ + threadDsTimeframeOffset?: (number|null); + + /** HistorySync recentStickers */ + recentStickers?: (proto.IStickerMetadata[]|null); + + /** HistorySync pastParticipants */ + pastParticipants?: (proto.IPastParticipants[]|null); + } + + /** Represents a HistorySync. */ + class HistorySync implements IHistorySync { + + /** + * Constructs a new HistorySync. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IHistorySync); + + /** HistorySync syncType. */ + public syncType: proto.HistorySync.HistorySyncType; + + /** HistorySync conversations. */ + public conversations: proto.IConversation[]; + + /** HistorySync statusV3Messages. */ + public statusV3Messages: proto.IWebMessageInfo[]; + + /** HistorySync chunkOrder. */ + public chunkOrder: number; + + /** HistorySync progress. */ + public progress: number; + + /** HistorySync pushnames. */ + public pushnames: proto.IPushname[]; + + /** HistorySync globalSettings. */ + public globalSettings?: (proto.IGlobalSettings|null); + + /** HistorySync threadIdUserSecret. */ + public threadIdUserSecret: Uint8Array; + + /** HistorySync threadDsTimeframeOffset. */ + public threadDsTimeframeOffset: number; + + /** HistorySync recentStickers. */ + public recentStickers: proto.IStickerMetadata[]; + + /** HistorySync pastParticipants. */ + public pastParticipants: proto.IPastParticipants[]; + + /** + * Creates a new HistorySync instance using the specified properties. + * @param [properties] Properties to set + * @returns HistorySync instance + */ + public static create(properties?: proto.IHistorySync): proto.HistorySync; + + /** + * Encodes the specified HistorySync message. Does not implicitly {@link proto.HistorySync.verify|verify} messages. + * @param message HistorySync message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IHistorySync, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HistorySync message, length delimited. Does not implicitly {@link proto.HistorySync.verify|verify} messages. + * @param message HistorySync message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IHistorySync, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HistorySync message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HistorySync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HistorySync; + + /** + * Decodes a HistorySync message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HistorySync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HistorySync; + + /** + * Verifies a HistorySync message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HistorySync message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HistorySync + */ + public static fromObject(object: { [k: string]: any }): proto.HistorySync; + + /** + * Creates a plain object from a HistorySync message. Also converts values to other types if specified. + * @param message HistorySync + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HistorySync, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HistorySync to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HistorySync { + + /** HistorySyncType enum. */ + enum HistorySyncType { + INITIAL_BOOTSTRAP = 0, + INITIAL_STATUS_V3 = 1, + FULL = 2, + RECENT = 3, + PUSH_NAME = 4, + NON_BLOCKING_DATA = 5, + ON_DEMAND = 6 + } + } + + /** Properties of a HistorySyncMsg. */ + interface IHistorySyncMsg { + + /** HistorySyncMsg message */ + message?: (proto.IWebMessageInfo|null); + + /** HistorySyncMsg msgOrderId */ + msgOrderId?: (number|Long|null); + } + + /** Represents a HistorySyncMsg. */ + class HistorySyncMsg implements IHistorySyncMsg { + + /** + * Constructs a new HistorySyncMsg. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IHistorySyncMsg); + + /** HistorySyncMsg message. */ + public message?: (proto.IWebMessageInfo|null); + + /** HistorySyncMsg msgOrderId. */ + public msgOrderId: (number|Long); + + /** + * Creates a new HistorySyncMsg instance using the specified properties. + * @param [properties] Properties to set + * @returns HistorySyncMsg instance + */ + public static create(properties?: proto.IHistorySyncMsg): proto.HistorySyncMsg; + + /** + * Encodes the specified HistorySyncMsg message. Does not implicitly {@link proto.HistorySyncMsg.verify|verify} messages. + * @param message HistorySyncMsg message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IHistorySyncMsg, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HistorySyncMsg message, length delimited. Does not implicitly {@link proto.HistorySyncMsg.verify|verify} messages. + * @param message HistorySyncMsg message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IHistorySyncMsg, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HistorySyncMsg message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HistorySyncMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HistorySyncMsg; + + /** + * Decodes a HistorySyncMsg message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HistorySyncMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HistorySyncMsg; + + /** + * Verifies a HistorySyncMsg message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HistorySyncMsg message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HistorySyncMsg + */ + public static fromObject(object: { [k: string]: any }): proto.HistorySyncMsg; + + /** + * Creates a plain object from a HistorySyncMsg message. Also converts values to other types if specified. + * @param message HistorySyncMsg + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HistorySyncMsg, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HistorySyncMsg to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HydratedTemplateButton. */ + interface IHydratedTemplateButton { + + /** HydratedTemplateButton index */ + index?: (number|null); + + /** HydratedTemplateButton quickReplyButton */ + quickReplyButton?: (proto.HydratedTemplateButton.IHydratedQuickReplyButton|null); + + /** HydratedTemplateButton urlButton */ + urlButton?: (proto.HydratedTemplateButton.IHydratedURLButton|null); + + /** HydratedTemplateButton callButton */ + callButton?: (proto.HydratedTemplateButton.IHydratedCallButton|null); + } + + /** Represents a HydratedTemplateButton. */ + class HydratedTemplateButton implements IHydratedTemplateButton { + + /** + * Constructs a new HydratedTemplateButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IHydratedTemplateButton); + + /** HydratedTemplateButton index. */ + public index: number; + + /** HydratedTemplateButton quickReplyButton. */ + public quickReplyButton?: (proto.HydratedTemplateButton.IHydratedQuickReplyButton|null); + + /** HydratedTemplateButton urlButton. */ + public urlButton?: (proto.HydratedTemplateButton.IHydratedURLButton|null); + + /** HydratedTemplateButton callButton. */ + public callButton?: (proto.HydratedTemplateButton.IHydratedCallButton|null); + + /** HydratedTemplateButton hydratedButton. */ + public hydratedButton?: ("quickReplyButton"|"urlButton"|"callButton"); + + /** + * Creates a new HydratedTemplateButton instance using the specified properties. + * @param [properties] Properties to set + * @returns HydratedTemplateButton instance + */ + public static create(properties?: proto.IHydratedTemplateButton): proto.HydratedTemplateButton; + + /** + * Encodes the specified HydratedTemplateButton message. Does not implicitly {@link proto.HydratedTemplateButton.verify|verify} messages. + * @param message HydratedTemplateButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IHydratedTemplateButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HydratedTemplateButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.verify|verify} messages. + * @param message HydratedTemplateButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IHydratedTemplateButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HydratedTemplateButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HydratedTemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HydratedTemplateButton; + + /** + * Decodes a HydratedTemplateButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HydratedTemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HydratedTemplateButton; + + /** + * Verifies a HydratedTemplateButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HydratedTemplateButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HydratedTemplateButton + */ + public static fromObject(object: { [k: string]: any }): proto.HydratedTemplateButton; + + /** + * Creates a plain object from a HydratedTemplateButton message. Also converts values to other types if specified. + * @param message HydratedTemplateButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HydratedTemplateButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HydratedTemplateButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HydratedTemplateButton { + + /** Properties of a HydratedCallButton. */ + interface IHydratedCallButton { + + /** HydratedCallButton displayText */ + displayText?: (string|null); + + /** HydratedCallButton phoneNumber */ + phoneNumber?: (string|null); + } + + /** Represents a HydratedCallButton. */ + class HydratedCallButton implements IHydratedCallButton { + + /** + * Constructs a new HydratedCallButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.HydratedTemplateButton.IHydratedCallButton); + + /** HydratedCallButton displayText. */ + public displayText: string; + + /** HydratedCallButton phoneNumber. */ + public phoneNumber: string; + + /** + * Creates a new HydratedCallButton instance using the specified properties. + * @param [properties] Properties to set + * @returns HydratedCallButton instance + */ + public static create(properties?: proto.HydratedTemplateButton.IHydratedCallButton): proto.HydratedTemplateButton.HydratedCallButton; + + /** + * Encodes the specified HydratedCallButton message. Does not implicitly {@link proto.HydratedTemplateButton.HydratedCallButton.verify|verify} messages. + * @param message HydratedCallButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.HydratedTemplateButton.IHydratedCallButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HydratedCallButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.HydratedCallButton.verify|verify} messages. + * @param message HydratedCallButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.HydratedTemplateButton.IHydratedCallButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HydratedCallButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HydratedCallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HydratedTemplateButton.HydratedCallButton; + + /** + * Decodes a HydratedCallButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HydratedCallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HydratedTemplateButton.HydratedCallButton; + + /** + * Verifies a HydratedCallButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HydratedCallButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HydratedCallButton + */ + public static fromObject(object: { [k: string]: any }): proto.HydratedTemplateButton.HydratedCallButton; + + /** + * Creates a plain object from a HydratedCallButton message. Also converts values to other types if specified. + * @param message HydratedCallButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HydratedTemplateButton.HydratedCallButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HydratedCallButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HydratedQuickReplyButton. */ + interface IHydratedQuickReplyButton { + + /** HydratedQuickReplyButton displayText */ + displayText?: (string|null); + + /** HydratedQuickReplyButton id */ + id?: (string|null); + } + + /** Represents a HydratedQuickReplyButton. */ + class HydratedQuickReplyButton implements IHydratedQuickReplyButton { + + /** + * Constructs a new HydratedQuickReplyButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.HydratedTemplateButton.IHydratedQuickReplyButton); + + /** HydratedQuickReplyButton displayText. */ + public displayText: string; + + /** HydratedQuickReplyButton id. */ + public id: string; + + /** + * Creates a new HydratedQuickReplyButton instance using the specified properties. + * @param [properties] Properties to set + * @returns HydratedQuickReplyButton instance + */ + public static create(properties?: proto.HydratedTemplateButton.IHydratedQuickReplyButton): proto.HydratedTemplateButton.HydratedQuickReplyButton; + + /** + * Encodes the specified HydratedQuickReplyButton message. Does not implicitly {@link proto.HydratedTemplateButton.HydratedQuickReplyButton.verify|verify} messages. + * @param message HydratedQuickReplyButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.HydratedTemplateButton.IHydratedQuickReplyButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HydratedQuickReplyButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.HydratedQuickReplyButton.verify|verify} messages. + * @param message HydratedQuickReplyButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.HydratedTemplateButton.IHydratedQuickReplyButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HydratedQuickReplyButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HydratedQuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HydratedTemplateButton.HydratedQuickReplyButton; + + /** + * Decodes a HydratedQuickReplyButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HydratedQuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HydratedTemplateButton.HydratedQuickReplyButton; + + /** + * Verifies a HydratedQuickReplyButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HydratedQuickReplyButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HydratedQuickReplyButton + */ + public static fromObject(object: { [k: string]: any }): proto.HydratedTemplateButton.HydratedQuickReplyButton; + + /** + * Creates a plain object from a HydratedQuickReplyButton message. Also converts values to other types if specified. + * @param message HydratedQuickReplyButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HydratedTemplateButton.HydratedQuickReplyButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HydratedQuickReplyButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HydratedURLButton. */ + interface IHydratedURLButton { + + /** HydratedURLButton displayText */ + displayText?: (string|null); + + /** HydratedURLButton url */ + url?: (string|null); + } + + /** Represents a HydratedURLButton. */ + class HydratedURLButton implements IHydratedURLButton { + + /** + * Constructs a new HydratedURLButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.HydratedTemplateButton.IHydratedURLButton); + + /** HydratedURLButton displayText. */ + public displayText: string; + + /** HydratedURLButton url. */ + public url: string; + + /** + * Creates a new HydratedURLButton instance using the specified properties. + * @param [properties] Properties to set + * @returns HydratedURLButton instance + */ + public static create(properties?: proto.HydratedTemplateButton.IHydratedURLButton): proto.HydratedTemplateButton.HydratedURLButton; + + /** + * Encodes the specified HydratedURLButton message. Does not implicitly {@link proto.HydratedTemplateButton.HydratedURLButton.verify|verify} messages. + * @param message HydratedURLButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.HydratedTemplateButton.IHydratedURLButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HydratedURLButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.HydratedURLButton.verify|verify} messages. + * @param message HydratedURLButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.HydratedTemplateButton.IHydratedURLButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HydratedURLButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HydratedURLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.HydratedTemplateButton.HydratedURLButton; + + /** + * Decodes a HydratedURLButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HydratedURLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.HydratedTemplateButton.HydratedURLButton; + + /** + * Verifies a HydratedURLButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HydratedURLButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HydratedURLButton + */ + public static fromObject(object: { [k: string]: any }): proto.HydratedTemplateButton.HydratedURLButton; + + /** + * Creates a plain object from a HydratedURLButton message. Also converts values to other types if specified. + * @param message HydratedURLButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.HydratedTemplateButton.HydratedURLButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HydratedURLButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an IdentityKeyPairStructure. */ + interface IIdentityKeyPairStructure { + + /** IdentityKeyPairStructure publicKey */ + publicKey?: (Uint8Array|null); + + /** IdentityKeyPairStructure privateKey */ + privateKey?: (Uint8Array|null); + } + + /** Represents an IdentityKeyPairStructure. */ + class IdentityKeyPairStructure implements IIdentityKeyPairStructure { + + /** + * Constructs a new IdentityKeyPairStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IIdentityKeyPairStructure); + + /** IdentityKeyPairStructure publicKey. */ + public publicKey: Uint8Array; + + /** IdentityKeyPairStructure privateKey. */ + public privateKey: Uint8Array; + + /** + * Creates a new IdentityKeyPairStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns IdentityKeyPairStructure instance + */ + public static create(properties?: proto.IIdentityKeyPairStructure): proto.IdentityKeyPairStructure; + + /** + * Encodes the specified IdentityKeyPairStructure message. Does not implicitly {@link proto.IdentityKeyPairStructure.verify|verify} messages. + * @param message IdentityKeyPairStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IIdentityKeyPairStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IdentityKeyPairStructure message, length delimited. Does not implicitly {@link proto.IdentityKeyPairStructure.verify|verify} messages. + * @param message IdentityKeyPairStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IIdentityKeyPairStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IdentityKeyPairStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IdentityKeyPairStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.IdentityKeyPairStructure; + + /** + * Decodes an IdentityKeyPairStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IdentityKeyPairStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.IdentityKeyPairStructure; + + /** + * Verifies an IdentityKeyPairStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IdentityKeyPairStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IdentityKeyPairStructure + */ + public static fromObject(object: { [k: string]: any }): proto.IdentityKeyPairStructure; + + /** + * Creates a plain object from an IdentityKeyPairStructure message. Also converts values to other types if specified. + * @param message IdentityKeyPairStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.IdentityKeyPairStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IdentityKeyPairStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an InteractiveAnnotation. */ + interface IInteractiveAnnotation { + + /** InteractiveAnnotation polygonVertices */ + polygonVertices?: (proto.IPoint[]|null); + + /** InteractiveAnnotation location */ + location?: (proto.ILocation|null); + } + + /** Represents an InteractiveAnnotation. */ + class InteractiveAnnotation implements IInteractiveAnnotation { + + /** + * Constructs a new InteractiveAnnotation. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IInteractiveAnnotation); + + /** InteractiveAnnotation polygonVertices. */ + public polygonVertices: proto.IPoint[]; + + /** InteractiveAnnotation location. */ + public location?: (proto.ILocation|null); + + /** InteractiveAnnotation action. */ + public action?: "location"; + + /** + * Creates a new InteractiveAnnotation instance using the specified properties. + * @param [properties] Properties to set + * @returns InteractiveAnnotation instance + */ + public static create(properties?: proto.IInteractiveAnnotation): proto.InteractiveAnnotation; + + /** + * Encodes the specified InteractiveAnnotation message. Does not implicitly {@link proto.InteractiveAnnotation.verify|verify} messages. + * @param message InteractiveAnnotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IInteractiveAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InteractiveAnnotation message, length delimited. Does not implicitly {@link proto.InteractiveAnnotation.verify|verify} messages. + * @param message InteractiveAnnotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IInteractiveAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InteractiveAnnotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InteractiveAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.InteractiveAnnotation; + + /** + * Decodes an InteractiveAnnotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InteractiveAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.InteractiveAnnotation; + + /** + * Verifies an InteractiveAnnotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InteractiveAnnotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InteractiveAnnotation + */ + public static fromObject(object: { [k: string]: any }): proto.InteractiveAnnotation; + + /** + * Creates a plain object from an InteractiveAnnotation message. Also converts values to other types if specified. + * @param message InteractiveAnnotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.InteractiveAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InteractiveAnnotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a KeepInChat. */ + interface IKeepInChat { + + /** KeepInChat keepType */ + keepType?: (proto.KeepType|null); + + /** KeepInChat serverTimestamp */ + serverTimestamp?: (number|Long|null); + + /** KeepInChat key */ + key?: (proto.IMessageKey|null); + + /** KeepInChat deviceJid */ + deviceJid?: (string|null); + + /** KeepInChat clientTimestampMs */ + clientTimestampMs?: (number|Long|null); + + /** KeepInChat serverTimestampMs */ + serverTimestampMs?: (number|Long|null); + } + + /** Represents a KeepInChat. */ + class KeepInChat implements IKeepInChat { + + /** + * Constructs a new KeepInChat. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IKeepInChat); + + /** KeepInChat keepType. */ + public keepType: proto.KeepType; + + /** KeepInChat serverTimestamp. */ + public serverTimestamp: (number|Long); + + /** KeepInChat key. */ + public key?: (proto.IMessageKey|null); + + /** KeepInChat deviceJid. */ + public deviceJid: string; + + /** KeepInChat clientTimestampMs. */ + public clientTimestampMs: (number|Long); + + /** KeepInChat serverTimestampMs. */ + public serverTimestampMs: (number|Long); + + /** + * Creates a new KeepInChat instance using the specified properties. + * @param [properties] Properties to set + * @returns KeepInChat instance + */ + public static create(properties?: proto.IKeepInChat): proto.KeepInChat; + + /** + * Encodes the specified KeepInChat message. Does not implicitly {@link proto.KeepInChat.verify|verify} messages. + * @param message KeepInChat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IKeepInChat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeepInChat message, length delimited. Does not implicitly {@link proto.KeepInChat.verify|verify} messages. + * @param message KeepInChat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IKeepInChat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeepInChat message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeepInChat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.KeepInChat; + + /** + * Decodes a KeepInChat message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeepInChat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.KeepInChat; + + /** + * Verifies a KeepInChat message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeepInChat message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeepInChat + */ + public static fromObject(object: { [k: string]: any }): proto.KeepInChat; + + /** + * Creates a plain object from a KeepInChat message. Also converts values to other types if specified. + * @param message KeepInChat + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.KeepInChat, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeepInChat to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** KeepType enum. */ + enum KeepType { + UNKNOWN = 0, + KEEP_FOR_ALL = 1, + UNDO_KEEP_FOR_ALL = 2 + } + + /** Properties of a KeyId. */ + interface IKeyId { + + /** KeyId id */ + id?: (Uint8Array|null); + } + + /** Represents a KeyId. */ + class KeyId implements IKeyId { + + /** + * Constructs a new KeyId. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IKeyId); + + /** KeyId id. */ + public id: Uint8Array; + + /** + * Creates a new KeyId instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyId instance + */ + public static create(properties?: proto.IKeyId): proto.KeyId; + + /** + * Encodes the specified KeyId message. Does not implicitly {@link proto.KeyId.verify|verify} messages. + * @param message KeyId message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IKeyId, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeyId message, length delimited. Does not implicitly {@link proto.KeyId.verify|verify} messages. + * @param message KeyId message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IKeyId, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeyId message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.KeyId; + + /** + * Decodes a KeyId message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.KeyId; + + /** + * Verifies a KeyId message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeyId message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyId + */ + public static fromObject(object: { [k: string]: any }): proto.KeyId; + + /** + * Creates a plain object from a KeyId message. Also converts values to other types if specified. + * @param message KeyId + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.KeyId, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyId to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LocalizedName. */ + interface ILocalizedName { + + /** LocalizedName lg */ + lg?: (string|null); + + /** LocalizedName lc */ + lc?: (string|null); + + /** LocalizedName verifiedName */ + verifiedName?: (string|null); + } + + /** Represents a LocalizedName. */ + class LocalizedName implements ILocalizedName { + + /** + * Constructs a new LocalizedName. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ILocalizedName); + + /** LocalizedName lg. */ + public lg: string; + + /** LocalizedName lc. */ + public lc: string; + + /** LocalizedName verifiedName. */ + public verifiedName: string; + + /** + * Creates a new LocalizedName instance using the specified properties. + * @param [properties] Properties to set + * @returns LocalizedName instance + */ + public static create(properties?: proto.ILocalizedName): proto.LocalizedName; + + /** + * Encodes the specified LocalizedName message. Does not implicitly {@link proto.LocalizedName.verify|verify} messages. + * @param message LocalizedName message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ILocalizedName, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocalizedName message, length delimited. Does not implicitly {@link proto.LocalizedName.verify|verify} messages. + * @param message LocalizedName message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ILocalizedName, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocalizedName message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocalizedName + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.LocalizedName; + + /** + * Decodes a LocalizedName message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocalizedName + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.LocalizedName; + + /** + * Verifies a LocalizedName message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocalizedName message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocalizedName + */ + public static fromObject(object: { [k: string]: any }): proto.LocalizedName; + + /** + * Creates a plain object from a LocalizedName message. Also converts values to other types if specified. + * @param message LocalizedName + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.LocalizedName, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocalizedName to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Location. */ + interface ILocation { + + /** Location degreesLatitude */ + degreesLatitude?: (number|null); + + /** Location degreesLongitude */ + degreesLongitude?: (number|null); + + /** Location name */ + name?: (string|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ILocation); + + /** Location degreesLatitude. */ + public degreesLatitude: number; + + /** Location degreesLongitude. */ + public degreesLongitude: number; + + /** Location name. */ + public name: string; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: proto.ILocation): proto.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link proto.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link proto.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): proto.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MediaData. */ + interface IMediaData { + + /** MediaData localPath */ + localPath?: (string|null); + } + + /** Represents a MediaData. */ + class MediaData implements IMediaData { + + /** + * Constructs a new MediaData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMediaData); + + /** MediaData localPath. */ + public localPath: string; + + /** + * Creates a new MediaData instance using the specified properties. + * @param [properties] Properties to set + * @returns MediaData instance + */ + public static create(properties?: proto.IMediaData): proto.MediaData; + + /** + * Encodes the specified MediaData message. Does not implicitly {@link proto.MediaData.verify|verify} messages. + * @param message MediaData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMediaData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MediaData message, length delimited. Does not implicitly {@link proto.MediaData.verify|verify} messages. + * @param message MediaData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMediaData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MediaData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MediaData; + + /** + * Decodes a MediaData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MediaData; + + /** + * Verifies a MediaData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MediaData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MediaData + */ + public static fromObject(object: { [k: string]: any }): proto.MediaData; + + /** + * Creates a plain object from a MediaData message. Also converts values to other types if specified. + * @param message MediaData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MediaData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MediaData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MediaRetryNotification. */ + interface IMediaRetryNotification { + + /** MediaRetryNotification stanzaId */ + stanzaId?: (string|null); + + /** MediaRetryNotification directPath */ + directPath?: (string|null); + + /** MediaRetryNotification result */ + result?: (proto.MediaRetryNotification.ResultType|null); + } + + /** Represents a MediaRetryNotification. */ + class MediaRetryNotification implements IMediaRetryNotification { + + /** + * Constructs a new MediaRetryNotification. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMediaRetryNotification); + + /** MediaRetryNotification stanzaId. */ + public stanzaId: string; + + /** MediaRetryNotification directPath. */ + public directPath: string; + + /** MediaRetryNotification result. */ + public result: proto.MediaRetryNotification.ResultType; + + /** + * Creates a new MediaRetryNotification instance using the specified properties. + * @param [properties] Properties to set + * @returns MediaRetryNotification instance + */ + public static create(properties?: proto.IMediaRetryNotification): proto.MediaRetryNotification; + + /** + * Encodes the specified MediaRetryNotification message. Does not implicitly {@link proto.MediaRetryNotification.verify|verify} messages. + * @param message MediaRetryNotification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMediaRetryNotification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MediaRetryNotification message, length delimited. Does not implicitly {@link proto.MediaRetryNotification.verify|verify} messages. + * @param message MediaRetryNotification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMediaRetryNotification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MediaRetryNotification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MediaRetryNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MediaRetryNotification; + + /** + * Decodes a MediaRetryNotification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MediaRetryNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MediaRetryNotification; + + /** + * Verifies a MediaRetryNotification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MediaRetryNotification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MediaRetryNotification + */ + public static fromObject(object: { [k: string]: any }): proto.MediaRetryNotification; + + /** + * Creates a plain object from a MediaRetryNotification message. Also converts values to other types if specified. + * @param message MediaRetryNotification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MediaRetryNotification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MediaRetryNotification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace MediaRetryNotification { + + /** ResultType enum. */ + enum ResultType { + GENERAL_ERROR = 0, + SUCCESS = 1, + NOT_FOUND = 2, + DECRYPTION_ERROR = 3 + } + } + + /** MediaVisibility enum. */ + enum MediaVisibility { + DEFAULT = 0, + OFF = 1, + ON = 2 + } + + /** Properties of a Message. */ + interface IMessage { + + /** Message conversation */ + conversation?: (string|null); + + /** Message senderKeyDistributionMessage */ + senderKeyDistributionMessage?: (proto.Message.ISenderKeyDistributionMessage|null); + + /** Message imageMessage */ + imageMessage?: (proto.Message.IImageMessage|null); + + /** Message contactMessage */ + contactMessage?: (proto.Message.IContactMessage|null); + + /** Message locationMessage */ + locationMessage?: (proto.Message.ILocationMessage|null); + + /** Message extendedTextMessage */ + extendedTextMessage?: (proto.Message.IExtendedTextMessage|null); + + /** Message documentMessage */ + documentMessage?: (proto.Message.IDocumentMessage|null); + + /** Message audioMessage */ + audioMessage?: (proto.Message.IAudioMessage|null); + + /** Message videoMessage */ + videoMessage?: (proto.Message.IVideoMessage|null); + + /** Message call */ + call?: (proto.Message.ICall|null); + + /** Message chat */ + chat?: (proto.Message.IChat|null); + + /** Message protocolMessage */ + protocolMessage?: (proto.Message.IProtocolMessage|null); + + /** Message contactsArrayMessage */ + contactsArrayMessage?: (proto.Message.IContactsArrayMessage|null); + + /** Message highlyStructuredMessage */ + highlyStructuredMessage?: (proto.Message.IHighlyStructuredMessage|null); + + /** Message fastRatchetKeySenderKeyDistributionMessage */ + fastRatchetKeySenderKeyDistributionMessage?: (proto.Message.ISenderKeyDistributionMessage|null); + + /** Message sendPaymentMessage */ + sendPaymentMessage?: (proto.Message.ISendPaymentMessage|null); + + /** Message liveLocationMessage */ + liveLocationMessage?: (proto.Message.ILiveLocationMessage|null); + + /** Message requestPaymentMessage */ + requestPaymentMessage?: (proto.Message.IRequestPaymentMessage|null); + + /** Message declinePaymentRequestMessage */ + declinePaymentRequestMessage?: (proto.Message.IDeclinePaymentRequestMessage|null); + + /** Message cancelPaymentRequestMessage */ + cancelPaymentRequestMessage?: (proto.Message.ICancelPaymentRequestMessage|null); + + /** Message templateMessage */ + templateMessage?: (proto.Message.ITemplateMessage|null); + + /** Message stickerMessage */ + stickerMessage?: (proto.Message.IStickerMessage|null); + + /** Message groupInviteMessage */ + groupInviteMessage?: (proto.Message.IGroupInviteMessage|null); + + /** Message templateButtonReplyMessage */ + templateButtonReplyMessage?: (proto.Message.ITemplateButtonReplyMessage|null); + + /** Message productMessage */ + productMessage?: (proto.Message.IProductMessage|null); + + /** Message deviceSentMessage */ + deviceSentMessage?: (proto.Message.IDeviceSentMessage|null); + + /** Message messageContextInfo */ + messageContextInfo?: (proto.IMessageContextInfo|null); + + /** Message listMessage */ + listMessage?: (proto.Message.IListMessage|null); + + /** Message viewOnceMessage */ + viewOnceMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message orderMessage */ + orderMessage?: (proto.Message.IOrderMessage|null); + + /** Message listResponseMessage */ + listResponseMessage?: (proto.Message.IListResponseMessage|null); + + /** Message ephemeralMessage */ + ephemeralMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message invoiceMessage */ + invoiceMessage?: (proto.Message.IInvoiceMessage|null); + + /** Message buttonsMessage */ + buttonsMessage?: (proto.Message.IButtonsMessage|null); + + /** Message buttonsResponseMessage */ + buttonsResponseMessage?: (proto.Message.IButtonsResponseMessage|null); + + /** Message paymentInviteMessage */ + paymentInviteMessage?: (proto.Message.IPaymentInviteMessage|null); + + /** Message interactiveMessage */ + interactiveMessage?: (proto.Message.IInteractiveMessage|null); + + /** Message reactionMessage */ + reactionMessage?: (proto.Message.IReactionMessage|null); + + /** Message stickerSyncRmrMessage */ + stickerSyncRmrMessage?: (proto.Message.IStickerSyncRMRMessage|null); + + /** Message interactiveResponseMessage */ + interactiveResponseMessage?: (proto.Message.IInteractiveResponseMessage|null); + + /** Message pollCreationMessage */ + pollCreationMessage?: (proto.Message.IPollCreationMessage|null); + + /** Message pollUpdateMessage */ + pollUpdateMessage?: (proto.Message.IPollUpdateMessage|null); + + /** Message keepInChatMessage */ + keepInChatMessage?: (proto.Message.IKeepInChatMessage|null); + + /** Message documentWithCaptionMessage */ + documentWithCaptionMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message requestPhoneNumberMessage */ + requestPhoneNumberMessage?: (proto.Message.IRequestPhoneNumberMessage|null); + + /** Message viewOnceMessageV2 */ + viewOnceMessageV2?: (proto.Message.IFutureProofMessage|null); + + /** Message encReactionMessage */ + encReactionMessage?: (proto.Message.IEncReactionMessage|null); + + /** Message editedMessage */ + editedMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message viewOnceMessageV2Extension */ + viewOnceMessageV2Extension?: (proto.Message.IFutureProofMessage|null); + + /** Message pollCreationMessageV2 */ + pollCreationMessageV2?: (proto.Message.IPollCreationMessage|null); + + /** Message scheduledCallCreationMessage */ + scheduledCallCreationMessage?: (proto.Message.IScheduledCallCreationMessage|null); + + /** Message groupMentionedMessage */ + groupMentionedMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message pinMessage */ + pinMessage?: (proto.Message.IPinMessage|null); + + /** Message pollCreationMessageV3 */ + pollCreationMessageV3?: (proto.Message.IPollCreationMessage|null); + + /** Message scheduledCallEditMessage */ + scheduledCallEditMessage?: (proto.Message.IScheduledCallEditMessage|null); + + /** Message ptvMessage */ + ptvMessage?: (proto.Message.IVideoMessage|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMessage); + + /** Message conversation. */ + public conversation: string; + + /** Message senderKeyDistributionMessage. */ + public senderKeyDistributionMessage?: (proto.Message.ISenderKeyDistributionMessage|null); + + /** Message imageMessage. */ + public imageMessage?: (proto.Message.IImageMessage|null); + + /** Message contactMessage. */ + public contactMessage?: (proto.Message.IContactMessage|null); + + /** Message locationMessage. */ + public locationMessage?: (proto.Message.ILocationMessage|null); + + /** Message extendedTextMessage. */ + public extendedTextMessage?: (proto.Message.IExtendedTextMessage|null); + + /** Message documentMessage. */ + public documentMessage?: (proto.Message.IDocumentMessage|null); + + /** Message audioMessage. */ + public audioMessage?: (proto.Message.IAudioMessage|null); + + /** Message videoMessage. */ + public videoMessage?: (proto.Message.IVideoMessage|null); + + /** Message call. */ + public call?: (proto.Message.ICall|null); + + /** Message chat. */ + public chat?: (proto.Message.IChat|null); + + /** Message protocolMessage. */ + public protocolMessage?: (proto.Message.IProtocolMessage|null); + + /** Message contactsArrayMessage. */ + public contactsArrayMessage?: (proto.Message.IContactsArrayMessage|null); + + /** Message highlyStructuredMessage. */ + public highlyStructuredMessage?: (proto.Message.IHighlyStructuredMessage|null); + + /** Message fastRatchetKeySenderKeyDistributionMessage. */ + public fastRatchetKeySenderKeyDistributionMessage?: (proto.Message.ISenderKeyDistributionMessage|null); + + /** Message sendPaymentMessage. */ + public sendPaymentMessage?: (proto.Message.ISendPaymentMessage|null); + + /** Message liveLocationMessage. */ + public liveLocationMessage?: (proto.Message.ILiveLocationMessage|null); + + /** Message requestPaymentMessage. */ + public requestPaymentMessage?: (proto.Message.IRequestPaymentMessage|null); + + /** Message declinePaymentRequestMessage. */ + public declinePaymentRequestMessage?: (proto.Message.IDeclinePaymentRequestMessage|null); + + /** Message cancelPaymentRequestMessage. */ + public cancelPaymentRequestMessage?: (proto.Message.ICancelPaymentRequestMessage|null); + + /** Message templateMessage. */ + public templateMessage?: (proto.Message.ITemplateMessage|null); + + /** Message stickerMessage. */ + public stickerMessage?: (proto.Message.IStickerMessage|null); + + /** Message groupInviteMessage. */ + public groupInviteMessage?: (proto.Message.IGroupInviteMessage|null); + + /** Message templateButtonReplyMessage. */ + public templateButtonReplyMessage?: (proto.Message.ITemplateButtonReplyMessage|null); + + /** Message productMessage. */ + public productMessage?: (proto.Message.IProductMessage|null); + + /** Message deviceSentMessage. */ + public deviceSentMessage?: (proto.Message.IDeviceSentMessage|null); + + /** Message messageContextInfo. */ + public messageContextInfo?: (proto.IMessageContextInfo|null); + + /** Message listMessage. */ + public listMessage?: (proto.Message.IListMessage|null); + + /** Message viewOnceMessage. */ + public viewOnceMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message orderMessage. */ + public orderMessage?: (proto.Message.IOrderMessage|null); + + /** Message listResponseMessage. */ + public listResponseMessage?: (proto.Message.IListResponseMessage|null); + + /** Message ephemeralMessage. */ + public ephemeralMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message invoiceMessage. */ + public invoiceMessage?: (proto.Message.IInvoiceMessage|null); + + /** Message buttonsMessage. */ + public buttonsMessage?: (proto.Message.IButtonsMessage|null); + + /** Message buttonsResponseMessage. */ + public buttonsResponseMessage?: (proto.Message.IButtonsResponseMessage|null); + + /** Message paymentInviteMessage. */ + public paymentInviteMessage?: (proto.Message.IPaymentInviteMessage|null); + + /** Message interactiveMessage. */ + public interactiveMessage?: (proto.Message.IInteractiveMessage|null); + + /** Message reactionMessage. */ + public reactionMessage?: (proto.Message.IReactionMessage|null); + + /** Message stickerSyncRmrMessage. */ + public stickerSyncRmrMessage?: (proto.Message.IStickerSyncRMRMessage|null); + + /** Message interactiveResponseMessage. */ + public interactiveResponseMessage?: (proto.Message.IInteractiveResponseMessage|null); + + /** Message pollCreationMessage. */ + public pollCreationMessage?: (proto.Message.IPollCreationMessage|null); + + /** Message pollUpdateMessage. */ + public pollUpdateMessage?: (proto.Message.IPollUpdateMessage|null); + + /** Message keepInChatMessage. */ + public keepInChatMessage?: (proto.Message.IKeepInChatMessage|null); + + /** Message documentWithCaptionMessage. */ + public documentWithCaptionMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message requestPhoneNumberMessage. */ + public requestPhoneNumberMessage?: (proto.Message.IRequestPhoneNumberMessage|null); + + /** Message viewOnceMessageV2. */ + public viewOnceMessageV2?: (proto.Message.IFutureProofMessage|null); + + /** Message encReactionMessage. */ + public encReactionMessage?: (proto.Message.IEncReactionMessage|null); + + /** Message editedMessage. */ + public editedMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message viewOnceMessageV2Extension. */ + public viewOnceMessageV2Extension?: (proto.Message.IFutureProofMessage|null); + + /** Message pollCreationMessageV2. */ + public pollCreationMessageV2?: (proto.Message.IPollCreationMessage|null); + + /** Message scheduledCallCreationMessage. */ + public scheduledCallCreationMessage?: (proto.Message.IScheduledCallCreationMessage|null); + + /** Message groupMentionedMessage. */ + public groupMentionedMessage?: (proto.Message.IFutureProofMessage|null); + + /** Message pinMessage. */ + public pinMessage?: (proto.Message.IPinMessage|null); + + /** Message pollCreationMessageV3. */ + public pollCreationMessageV3?: (proto.Message.IPollCreationMessage|null); + + /** Message scheduledCallEditMessage. */ + public scheduledCallEditMessage?: (proto.Message.IScheduledCallEditMessage|null); + + /** Message ptvMessage. */ + public ptvMessage?: (proto.Message.IVideoMessage|null); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: proto.IMessage): proto.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link proto.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link proto.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): proto.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Message { + + /** Properties of an AppStateFatalExceptionNotification. */ + interface IAppStateFatalExceptionNotification { + + /** AppStateFatalExceptionNotification collectionNames */ + collectionNames?: (string[]|null); + + /** AppStateFatalExceptionNotification timestamp */ + timestamp?: (number|Long|null); + } + + /** Represents an AppStateFatalExceptionNotification. */ + class AppStateFatalExceptionNotification implements IAppStateFatalExceptionNotification { + + /** + * Constructs a new AppStateFatalExceptionNotification. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateFatalExceptionNotification); + + /** AppStateFatalExceptionNotification collectionNames. */ + public collectionNames: string[]; + + /** AppStateFatalExceptionNotification timestamp. */ + public timestamp: (number|Long); + + /** + * Creates a new AppStateFatalExceptionNotification instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateFatalExceptionNotification instance + */ + public static create(properties?: proto.Message.IAppStateFatalExceptionNotification): proto.Message.AppStateFatalExceptionNotification; + + /** + * Encodes the specified AppStateFatalExceptionNotification message. Does not implicitly {@link proto.Message.AppStateFatalExceptionNotification.verify|verify} messages. + * @param message AppStateFatalExceptionNotification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateFatalExceptionNotification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateFatalExceptionNotification message, length delimited. Does not implicitly {@link proto.Message.AppStateFatalExceptionNotification.verify|verify} messages. + * @param message AppStateFatalExceptionNotification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateFatalExceptionNotification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateFatalExceptionNotification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateFatalExceptionNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateFatalExceptionNotification; + + /** + * Decodes an AppStateFatalExceptionNotification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateFatalExceptionNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateFatalExceptionNotification; + + /** + * Verifies an AppStateFatalExceptionNotification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateFatalExceptionNotification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateFatalExceptionNotification + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateFatalExceptionNotification; + + /** + * Creates a plain object from an AppStateFatalExceptionNotification message. Also converts values to other types if specified. + * @param message AppStateFatalExceptionNotification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateFatalExceptionNotification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateFatalExceptionNotification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AppStateSyncKey. */ + interface IAppStateSyncKey { + + /** AppStateSyncKey keyId */ + keyId?: (proto.Message.IAppStateSyncKeyId|null); + + /** AppStateSyncKey keyData */ + keyData?: (proto.Message.IAppStateSyncKeyData|null); + } + + /** Represents an AppStateSyncKey. */ + class AppStateSyncKey implements IAppStateSyncKey { + + /** + * Constructs a new AppStateSyncKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateSyncKey); + + /** AppStateSyncKey keyId. */ + public keyId?: (proto.Message.IAppStateSyncKeyId|null); + + /** AppStateSyncKey keyData. */ + public keyData?: (proto.Message.IAppStateSyncKeyData|null); + + /** + * Creates a new AppStateSyncKey instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateSyncKey instance + */ + public static create(properties?: proto.Message.IAppStateSyncKey): proto.Message.AppStateSyncKey; + + /** + * Encodes the specified AppStateSyncKey message. Does not implicitly {@link proto.Message.AppStateSyncKey.verify|verify} messages. + * @param message AppStateSyncKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateSyncKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateSyncKey message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKey.verify|verify} messages. + * @param message AppStateSyncKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateSyncKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateSyncKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateSyncKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateSyncKey; + + /** + * Decodes an AppStateSyncKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateSyncKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateSyncKey; + + /** + * Verifies an AppStateSyncKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateSyncKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateSyncKey + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateSyncKey; + + /** + * Creates a plain object from an AppStateSyncKey message. Also converts values to other types if specified. + * @param message AppStateSyncKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateSyncKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateSyncKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AppStateSyncKeyData. */ + interface IAppStateSyncKeyData { + + /** AppStateSyncKeyData keyData */ + keyData?: (Uint8Array|null); + + /** AppStateSyncKeyData fingerprint */ + fingerprint?: (proto.Message.IAppStateSyncKeyFingerprint|null); + + /** AppStateSyncKeyData timestamp */ + timestamp?: (number|Long|null); + } + + /** Represents an AppStateSyncKeyData. */ + class AppStateSyncKeyData implements IAppStateSyncKeyData { + + /** + * Constructs a new AppStateSyncKeyData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateSyncKeyData); + + /** AppStateSyncKeyData keyData. */ + public keyData: Uint8Array; + + /** AppStateSyncKeyData fingerprint. */ + public fingerprint?: (proto.Message.IAppStateSyncKeyFingerprint|null); + + /** AppStateSyncKeyData timestamp. */ + public timestamp: (number|Long); + + /** + * Creates a new AppStateSyncKeyData instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateSyncKeyData instance + */ + public static create(properties?: proto.Message.IAppStateSyncKeyData): proto.Message.AppStateSyncKeyData; + + /** + * Encodes the specified AppStateSyncKeyData message. Does not implicitly {@link proto.Message.AppStateSyncKeyData.verify|verify} messages. + * @param message AppStateSyncKeyData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateSyncKeyData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateSyncKeyData message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyData.verify|verify} messages. + * @param message AppStateSyncKeyData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateSyncKeyData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateSyncKeyData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateSyncKeyData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateSyncKeyData; + + /** + * Decodes an AppStateSyncKeyData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateSyncKeyData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateSyncKeyData; + + /** + * Verifies an AppStateSyncKeyData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateSyncKeyData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateSyncKeyData + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateSyncKeyData; + + /** + * Creates a plain object from an AppStateSyncKeyData message. Also converts values to other types if specified. + * @param message AppStateSyncKeyData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateSyncKeyData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateSyncKeyData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AppStateSyncKeyFingerprint. */ + interface IAppStateSyncKeyFingerprint { + + /** AppStateSyncKeyFingerprint rawId */ + rawId?: (number|null); + + /** AppStateSyncKeyFingerprint currentIndex */ + currentIndex?: (number|null); + + /** AppStateSyncKeyFingerprint deviceIndexes */ + deviceIndexes?: (number[]|null); + } + + /** Represents an AppStateSyncKeyFingerprint. */ + class AppStateSyncKeyFingerprint implements IAppStateSyncKeyFingerprint { + + /** + * Constructs a new AppStateSyncKeyFingerprint. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateSyncKeyFingerprint); + + /** AppStateSyncKeyFingerprint rawId. */ + public rawId: number; + + /** AppStateSyncKeyFingerprint currentIndex. */ + public currentIndex: number; + + /** AppStateSyncKeyFingerprint deviceIndexes. */ + public deviceIndexes: number[]; + + /** + * Creates a new AppStateSyncKeyFingerprint instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateSyncKeyFingerprint instance + */ + public static create(properties?: proto.Message.IAppStateSyncKeyFingerprint): proto.Message.AppStateSyncKeyFingerprint; + + /** + * Encodes the specified AppStateSyncKeyFingerprint message. Does not implicitly {@link proto.Message.AppStateSyncKeyFingerprint.verify|verify} messages. + * @param message AppStateSyncKeyFingerprint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateSyncKeyFingerprint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateSyncKeyFingerprint message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyFingerprint.verify|verify} messages. + * @param message AppStateSyncKeyFingerprint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateSyncKeyFingerprint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateSyncKeyFingerprint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateSyncKeyFingerprint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateSyncKeyFingerprint; + + /** + * Decodes an AppStateSyncKeyFingerprint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateSyncKeyFingerprint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateSyncKeyFingerprint; + + /** + * Verifies an AppStateSyncKeyFingerprint message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateSyncKeyFingerprint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateSyncKeyFingerprint + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateSyncKeyFingerprint; + + /** + * Creates a plain object from an AppStateSyncKeyFingerprint message. Also converts values to other types if specified. + * @param message AppStateSyncKeyFingerprint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateSyncKeyFingerprint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateSyncKeyFingerprint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AppStateSyncKeyId. */ + interface IAppStateSyncKeyId { + + /** AppStateSyncKeyId keyId */ + keyId?: (Uint8Array|null); + } + + /** Represents an AppStateSyncKeyId. */ + class AppStateSyncKeyId implements IAppStateSyncKeyId { + + /** + * Constructs a new AppStateSyncKeyId. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateSyncKeyId); + + /** AppStateSyncKeyId keyId. */ + public keyId: Uint8Array; + + /** + * Creates a new AppStateSyncKeyId instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateSyncKeyId instance + */ + public static create(properties?: proto.Message.IAppStateSyncKeyId): proto.Message.AppStateSyncKeyId; + + /** + * Encodes the specified AppStateSyncKeyId message. Does not implicitly {@link proto.Message.AppStateSyncKeyId.verify|verify} messages. + * @param message AppStateSyncKeyId message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateSyncKeyId, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateSyncKeyId message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyId.verify|verify} messages. + * @param message AppStateSyncKeyId message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateSyncKeyId, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateSyncKeyId message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateSyncKeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateSyncKeyId; + + /** + * Decodes an AppStateSyncKeyId message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateSyncKeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateSyncKeyId; + + /** + * Verifies an AppStateSyncKeyId message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateSyncKeyId message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateSyncKeyId + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateSyncKeyId; + + /** + * Creates a plain object from an AppStateSyncKeyId message. Also converts values to other types if specified. + * @param message AppStateSyncKeyId + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateSyncKeyId, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateSyncKeyId to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AppStateSyncKeyRequest. */ + interface IAppStateSyncKeyRequest { + + /** AppStateSyncKeyRequest keyIds */ + keyIds?: (proto.Message.IAppStateSyncKeyId[]|null); + } + + /** Represents an AppStateSyncKeyRequest. */ + class AppStateSyncKeyRequest implements IAppStateSyncKeyRequest { + + /** + * Constructs a new AppStateSyncKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateSyncKeyRequest); + + /** AppStateSyncKeyRequest keyIds. */ + public keyIds: proto.Message.IAppStateSyncKeyId[]; + + /** + * Creates a new AppStateSyncKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateSyncKeyRequest instance + */ + public static create(properties?: proto.Message.IAppStateSyncKeyRequest): proto.Message.AppStateSyncKeyRequest; + + /** + * Encodes the specified AppStateSyncKeyRequest message. Does not implicitly {@link proto.Message.AppStateSyncKeyRequest.verify|verify} messages. + * @param message AppStateSyncKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateSyncKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateSyncKeyRequest message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyRequest.verify|verify} messages. + * @param message AppStateSyncKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateSyncKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateSyncKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateSyncKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateSyncKeyRequest; + + /** + * Decodes an AppStateSyncKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateSyncKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateSyncKeyRequest; + + /** + * Verifies an AppStateSyncKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateSyncKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateSyncKeyRequest + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateSyncKeyRequest; + + /** + * Creates a plain object from an AppStateSyncKeyRequest message. Also converts values to other types if specified. + * @param message AppStateSyncKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateSyncKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateSyncKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AppStateSyncKeyShare. */ + interface IAppStateSyncKeyShare { + + /** AppStateSyncKeyShare keys */ + keys?: (proto.Message.IAppStateSyncKey[]|null); + } + + /** Represents an AppStateSyncKeyShare. */ + class AppStateSyncKeyShare implements IAppStateSyncKeyShare { + + /** + * Constructs a new AppStateSyncKeyShare. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAppStateSyncKeyShare); + + /** AppStateSyncKeyShare keys. */ + public keys: proto.Message.IAppStateSyncKey[]; + + /** + * Creates a new AppStateSyncKeyShare instance using the specified properties. + * @param [properties] Properties to set + * @returns AppStateSyncKeyShare instance + */ + public static create(properties?: proto.Message.IAppStateSyncKeyShare): proto.Message.AppStateSyncKeyShare; + + /** + * Encodes the specified AppStateSyncKeyShare message. Does not implicitly {@link proto.Message.AppStateSyncKeyShare.verify|verify} messages. + * @param message AppStateSyncKeyShare message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAppStateSyncKeyShare, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppStateSyncKeyShare message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyShare.verify|verify} messages. + * @param message AppStateSyncKeyShare message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAppStateSyncKeyShare, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppStateSyncKeyShare message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppStateSyncKeyShare + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AppStateSyncKeyShare; + + /** + * Decodes an AppStateSyncKeyShare message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppStateSyncKeyShare + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AppStateSyncKeyShare; + + /** + * Verifies an AppStateSyncKeyShare message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AppStateSyncKeyShare message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppStateSyncKeyShare + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AppStateSyncKeyShare; + + /** + * Creates a plain object from an AppStateSyncKeyShare message. Also converts values to other types if specified. + * @param message AppStateSyncKeyShare + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AppStateSyncKeyShare, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppStateSyncKeyShare to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AudioMessage. */ + interface IAudioMessage { + + /** AudioMessage url */ + url?: (string|null); + + /** AudioMessage mimetype */ + mimetype?: (string|null); + + /** AudioMessage fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** AudioMessage fileLength */ + fileLength?: (number|Long|null); + + /** AudioMessage seconds */ + seconds?: (number|null); + + /** AudioMessage ptt */ + ptt?: (boolean|null); + + /** AudioMessage mediaKey */ + mediaKey?: (Uint8Array|null); + + /** AudioMessage fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** AudioMessage directPath */ + directPath?: (string|null); + + /** AudioMessage mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** AudioMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** AudioMessage streamingSidecar */ + streamingSidecar?: (Uint8Array|null); + + /** AudioMessage waveform */ + waveform?: (Uint8Array|null); + + /** AudioMessage backgroundArgb */ + backgroundArgb?: (number|null); + + /** AudioMessage viewOnce */ + viewOnce?: (boolean|null); + } + + /** Represents an AudioMessage. */ + class AudioMessage implements IAudioMessage { + + /** + * Constructs a new AudioMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IAudioMessage); + + /** AudioMessage url. */ + public url: string; + + /** AudioMessage mimetype. */ + public mimetype: string; + + /** AudioMessage fileSha256. */ + public fileSha256: Uint8Array; + + /** AudioMessage fileLength. */ + public fileLength: (number|Long); + + /** AudioMessage seconds. */ + public seconds: number; + + /** AudioMessage ptt. */ + public ptt: boolean; + + /** AudioMessage mediaKey. */ + public mediaKey: Uint8Array; + + /** AudioMessage fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** AudioMessage directPath. */ + public directPath: string; + + /** AudioMessage mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** AudioMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** AudioMessage streamingSidecar. */ + public streamingSidecar: Uint8Array; + + /** AudioMessage waveform. */ + public waveform: Uint8Array; + + /** AudioMessage backgroundArgb. */ + public backgroundArgb: number; + + /** AudioMessage viewOnce. */ + public viewOnce: boolean; + + /** + * Creates a new AudioMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns AudioMessage instance + */ + public static create(properties?: proto.Message.IAudioMessage): proto.Message.AudioMessage; + + /** + * Encodes the specified AudioMessage message. Does not implicitly {@link proto.Message.AudioMessage.verify|verify} messages. + * @param message AudioMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IAudioMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AudioMessage message, length delimited. Does not implicitly {@link proto.Message.AudioMessage.verify|verify} messages. + * @param message AudioMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IAudioMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AudioMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AudioMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.AudioMessage; + + /** + * Decodes an AudioMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AudioMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.AudioMessage; + + /** + * Verifies an AudioMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AudioMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AudioMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.AudioMessage; + + /** + * Creates a plain object from an AudioMessage message. Also converts values to other types if specified. + * @param message AudioMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.AudioMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AudioMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ButtonsMessage. */ + interface IButtonsMessage { + + /** ButtonsMessage contentText */ + contentText?: (string|null); + + /** ButtonsMessage footerText */ + footerText?: (string|null); + + /** ButtonsMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** ButtonsMessage buttons */ + buttons?: (proto.Message.ButtonsMessage.IButton[]|null); + + /** ButtonsMessage headerType */ + headerType?: (proto.Message.ButtonsMessage.HeaderType|null); + + /** ButtonsMessage text */ + text?: (string|null); + + /** ButtonsMessage documentMessage */ + documentMessage?: (proto.Message.IDocumentMessage|null); + + /** ButtonsMessage imageMessage */ + imageMessage?: (proto.Message.IImageMessage|null); + + /** ButtonsMessage videoMessage */ + videoMessage?: (proto.Message.IVideoMessage|null); + + /** ButtonsMessage locationMessage */ + locationMessage?: (proto.Message.ILocationMessage|null); + } + + /** Represents a ButtonsMessage. */ + class ButtonsMessage implements IButtonsMessage { + + /** + * Constructs a new ButtonsMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IButtonsMessage); + + /** ButtonsMessage contentText. */ + public contentText: string; + + /** ButtonsMessage footerText. */ + public footerText: string; + + /** ButtonsMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** ButtonsMessage buttons. */ + public buttons: proto.Message.ButtonsMessage.IButton[]; + + /** ButtonsMessage headerType. */ + public headerType: proto.Message.ButtonsMessage.HeaderType; + + /** ButtonsMessage text. */ + public text?: (string|null); + + /** ButtonsMessage documentMessage. */ + public documentMessage?: (proto.Message.IDocumentMessage|null); + + /** ButtonsMessage imageMessage. */ + public imageMessage?: (proto.Message.IImageMessage|null); + + /** ButtonsMessage videoMessage. */ + public videoMessage?: (proto.Message.IVideoMessage|null); + + /** ButtonsMessage locationMessage. */ + public locationMessage?: (proto.Message.ILocationMessage|null); + + /** ButtonsMessage header. */ + public header?: ("text"|"documentMessage"|"imageMessage"|"videoMessage"|"locationMessage"); + + /** + * Creates a new ButtonsMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ButtonsMessage instance + */ + public static create(properties?: proto.Message.IButtonsMessage): proto.Message.ButtonsMessage; + + /** + * Encodes the specified ButtonsMessage message. Does not implicitly {@link proto.Message.ButtonsMessage.verify|verify} messages. + * @param message ButtonsMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IButtonsMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ButtonsMessage message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.verify|verify} messages. + * @param message ButtonsMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IButtonsMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ButtonsMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ButtonsMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ButtonsMessage; + + /** + * Decodes a ButtonsMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ButtonsMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ButtonsMessage; + + /** + * Verifies a ButtonsMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ButtonsMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ButtonsMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ButtonsMessage; + + /** + * Creates a plain object from a ButtonsMessage message. Also converts values to other types if specified. + * @param message ButtonsMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ButtonsMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ButtonsMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ButtonsMessage { + + /** Properties of a Button. */ + interface IButton { + + /** Button buttonId */ + buttonId?: (string|null); + + /** Button buttonText */ + buttonText?: (proto.Message.ButtonsMessage.Button.IButtonText|null); + + /** Button type */ + type?: (proto.Message.ButtonsMessage.Button.Type|null); + + /** Button nativeFlowInfo */ + nativeFlowInfo?: (proto.Message.ButtonsMessage.Button.INativeFlowInfo|null); + } + + /** Represents a Button. */ + class Button implements IButton { + + /** + * Constructs a new Button. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ButtonsMessage.IButton); + + /** Button buttonId. */ + public buttonId: string; + + /** Button buttonText. */ + public buttonText?: (proto.Message.ButtonsMessage.Button.IButtonText|null); + + /** Button type. */ + public type: proto.Message.ButtonsMessage.Button.Type; + + /** Button nativeFlowInfo. */ + public nativeFlowInfo?: (proto.Message.ButtonsMessage.Button.INativeFlowInfo|null); + + /** + * Creates a new Button instance using the specified properties. + * @param [properties] Properties to set + * @returns Button instance + */ + public static create(properties?: proto.Message.ButtonsMessage.IButton): proto.Message.ButtonsMessage.Button; + + /** + * Encodes the specified Button message. Does not implicitly {@link proto.Message.ButtonsMessage.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ButtonsMessage.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ButtonsMessage.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Button message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ButtonsMessage.Button; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ButtonsMessage.Button; + + /** + * Verifies a Button message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Button + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ButtonsMessage.Button; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @param message Button + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ButtonsMessage.Button, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Button to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Button { + + /** Properties of a ButtonText. */ + interface IButtonText { + + /** ButtonText displayText */ + displayText?: (string|null); + } + + /** Represents a ButtonText. */ + class ButtonText implements IButtonText { + + /** + * Constructs a new ButtonText. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ButtonsMessage.Button.IButtonText); + + /** ButtonText displayText. */ + public displayText: string; + + /** + * Creates a new ButtonText instance using the specified properties. + * @param [properties] Properties to set + * @returns ButtonText instance + */ + public static create(properties?: proto.Message.ButtonsMessage.Button.IButtonText): proto.Message.ButtonsMessage.Button.ButtonText; + + /** + * Encodes the specified ButtonText message. Does not implicitly {@link proto.Message.ButtonsMessage.Button.ButtonText.verify|verify} messages. + * @param message ButtonText message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ButtonsMessage.Button.IButtonText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ButtonText message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.Button.ButtonText.verify|verify} messages. + * @param message ButtonText message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ButtonsMessage.Button.IButtonText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ButtonText message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ButtonText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ButtonsMessage.Button.ButtonText; + + /** + * Decodes a ButtonText message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ButtonText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ButtonsMessage.Button.ButtonText; + + /** + * Verifies a ButtonText message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ButtonText message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ButtonText + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ButtonsMessage.Button.ButtonText; + + /** + * Creates a plain object from a ButtonText message. Also converts values to other types if specified. + * @param message ButtonText + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ButtonsMessage.Button.ButtonText, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ButtonText to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NativeFlowInfo. */ + interface INativeFlowInfo { + + /** NativeFlowInfo name */ + name?: (string|null); + + /** NativeFlowInfo paramsJson */ + paramsJson?: (string|null); + } + + /** Represents a NativeFlowInfo. */ + class NativeFlowInfo implements INativeFlowInfo { + + /** + * Constructs a new NativeFlowInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ButtonsMessage.Button.INativeFlowInfo); + + /** NativeFlowInfo name. */ + public name: string; + + /** NativeFlowInfo paramsJson. */ + public paramsJson: string; + + /** + * Creates a new NativeFlowInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns NativeFlowInfo instance + */ + public static create(properties?: proto.Message.ButtonsMessage.Button.INativeFlowInfo): proto.Message.ButtonsMessage.Button.NativeFlowInfo; + + /** + * Encodes the specified NativeFlowInfo message. Does not implicitly {@link proto.Message.ButtonsMessage.Button.NativeFlowInfo.verify|verify} messages. + * @param message NativeFlowInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ButtonsMessage.Button.INativeFlowInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NativeFlowInfo message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.Button.NativeFlowInfo.verify|verify} messages. + * @param message NativeFlowInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ButtonsMessage.Button.INativeFlowInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NativeFlowInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NativeFlowInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ButtonsMessage.Button.NativeFlowInfo; + + /** + * Decodes a NativeFlowInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NativeFlowInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ButtonsMessage.Button.NativeFlowInfo; + + /** + * Verifies a NativeFlowInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NativeFlowInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NativeFlowInfo + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ButtonsMessage.Button.NativeFlowInfo; + + /** + * Creates a plain object from a NativeFlowInfo message. Also converts values to other types if specified. + * @param message NativeFlowInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ButtonsMessage.Button.NativeFlowInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NativeFlowInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Type enum. */ + enum Type { + UNKNOWN = 0, + RESPONSE = 1, + NATIVE_FLOW = 2 + } + } + + /** HeaderType enum. */ + enum HeaderType { + UNKNOWN = 0, + EMPTY = 1, + TEXT = 2, + DOCUMENT = 3, + IMAGE = 4, + VIDEO = 5, + LOCATION = 6 + } + } + + /** Properties of a ButtonsResponseMessage. */ + interface IButtonsResponseMessage { + + /** ButtonsResponseMessage selectedButtonId */ + selectedButtonId?: (string|null); + + /** ButtonsResponseMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** ButtonsResponseMessage type */ + type?: (proto.Message.ButtonsResponseMessage.Type|null); + + /** ButtonsResponseMessage selectedDisplayText */ + selectedDisplayText?: (string|null); + } + + /** Represents a ButtonsResponseMessage. */ + class ButtonsResponseMessage implements IButtonsResponseMessage { + + /** + * Constructs a new ButtonsResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IButtonsResponseMessage); + + /** ButtonsResponseMessage selectedButtonId. */ + public selectedButtonId: string; + + /** ButtonsResponseMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** ButtonsResponseMessage type. */ + public type: proto.Message.ButtonsResponseMessage.Type; + + /** ButtonsResponseMessage selectedDisplayText. */ + public selectedDisplayText?: (string|null); + + /** ButtonsResponseMessage response. */ + public response?: "selectedDisplayText"; + + /** + * Creates a new ButtonsResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ButtonsResponseMessage instance + */ + public static create(properties?: proto.Message.IButtonsResponseMessage): proto.Message.ButtonsResponseMessage; + + /** + * Encodes the specified ButtonsResponseMessage message. Does not implicitly {@link proto.Message.ButtonsResponseMessage.verify|verify} messages. + * @param message ButtonsResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IButtonsResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ButtonsResponseMessage message, length delimited. Does not implicitly {@link proto.Message.ButtonsResponseMessage.verify|verify} messages. + * @param message ButtonsResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IButtonsResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ButtonsResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ButtonsResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ButtonsResponseMessage; + + /** + * Decodes a ButtonsResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ButtonsResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ButtonsResponseMessage; + + /** + * Verifies a ButtonsResponseMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ButtonsResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ButtonsResponseMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ButtonsResponseMessage; + + /** + * Creates a plain object from a ButtonsResponseMessage message. Also converts values to other types if specified. + * @param message ButtonsResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ButtonsResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ButtonsResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ButtonsResponseMessage { + + /** Type enum. */ + enum Type { + UNKNOWN = 0, + DISPLAY_TEXT = 1 + } + } + + /** Properties of a Call. */ + interface ICall { + + /** Call callKey */ + callKey?: (Uint8Array|null); + + /** Call conversionSource */ + conversionSource?: (string|null); + + /** Call conversionData */ + conversionData?: (Uint8Array|null); + + /** Call conversionDelaySeconds */ + conversionDelaySeconds?: (number|null); + } + + /** Represents a Call. */ + class Call implements ICall { + + /** + * Constructs a new Call. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ICall); + + /** Call callKey. */ + public callKey: Uint8Array; + + /** Call conversionSource. */ + public conversionSource: string; + + /** Call conversionData. */ + public conversionData: Uint8Array; + + /** Call conversionDelaySeconds. */ + public conversionDelaySeconds: number; + + /** + * Creates a new Call instance using the specified properties. + * @param [properties] Properties to set + * @returns Call instance + */ + public static create(properties?: proto.Message.ICall): proto.Message.Call; + + /** + * Encodes the specified Call message. Does not implicitly {@link proto.Message.Call.verify|verify} messages. + * @param message Call message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ICall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Call message, length delimited. Does not implicitly {@link proto.Message.Call.verify|verify} messages. + * @param message Call message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ICall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Call message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Call + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.Call; + + /** + * Decodes a Call message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Call + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.Call; + + /** + * Verifies a Call message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Call message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Call + */ + public static fromObject(object: { [k: string]: any }): proto.Message.Call; + + /** + * Creates a plain object from a Call message. Also converts values to other types if specified. + * @param message Call + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.Call, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Call to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CancelPaymentRequestMessage. */ + interface ICancelPaymentRequestMessage { + + /** CancelPaymentRequestMessage key */ + key?: (proto.IMessageKey|null); + } + + /** Represents a CancelPaymentRequestMessage. */ + class CancelPaymentRequestMessage implements ICancelPaymentRequestMessage { + + /** + * Constructs a new CancelPaymentRequestMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ICancelPaymentRequestMessage); + + /** CancelPaymentRequestMessage key. */ + public key?: (proto.IMessageKey|null); + + /** + * Creates a new CancelPaymentRequestMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns CancelPaymentRequestMessage instance + */ + public static create(properties?: proto.Message.ICancelPaymentRequestMessage): proto.Message.CancelPaymentRequestMessage; + + /** + * Encodes the specified CancelPaymentRequestMessage message. Does not implicitly {@link proto.Message.CancelPaymentRequestMessage.verify|verify} messages. + * @param message CancelPaymentRequestMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ICancelPaymentRequestMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CancelPaymentRequestMessage message, length delimited. Does not implicitly {@link proto.Message.CancelPaymentRequestMessage.verify|verify} messages. + * @param message CancelPaymentRequestMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ICancelPaymentRequestMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CancelPaymentRequestMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CancelPaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.CancelPaymentRequestMessage; + + /** + * Decodes a CancelPaymentRequestMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CancelPaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.CancelPaymentRequestMessage; + + /** + * Verifies a CancelPaymentRequestMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CancelPaymentRequestMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CancelPaymentRequestMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.CancelPaymentRequestMessage; + + /** + * Creates a plain object from a CancelPaymentRequestMessage message. Also converts values to other types if specified. + * @param message CancelPaymentRequestMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.CancelPaymentRequestMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CancelPaymentRequestMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Chat. */ + interface IChat { + + /** Chat displayName */ + displayName?: (string|null); + + /** Chat id */ + id?: (string|null); + } + + /** Represents a Chat. */ + class Chat implements IChat { + + /** + * Constructs a new Chat. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IChat); + + /** Chat displayName. */ + public displayName: string; + + /** Chat id. */ + public id: string; + + /** + * Creates a new Chat instance using the specified properties. + * @param [properties] Properties to set + * @returns Chat instance + */ + public static create(properties?: proto.Message.IChat): proto.Message.Chat; + + /** + * Encodes the specified Chat message. Does not implicitly {@link proto.Message.Chat.verify|verify} messages. + * @param message Chat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IChat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Chat message, length delimited. Does not implicitly {@link proto.Message.Chat.verify|verify} messages. + * @param message Chat message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IChat, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Chat message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Chat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.Chat; + + /** + * Decodes a Chat message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Chat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.Chat; + + /** + * Verifies a Chat message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Chat message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Chat + */ + public static fromObject(object: { [k: string]: any }): proto.Message.Chat; + + /** + * Creates a plain object from a Chat message. Also converts values to other types if specified. + * @param message Chat + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.Chat, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Chat to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ContactMessage. */ + interface IContactMessage { + + /** ContactMessage displayName */ + displayName?: (string|null); + + /** ContactMessage vcard */ + vcard?: (string|null); + + /** ContactMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a ContactMessage. */ + class ContactMessage implements IContactMessage { + + /** + * Constructs a new ContactMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IContactMessage); + + /** ContactMessage displayName. */ + public displayName: string; + + /** ContactMessage vcard. */ + public vcard: string; + + /** ContactMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new ContactMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ContactMessage instance + */ + public static create(properties?: proto.Message.IContactMessage): proto.Message.ContactMessage; + + /** + * Encodes the specified ContactMessage message. Does not implicitly {@link proto.Message.ContactMessage.verify|verify} messages. + * @param message ContactMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IContactMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContactMessage message, length delimited. Does not implicitly {@link proto.Message.ContactMessage.verify|verify} messages. + * @param message ContactMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IContactMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContactMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContactMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ContactMessage; + + /** + * Decodes a ContactMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContactMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ContactMessage; + + /** + * Verifies a ContactMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContactMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContactMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ContactMessage; + + /** + * Creates a plain object from a ContactMessage message. Also converts values to other types if specified. + * @param message ContactMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ContactMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContactMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ContactsArrayMessage. */ + interface IContactsArrayMessage { + + /** ContactsArrayMessage displayName */ + displayName?: (string|null); + + /** ContactsArrayMessage contacts */ + contacts?: (proto.Message.IContactMessage[]|null); + + /** ContactsArrayMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a ContactsArrayMessage. */ + class ContactsArrayMessage implements IContactsArrayMessage { + + /** + * Constructs a new ContactsArrayMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IContactsArrayMessage); + + /** ContactsArrayMessage displayName. */ + public displayName: string; + + /** ContactsArrayMessage contacts. */ + public contacts: proto.Message.IContactMessage[]; + + /** ContactsArrayMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new ContactsArrayMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ContactsArrayMessage instance + */ + public static create(properties?: proto.Message.IContactsArrayMessage): proto.Message.ContactsArrayMessage; + + /** + * Encodes the specified ContactsArrayMessage message. Does not implicitly {@link proto.Message.ContactsArrayMessage.verify|verify} messages. + * @param message ContactsArrayMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IContactsArrayMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContactsArrayMessage message, length delimited. Does not implicitly {@link proto.Message.ContactsArrayMessage.verify|verify} messages. + * @param message ContactsArrayMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IContactsArrayMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContactsArrayMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContactsArrayMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ContactsArrayMessage; + + /** + * Decodes a ContactsArrayMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContactsArrayMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ContactsArrayMessage; + + /** + * Verifies a ContactsArrayMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContactsArrayMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContactsArrayMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ContactsArrayMessage; + + /** + * Creates a plain object from a ContactsArrayMessage message. Also converts values to other types if specified. + * @param message ContactsArrayMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ContactsArrayMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContactsArrayMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeclinePaymentRequestMessage. */ + interface IDeclinePaymentRequestMessage { + + /** DeclinePaymentRequestMessage key */ + key?: (proto.IMessageKey|null); + } + + /** Represents a DeclinePaymentRequestMessage. */ + class DeclinePaymentRequestMessage implements IDeclinePaymentRequestMessage { + + /** + * Constructs a new DeclinePaymentRequestMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IDeclinePaymentRequestMessage); + + /** DeclinePaymentRequestMessage key. */ + public key?: (proto.IMessageKey|null); + + /** + * Creates a new DeclinePaymentRequestMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns DeclinePaymentRequestMessage instance + */ + public static create(properties?: proto.Message.IDeclinePaymentRequestMessage): proto.Message.DeclinePaymentRequestMessage; + + /** + * Encodes the specified DeclinePaymentRequestMessage message. Does not implicitly {@link proto.Message.DeclinePaymentRequestMessage.verify|verify} messages. + * @param message DeclinePaymentRequestMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IDeclinePaymentRequestMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeclinePaymentRequestMessage message, length delimited. Does not implicitly {@link proto.Message.DeclinePaymentRequestMessage.verify|verify} messages. + * @param message DeclinePaymentRequestMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IDeclinePaymentRequestMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeclinePaymentRequestMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeclinePaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.DeclinePaymentRequestMessage; + + /** + * Decodes a DeclinePaymentRequestMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeclinePaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.DeclinePaymentRequestMessage; + + /** + * Verifies a DeclinePaymentRequestMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeclinePaymentRequestMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeclinePaymentRequestMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.DeclinePaymentRequestMessage; + + /** + * Creates a plain object from a DeclinePaymentRequestMessage message. Also converts values to other types if specified. + * @param message DeclinePaymentRequestMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.DeclinePaymentRequestMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeclinePaymentRequestMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeviceSentMessage. */ + interface IDeviceSentMessage { + + /** DeviceSentMessage destinationJid */ + destinationJid?: (string|null); + + /** DeviceSentMessage message */ + message?: (proto.IMessage|null); + + /** DeviceSentMessage phash */ + phash?: (string|null); + } + + /** Represents a DeviceSentMessage. */ + class DeviceSentMessage implements IDeviceSentMessage { + + /** + * Constructs a new DeviceSentMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IDeviceSentMessage); + + /** DeviceSentMessage destinationJid. */ + public destinationJid: string; + + /** DeviceSentMessage message. */ + public message?: (proto.IMessage|null); + + /** DeviceSentMessage phash. */ + public phash: string; + + /** + * Creates a new DeviceSentMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns DeviceSentMessage instance + */ + public static create(properties?: proto.Message.IDeviceSentMessage): proto.Message.DeviceSentMessage; + + /** + * Encodes the specified DeviceSentMessage message. Does not implicitly {@link proto.Message.DeviceSentMessage.verify|verify} messages. + * @param message DeviceSentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IDeviceSentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeviceSentMessage message, length delimited. Does not implicitly {@link proto.Message.DeviceSentMessage.verify|verify} messages. + * @param message DeviceSentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IDeviceSentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeviceSentMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeviceSentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.DeviceSentMessage; + + /** + * Decodes a DeviceSentMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeviceSentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.DeviceSentMessage; + + /** + * Verifies a DeviceSentMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeviceSentMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeviceSentMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.DeviceSentMessage; + + /** + * Creates a plain object from a DeviceSentMessage message. Also converts values to other types if specified. + * @param message DeviceSentMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.DeviceSentMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeviceSentMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DocumentMessage. */ + interface IDocumentMessage { + + /** DocumentMessage url */ + url?: (string|null); + + /** DocumentMessage mimetype */ + mimetype?: (string|null); + + /** DocumentMessage title */ + title?: (string|null); + + /** DocumentMessage fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** DocumentMessage fileLength */ + fileLength?: (number|Long|null); + + /** DocumentMessage pageCount */ + pageCount?: (number|null); + + /** DocumentMessage mediaKey */ + mediaKey?: (Uint8Array|null); + + /** DocumentMessage fileName */ + fileName?: (string|null); + + /** DocumentMessage fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** DocumentMessage directPath */ + directPath?: (string|null); + + /** DocumentMessage mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** DocumentMessage contactVcard */ + contactVcard?: (boolean|null); + + /** DocumentMessage thumbnailDirectPath */ + thumbnailDirectPath?: (string|null); + + /** DocumentMessage thumbnailSha256 */ + thumbnailSha256?: (Uint8Array|null); + + /** DocumentMessage thumbnailEncSha256 */ + thumbnailEncSha256?: (Uint8Array|null); + + /** DocumentMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** DocumentMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** DocumentMessage thumbnailHeight */ + thumbnailHeight?: (number|null); + + /** DocumentMessage thumbnailWidth */ + thumbnailWidth?: (number|null); + + /** DocumentMessage caption */ + caption?: (string|null); + } + + /** Represents a DocumentMessage. */ + class DocumentMessage implements IDocumentMessage { + + /** + * Constructs a new DocumentMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IDocumentMessage); + + /** DocumentMessage url. */ + public url: string; + + /** DocumentMessage mimetype. */ + public mimetype: string; + + /** DocumentMessage title. */ + public title: string; + + /** DocumentMessage fileSha256. */ + public fileSha256: Uint8Array; + + /** DocumentMessage fileLength. */ + public fileLength: (number|Long); + + /** DocumentMessage pageCount. */ + public pageCount: number; + + /** DocumentMessage mediaKey. */ + public mediaKey: Uint8Array; + + /** DocumentMessage fileName. */ + public fileName: string; + + /** DocumentMessage fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** DocumentMessage directPath. */ + public directPath: string; + + /** DocumentMessage mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** DocumentMessage contactVcard. */ + public contactVcard: boolean; + + /** DocumentMessage thumbnailDirectPath. */ + public thumbnailDirectPath: string; + + /** DocumentMessage thumbnailSha256. */ + public thumbnailSha256: Uint8Array; + + /** DocumentMessage thumbnailEncSha256. */ + public thumbnailEncSha256: Uint8Array; + + /** DocumentMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** DocumentMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** DocumentMessage thumbnailHeight. */ + public thumbnailHeight: number; + + /** DocumentMessage thumbnailWidth. */ + public thumbnailWidth: number; + + /** DocumentMessage caption. */ + public caption: string; + + /** + * Creates a new DocumentMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentMessage instance + */ + public static create(properties?: proto.Message.IDocumentMessage): proto.Message.DocumentMessage; + + /** + * Encodes the specified DocumentMessage message. Does not implicitly {@link proto.Message.DocumentMessage.verify|verify} messages. + * @param message DocumentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IDocumentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentMessage message, length delimited. Does not implicitly {@link proto.Message.DocumentMessage.verify|verify} messages. + * @param message DocumentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IDocumentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.DocumentMessage; + + /** + * Decodes a DocumentMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.DocumentMessage; + + /** + * Verifies a DocumentMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.DocumentMessage; + + /** + * Creates a plain object from a DocumentMessage message. Also converts values to other types if specified. + * @param message DocumentMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.DocumentMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EncReactionMessage. */ + interface IEncReactionMessage { + + /** EncReactionMessage targetMessageKey */ + targetMessageKey?: (proto.IMessageKey|null); + + /** EncReactionMessage encPayload */ + encPayload?: (Uint8Array|null); + + /** EncReactionMessage encIv */ + encIv?: (Uint8Array|null); + } + + /** Represents an EncReactionMessage. */ + class EncReactionMessage implements IEncReactionMessage { + + /** + * Constructs a new EncReactionMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IEncReactionMessage); + + /** EncReactionMessage targetMessageKey. */ + public targetMessageKey?: (proto.IMessageKey|null); + + /** EncReactionMessage encPayload. */ + public encPayload: Uint8Array; + + /** EncReactionMessage encIv. */ + public encIv: Uint8Array; + + /** + * Creates a new EncReactionMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns EncReactionMessage instance + */ + public static create(properties?: proto.Message.IEncReactionMessage): proto.Message.EncReactionMessage; + + /** + * Encodes the specified EncReactionMessage message. Does not implicitly {@link proto.Message.EncReactionMessage.verify|verify} messages. + * @param message EncReactionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IEncReactionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncReactionMessage message, length delimited. Does not implicitly {@link proto.Message.EncReactionMessage.verify|verify} messages. + * @param message EncReactionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IEncReactionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncReactionMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.EncReactionMessage; + + /** + * Decodes an EncReactionMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.EncReactionMessage; + + /** + * Verifies an EncReactionMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EncReactionMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncReactionMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.EncReactionMessage; + + /** + * Creates a plain object from an EncReactionMessage message. Also converts values to other types if specified. + * @param message EncReactionMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.EncReactionMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncReactionMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ExtendedTextMessage. */ + interface IExtendedTextMessage { + + /** ExtendedTextMessage text */ + text?: (string|null); + + /** ExtendedTextMessage matchedText */ + matchedText?: (string|null); + + /** ExtendedTextMessage canonicalUrl */ + canonicalUrl?: (string|null); + + /** ExtendedTextMessage description */ + description?: (string|null); + + /** ExtendedTextMessage title */ + title?: (string|null); + + /** ExtendedTextMessage textArgb */ + textArgb?: (number|null); + + /** ExtendedTextMessage backgroundArgb */ + backgroundArgb?: (number|null); + + /** ExtendedTextMessage font */ + font?: (proto.Message.ExtendedTextMessage.FontType|null); + + /** ExtendedTextMessage previewType */ + previewType?: (proto.Message.ExtendedTextMessage.PreviewType|null); + + /** ExtendedTextMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** ExtendedTextMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** ExtendedTextMessage doNotPlayInline */ + doNotPlayInline?: (boolean|null); + + /** ExtendedTextMessage thumbnailDirectPath */ + thumbnailDirectPath?: (string|null); + + /** ExtendedTextMessage thumbnailSha256 */ + thumbnailSha256?: (Uint8Array|null); + + /** ExtendedTextMessage thumbnailEncSha256 */ + thumbnailEncSha256?: (Uint8Array|null); + + /** ExtendedTextMessage mediaKey */ + mediaKey?: (Uint8Array|null); + + /** ExtendedTextMessage mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** ExtendedTextMessage thumbnailHeight */ + thumbnailHeight?: (number|null); + + /** ExtendedTextMessage thumbnailWidth */ + thumbnailWidth?: (number|null); + + /** ExtendedTextMessage inviteLinkGroupType */ + inviteLinkGroupType?: (proto.Message.ExtendedTextMessage.InviteLinkGroupType|null); + + /** ExtendedTextMessage inviteLinkParentGroupSubjectV2 */ + inviteLinkParentGroupSubjectV2?: (string|null); + + /** ExtendedTextMessage inviteLinkParentGroupThumbnailV2 */ + inviteLinkParentGroupThumbnailV2?: (Uint8Array|null); + + /** ExtendedTextMessage inviteLinkGroupTypeV2 */ + inviteLinkGroupTypeV2?: (proto.Message.ExtendedTextMessage.InviteLinkGroupType|null); + + /** ExtendedTextMessage viewOnce */ + viewOnce?: (boolean|null); + } + + /** Represents an ExtendedTextMessage. */ + class ExtendedTextMessage implements IExtendedTextMessage { + + /** + * Constructs a new ExtendedTextMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IExtendedTextMessage); + + /** ExtendedTextMessage text. */ + public text: string; + + /** ExtendedTextMessage matchedText. */ + public matchedText: string; + + /** ExtendedTextMessage canonicalUrl. */ + public canonicalUrl: string; + + /** ExtendedTextMessage description. */ + public description: string; + + /** ExtendedTextMessage title. */ + public title: string; + + /** ExtendedTextMessage textArgb. */ + public textArgb: number; + + /** ExtendedTextMessage backgroundArgb. */ + public backgroundArgb: number; + + /** ExtendedTextMessage font. */ + public font: proto.Message.ExtendedTextMessage.FontType; + + /** ExtendedTextMessage previewType. */ + public previewType: proto.Message.ExtendedTextMessage.PreviewType; + + /** ExtendedTextMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** ExtendedTextMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** ExtendedTextMessage doNotPlayInline. */ + public doNotPlayInline: boolean; + + /** ExtendedTextMessage thumbnailDirectPath. */ + public thumbnailDirectPath: string; + + /** ExtendedTextMessage thumbnailSha256. */ + public thumbnailSha256: Uint8Array; + + /** ExtendedTextMessage thumbnailEncSha256. */ + public thumbnailEncSha256: Uint8Array; + + /** ExtendedTextMessage mediaKey. */ + public mediaKey: Uint8Array; + + /** ExtendedTextMessage mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** ExtendedTextMessage thumbnailHeight. */ + public thumbnailHeight: number; + + /** ExtendedTextMessage thumbnailWidth. */ + public thumbnailWidth: number; + + /** ExtendedTextMessage inviteLinkGroupType. */ + public inviteLinkGroupType: proto.Message.ExtendedTextMessage.InviteLinkGroupType; + + /** ExtendedTextMessage inviteLinkParentGroupSubjectV2. */ + public inviteLinkParentGroupSubjectV2: string; + + /** ExtendedTextMessage inviteLinkParentGroupThumbnailV2. */ + public inviteLinkParentGroupThumbnailV2: Uint8Array; + + /** ExtendedTextMessage inviteLinkGroupTypeV2. */ + public inviteLinkGroupTypeV2: proto.Message.ExtendedTextMessage.InviteLinkGroupType; + + /** ExtendedTextMessage viewOnce. */ + public viewOnce: boolean; + + /** + * Creates a new ExtendedTextMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtendedTextMessage instance + */ + public static create(properties?: proto.Message.IExtendedTextMessage): proto.Message.ExtendedTextMessage; + + /** + * Encodes the specified ExtendedTextMessage message. Does not implicitly {@link proto.Message.ExtendedTextMessage.verify|verify} messages. + * @param message ExtendedTextMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IExtendedTextMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtendedTextMessage message, length delimited. Does not implicitly {@link proto.Message.ExtendedTextMessage.verify|verify} messages. + * @param message ExtendedTextMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IExtendedTextMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtendedTextMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtendedTextMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ExtendedTextMessage; + + /** + * Decodes an ExtendedTextMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtendedTextMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ExtendedTextMessage; + + /** + * Verifies an ExtendedTextMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtendedTextMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtendedTextMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ExtendedTextMessage; + + /** + * Creates a plain object from an ExtendedTextMessage message. Also converts values to other types if specified. + * @param message ExtendedTextMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ExtendedTextMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtendedTextMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ExtendedTextMessage { + + /** FontType enum. */ + enum FontType { + SANS_SERIF = 0, + SERIF = 1, + NORICAN_REGULAR = 2, + BRYNDAN_WRITE = 3, + BEBASNEUE_REGULAR = 4, + OSWALD_HEAVY = 5, + DAMION_REGULAR = 6, + MORNINGBREEZE_REGULAR = 7, + CALISTOGA_REGULAR = 8, + EXO2_EXTRABOLD = 9, + COURIERPRIME_BOLD = 10 + } + + /** InviteLinkGroupType enum. */ + enum InviteLinkGroupType { + DEFAULT = 0, + PARENT = 1, + SUB = 2, + DEFAULT_SUB = 3 + } + + /** PreviewType enum. */ + enum PreviewType { + NONE = 0, + VIDEO = 1 + } + } + + /** Properties of a FutureProofMessage. */ + interface IFutureProofMessage { + + /** FutureProofMessage message */ + message?: (proto.IMessage|null); + } + + /** Represents a FutureProofMessage. */ + class FutureProofMessage implements IFutureProofMessage { + + /** + * Constructs a new FutureProofMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IFutureProofMessage); + + /** FutureProofMessage message. */ + public message?: (proto.IMessage|null); + + /** + * Creates a new FutureProofMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns FutureProofMessage instance + */ + public static create(properties?: proto.Message.IFutureProofMessage): proto.Message.FutureProofMessage; + + /** + * Encodes the specified FutureProofMessage message. Does not implicitly {@link proto.Message.FutureProofMessage.verify|verify} messages. + * @param message FutureProofMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IFutureProofMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FutureProofMessage message, length delimited. Does not implicitly {@link proto.Message.FutureProofMessage.verify|verify} messages. + * @param message FutureProofMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IFutureProofMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FutureProofMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FutureProofMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.FutureProofMessage; + + /** + * Decodes a FutureProofMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FutureProofMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.FutureProofMessage; + + /** + * Verifies a FutureProofMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FutureProofMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FutureProofMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.FutureProofMessage; + + /** + * Creates a plain object from a FutureProofMessage message. Also converts values to other types if specified. + * @param message FutureProofMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.FutureProofMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FutureProofMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GroupInviteMessage. */ + interface IGroupInviteMessage { + + /** GroupInviteMessage groupJid */ + groupJid?: (string|null); + + /** GroupInviteMessage inviteCode */ + inviteCode?: (string|null); + + /** GroupInviteMessage inviteExpiration */ + inviteExpiration?: (number|Long|null); + + /** GroupInviteMessage groupName */ + groupName?: (string|null); + + /** GroupInviteMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** GroupInviteMessage caption */ + caption?: (string|null); + + /** GroupInviteMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** GroupInviteMessage groupType */ + groupType?: (proto.Message.GroupInviteMessage.GroupType|null); + } + + /** Represents a GroupInviteMessage. */ + class GroupInviteMessage implements IGroupInviteMessage { + + /** + * Constructs a new GroupInviteMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IGroupInviteMessage); + + /** GroupInviteMessage groupJid. */ + public groupJid: string; + + /** GroupInviteMessage inviteCode. */ + public inviteCode: string; + + /** GroupInviteMessage inviteExpiration. */ + public inviteExpiration: (number|Long); + + /** GroupInviteMessage groupName. */ + public groupName: string; + + /** GroupInviteMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** GroupInviteMessage caption. */ + public caption: string; + + /** GroupInviteMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** GroupInviteMessage groupType. */ + public groupType: proto.Message.GroupInviteMessage.GroupType; + + /** + * Creates a new GroupInviteMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns GroupInviteMessage instance + */ + public static create(properties?: proto.Message.IGroupInviteMessage): proto.Message.GroupInviteMessage; + + /** + * Encodes the specified GroupInviteMessage message. Does not implicitly {@link proto.Message.GroupInviteMessage.verify|verify} messages. + * @param message GroupInviteMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IGroupInviteMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GroupInviteMessage message, length delimited. Does not implicitly {@link proto.Message.GroupInviteMessage.verify|verify} messages. + * @param message GroupInviteMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IGroupInviteMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GroupInviteMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GroupInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.GroupInviteMessage; + + /** + * Decodes a GroupInviteMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GroupInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.GroupInviteMessage; + + /** + * Verifies a GroupInviteMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GroupInviteMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GroupInviteMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.GroupInviteMessage; + + /** + * Creates a plain object from a GroupInviteMessage message. Also converts values to other types if specified. + * @param message GroupInviteMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.GroupInviteMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GroupInviteMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace GroupInviteMessage { + + /** GroupType enum. */ + enum GroupType { + DEFAULT = 0, + PARENT = 1 + } + } + + /** Properties of a HighlyStructuredMessage. */ + interface IHighlyStructuredMessage { + + /** HighlyStructuredMessage namespace */ + namespace?: (string|null); + + /** HighlyStructuredMessage elementName */ + elementName?: (string|null); + + /** HighlyStructuredMessage params */ + params?: (string[]|null); + + /** HighlyStructuredMessage fallbackLg */ + fallbackLg?: (string|null); + + /** HighlyStructuredMessage fallbackLc */ + fallbackLc?: (string|null); + + /** HighlyStructuredMessage localizableParams */ + localizableParams?: (proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter[]|null); + + /** HighlyStructuredMessage deterministicLg */ + deterministicLg?: (string|null); + + /** HighlyStructuredMessage deterministicLc */ + deterministicLc?: (string|null); + + /** HighlyStructuredMessage hydratedHsm */ + hydratedHsm?: (proto.Message.ITemplateMessage|null); + } + + /** Represents a HighlyStructuredMessage. */ + class HighlyStructuredMessage implements IHighlyStructuredMessage { + + /** + * Constructs a new HighlyStructuredMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IHighlyStructuredMessage); + + /** HighlyStructuredMessage namespace. */ + public namespace: string; + + /** HighlyStructuredMessage elementName. */ + public elementName: string; + + /** HighlyStructuredMessage params. */ + public params: string[]; + + /** HighlyStructuredMessage fallbackLg. */ + public fallbackLg: string; + + /** HighlyStructuredMessage fallbackLc. */ + public fallbackLc: string; + + /** HighlyStructuredMessage localizableParams. */ + public localizableParams: proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter[]; + + /** HighlyStructuredMessage deterministicLg. */ + public deterministicLg: string; + + /** HighlyStructuredMessage deterministicLc. */ + public deterministicLc: string; + + /** HighlyStructuredMessage hydratedHsm. */ + public hydratedHsm?: (proto.Message.ITemplateMessage|null); + + /** + * Creates a new HighlyStructuredMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns HighlyStructuredMessage instance + */ + public static create(properties?: proto.Message.IHighlyStructuredMessage): proto.Message.HighlyStructuredMessage; + + /** + * Encodes the specified HighlyStructuredMessage message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.verify|verify} messages. + * @param message HighlyStructuredMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IHighlyStructuredMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HighlyStructuredMessage message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.verify|verify} messages. + * @param message HighlyStructuredMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IHighlyStructuredMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HighlyStructuredMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HighlyStructuredMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HighlyStructuredMessage; + + /** + * Decodes a HighlyStructuredMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HighlyStructuredMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HighlyStructuredMessage; + + /** + * Verifies a HighlyStructuredMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HighlyStructuredMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HighlyStructuredMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HighlyStructuredMessage; + + /** + * Creates a plain object from a HighlyStructuredMessage message. Also converts values to other types if specified. + * @param message HighlyStructuredMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HighlyStructuredMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HighlyStructuredMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HighlyStructuredMessage { + + /** Properties of a HSMLocalizableParameter. */ + interface IHSMLocalizableParameter { + + /** HSMLocalizableParameter default */ + "default"?: (string|null); + + /** HSMLocalizableParameter currency */ + currency?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency|null); + + /** HSMLocalizableParameter dateTime */ + dateTime?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime|null); + } + + /** Represents a HSMLocalizableParameter. */ + class HSMLocalizableParameter implements IHSMLocalizableParameter { + + /** + * Constructs a new HSMLocalizableParameter. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter); + + /** HSMLocalizableParameter default. */ + public default: string; + + /** HSMLocalizableParameter currency. */ + public currency?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency|null); + + /** HSMLocalizableParameter dateTime. */ + public dateTime?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime|null); + + /** HSMLocalizableParameter paramOneof. */ + public paramOneof?: ("currency"|"dateTime"); + + /** + * Creates a new HSMLocalizableParameter instance using the specified properties. + * @param [properties] Properties to set + * @returns HSMLocalizableParameter instance + */ + public static create(properties?: proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter; + + /** + * Encodes the specified HSMLocalizableParameter message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.verify|verify} messages. + * @param message HSMLocalizableParameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HSMLocalizableParameter message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.verify|verify} messages. + * @param message HSMLocalizableParameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HSMLocalizableParameter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HSMLocalizableParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter; + + /** + * Decodes a HSMLocalizableParameter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HSMLocalizableParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter; + + /** + * Verifies a HSMLocalizableParameter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HSMLocalizableParameter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HSMLocalizableParameter + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter; + + /** + * Creates a plain object from a HSMLocalizableParameter message. Also converts values to other types if specified. + * @param message HSMLocalizableParameter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HSMLocalizableParameter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HSMLocalizableParameter { + + /** Properties of a HSMCurrency. */ + interface IHSMCurrency { + + /** HSMCurrency currencyCode */ + currencyCode?: (string|null); + + /** HSMCurrency amount1000 */ + amount1000?: (number|Long|null); + } + + /** Represents a HSMCurrency. */ + class HSMCurrency implements IHSMCurrency { + + /** + * Constructs a new HSMCurrency. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency); + + /** HSMCurrency currencyCode. */ + public currencyCode: string; + + /** HSMCurrency amount1000. */ + public amount1000: (number|Long); + + /** + * Creates a new HSMCurrency instance using the specified properties. + * @param [properties] Properties to set + * @returns HSMCurrency instance + */ + public static create(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency; + + /** + * Encodes the specified HSMCurrency message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.verify|verify} messages. + * @param message HSMCurrency message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HSMCurrency message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.verify|verify} messages. + * @param message HSMCurrency message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HSMCurrency message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HSMCurrency + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency; + + /** + * Decodes a HSMCurrency message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HSMCurrency + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency; + + /** + * Verifies a HSMCurrency message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HSMCurrency message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HSMCurrency + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency; + + /** + * Creates a plain object from a HSMCurrency message. Also converts values to other types if specified. + * @param message HSMCurrency + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HSMCurrency to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HSMDateTime. */ + interface IHSMDateTime { + + /** HSMDateTime component */ + component?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent|null); + + /** HSMDateTime unixEpoch */ + unixEpoch?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch|null); + } + + /** Represents a HSMDateTime. */ + class HSMDateTime implements IHSMDateTime { + + /** + * Constructs a new HSMDateTime. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime); + + /** HSMDateTime component. */ + public component?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent|null); + + /** HSMDateTime unixEpoch. */ + public unixEpoch?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch|null); + + /** HSMDateTime datetimeOneof. */ + public datetimeOneof?: ("component"|"unixEpoch"); + + /** + * Creates a new HSMDateTime instance using the specified properties. + * @param [properties] Properties to set + * @returns HSMDateTime instance + */ + public static create(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime; + + /** + * Encodes the specified HSMDateTime message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.verify|verify} messages. + * @param message HSMDateTime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HSMDateTime message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.verify|verify} messages. + * @param message HSMDateTime message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HSMDateTime message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HSMDateTime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime; + + /** + * Decodes a HSMDateTime message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HSMDateTime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime; + + /** + * Verifies a HSMDateTime message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HSMDateTime message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HSMDateTime + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime; + + /** + * Creates a plain object from a HSMDateTime message. Also converts values to other types if specified. + * @param message HSMDateTime + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HSMDateTime to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HSMDateTime { + + /** Properties of a HSMDateTimeComponent. */ + interface IHSMDateTimeComponent { + + /** HSMDateTimeComponent dayOfWeek */ + dayOfWeek?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType|null); + + /** HSMDateTimeComponent year */ + year?: (number|null); + + /** HSMDateTimeComponent month */ + month?: (number|null); + + /** HSMDateTimeComponent dayOfMonth */ + dayOfMonth?: (number|null); + + /** HSMDateTimeComponent hour */ + hour?: (number|null); + + /** HSMDateTimeComponent minute */ + minute?: (number|null); + + /** HSMDateTimeComponent calendar */ + calendar?: (proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType|null); + } + + /** Represents a HSMDateTimeComponent. */ + class HSMDateTimeComponent implements IHSMDateTimeComponent { + + /** + * Constructs a new HSMDateTimeComponent. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent); + + /** HSMDateTimeComponent dayOfWeek. */ + public dayOfWeek: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType; + + /** HSMDateTimeComponent year. */ + public year: number; + + /** HSMDateTimeComponent month. */ + public month: number; + + /** HSMDateTimeComponent dayOfMonth. */ + public dayOfMonth: number; + + /** HSMDateTimeComponent hour. */ + public hour: number; + + /** HSMDateTimeComponent minute. */ + public minute: number; + + /** HSMDateTimeComponent calendar. */ + public calendar: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType; + + /** + * Creates a new HSMDateTimeComponent instance using the specified properties. + * @param [properties] Properties to set + * @returns HSMDateTimeComponent instance + */ + public static create(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent; + + /** + * Encodes the specified HSMDateTimeComponent message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.verify|verify} messages. + * @param message HSMDateTimeComponent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HSMDateTimeComponent message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.verify|verify} messages. + * @param message HSMDateTimeComponent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HSMDateTimeComponent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HSMDateTimeComponent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent; + + /** + * Decodes a HSMDateTimeComponent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HSMDateTimeComponent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent; + + /** + * Verifies a HSMDateTimeComponent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HSMDateTimeComponent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HSMDateTimeComponent + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent; + + /** + * Creates a plain object from a HSMDateTimeComponent message. Also converts values to other types if specified. + * @param message HSMDateTimeComponent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HSMDateTimeComponent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HSMDateTimeComponent { + + /** CalendarType enum. */ + enum CalendarType { + GREGORIAN = 1, + SOLAR_HIJRI = 2 + } + + /** DayOfWeekType enum. */ + enum DayOfWeekType { + MONDAY = 1, + TUESDAY = 2, + WEDNESDAY = 3, + THURSDAY = 4, + FRIDAY = 5, + SATURDAY = 6, + SUNDAY = 7 + } + } + + /** Properties of a HSMDateTimeUnixEpoch. */ + interface IHSMDateTimeUnixEpoch { + + /** HSMDateTimeUnixEpoch timestamp */ + timestamp?: (number|Long|null); + } + + /** Represents a HSMDateTimeUnixEpoch. */ + class HSMDateTimeUnixEpoch implements IHSMDateTimeUnixEpoch { + + /** + * Constructs a new HSMDateTimeUnixEpoch. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch); + + /** HSMDateTimeUnixEpoch timestamp. */ + public timestamp: (number|Long); + + /** + * Creates a new HSMDateTimeUnixEpoch instance using the specified properties. + * @param [properties] Properties to set + * @returns HSMDateTimeUnixEpoch instance + */ + public static create(properties?: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch; + + /** + * Encodes the specified HSMDateTimeUnixEpoch message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.verify|verify} messages. + * @param message HSMDateTimeUnixEpoch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HSMDateTimeUnixEpoch message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.verify|verify} messages. + * @param message HSMDateTimeUnixEpoch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HSMDateTimeUnixEpoch message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HSMDateTimeUnixEpoch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch; + + /** + * Decodes a HSMDateTimeUnixEpoch message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HSMDateTimeUnixEpoch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch; + + /** + * Verifies a HSMDateTimeUnixEpoch message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HSMDateTimeUnixEpoch message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HSMDateTimeUnixEpoch + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch; + + /** + * Creates a plain object from a HSMDateTimeUnixEpoch message. Also converts values to other types if specified. + * @param message HSMDateTimeUnixEpoch + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HSMDateTimeUnixEpoch to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + } + + /** Properties of a HistorySyncNotification. */ + interface IHistorySyncNotification { + + /** HistorySyncNotification fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** HistorySyncNotification fileLength */ + fileLength?: (number|Long|null); + + /** HistorySyncNotification mediaKey */ + mediaKey?: (Uint8Array|null); + + /** HistorySyncNotification fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** HistorySyncNotification directPath */ + directPath?: (string|null); + + /** HistorySyncNotification syncType */ + syncType?: (proto.Message.HistorySyncNotification.HistorySyncType|null); + + /** HistorySyncNotification chunkOrder */ + chunkOrder?: (number|null); + + /** HistorySyncNotification originalMessageId */ + originalMessageId?: (string|null); + + /** HistorySyncNotification progress */ + progress?: (number|null); + + /** HistorySyncNotification oldestMsgInChunkTimestampSec */ + oldestMsgInChunkTimestampSec?: (number|Long|null); + } + + /** Represents a HistorySyncNotification. */ + class HistorySyncNotification implements IHistorySyncNotification { + + /** + * Constructs a new HistorySyncNotification. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IHistorySyncNotification); + + /** HistorySyncNotification fileSha256. */ + public fileSha256: Uint8Array; + + /** HistorySyncNotification fileLength. */ + public fileLength: (number|Long); + + /** HistorySyncNotification mediaKey. */ + public mediaKey: Uint8Array; + + /** HistorySyncNotification fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** HistorySyncNotification directPath. */ + public directPath: string; + + /** HistorySyncNotification syncType. */ + public syncType: proto.Message.HistorySyncNotification.HistorySyncType; + + /** HistorySyncNotification chunkOrder. */ + public chunkOrder: number; + + /** HistorySyncNotification originalMessageId. */ + public originalMessageId: string; + + /** HistorySyncNotification progress. */ + public progress: number; + + /** HistorySyncNotification oldestMsgInChunkTimestampSec. */ + public oldestMsgInChunkTimestampSec: (number|Long); + + /** + * Creates a new HistorySyncNotification instance using the specified properties. + * @param [properties] Properties to set + * @returns HistorySyncNotification instance + */ + public static create(properties?: proto.Message.IHistorySyncNotification): proto.Message.HistorySyncNotification; + + /** + * Encodes the specified HistorySyncNotification message. Does not implicitly {@link proto.Message.HistorySyncNotification.verify|verify} messages. + * @param message HistorySyncNotification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IHistorySyncNotification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HistorySyncNotification message, length delimited. Does not implicitly {@link proto.Message.HistorySyncNotification.verify|verify} messages. + * @param message HistorySyncNotification message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IHistorySyncNotification, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HistorySyncNotification message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HistorySyncNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.HistorySyncNotification; + + /** + * Decodes a HistorySyncNotification message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HistorySyncNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.HistorySyncNotification; + + /** + * Verifies a HistorySyncNotification message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HistorySyncNotification message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HistorySyncNotification + */ + public static fromObject(object: { [k: string]: any }): proto.Message.HistorySyncNotification; + + /** + * Creates a plain object from a HistorySyncNotification message. Also converts values to other types if specified. + * @param message HistorySyncNotification + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.HistorySyncNotification, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HistorySyncNotification to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HistorySyncNotification { + + /** HistorySyncType enum. */ + enum HistorySyncType { + INITIAL_BOOTSTRAP = 0, + INITIAL_STATUS_V3 = 1, + FULL = 2, + RECENT = 3, + PUSH_NAME = 4, + NON_BLOCKING_DATA = 5, + ON_DEMAND = 6 + } + } + + /** Properties of an ImageMessage. */ + interface IImageMessage { + + /** ImageMessage url */ + url?: (string|null); + + /** ImageMessage mimetype */ + mimetype?: (string|null); + + /** ImageMessage caption */ + caption?: (string|null); + + /** ImageMessage fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** ImageMessage fileLength */ + fileLength?: (number|Long|null); + + /** ImageMessage height */ + height?: (number|null); + + /** ImageMessage width */ + width?: (number|null); + + /** ImageMessage mediaKey */ + mediaKey?: (Uint8Array|null); + + /** ImageMessage fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** ImageMessage interactiveAnnotations */ + interactiveAnnotations?: (proto.IInteractiveAnnotation[]|null); + + /** ImageMessage directPath */ + directPath?: (string|null); + + /** ImageMessage mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** ImageMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** ImageMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** ImageMessage firstScanSidecar */ + firstScanSidecar?: (Uint8Array|null); + + /** ImageMessage firstScanLength */ + firstScanLength?: (number|null); + + /** ImageMessage experimentGroupId */ + experimentGroupId?: (number|null); + + /** ImageMessage scansSidecar */ + scansSidecar?: (Uint8Array|null); + + /** ImageMessage scanLengths */ + scanLengths?: (number[]|null); + + /** ImageMessage midQualityFileSha256 */ + midQualityFileSha256?: (Uint8Array|null); + + /** ImageMessage midQualityFileEncSha256 */ + midQualityFileEncSha256?: (Uint8Array|null); + + /** ImageMessage viewOnce */ + viewOnce?: (boolean|null); + + /** ImageMessage thumbnailDirectPath */ + thumbnailDirectPath?: (string|null); + + /** ImageMessage thumbnailSha256 */ + thumbnailSha256?: (Uint8Array|null); + + /** ImageMessage thumbnailEncSha256 */ + thumbnailEncSha256?: (Uint8Array|null); + + /** ImageMessage staticUrl */ + staticUrl?: (string|null); + } + + /** Represents an ImageMessage. */ + class ImageMessage implements IImageMessage { + + /** + * Constructs a new ImageMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IImageMessage); + + /** ImageMessage url. */ + public url: string; + + /** ImageMessage mimetype. */ + public mimetype: string; + + /** ImageMessage caption. */ + public caption: string; + + /** ImageMessage fileSha256. */ + public fileSha256: Uint8Array; + + /** ImageMessage fileLength. */ + public fileLength: (number|Long); + + /** ImageMessage height. */ + public height: number; + + /** ImageMessage width. */ + public width: number; + + /** ImageMessage mediaKey. */ + public mediaKey: Uint8Array; + + /** ImageMessage fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** ImageMessage interactiveAnnotations. */ + public interactiveAnnotations: proto.IInteractiveAnnotation[]; + + /** ImageMessage directPath. */ + public directPath: string; + + /** ImageMessage mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** ImageMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** ImageMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** ImageMessage firstScanSidecar. */ + public firstScanSidecar: Uint8Array; + + /** ImageMessage firstScanLength. */ + public firstScanLength: number; + + /** ImageMessage experimentGroupId. */ + public experimentGroupId: number; + + /** ImageMessage scansSidecar. */ + public scansSidecar: Uint8Array; + + /** ImageMessage scanLengths. */ + public scanLengths: number[]; + + /** ImageMessage midQualityFileSha256. */ + public midQualityFileSha256: Uint8Array; + + /** ImageMessage midQualityFileEncSha256. */ + public midQualityFileEncSha256: Uint8Array; + + /** ImageMessage viewOnce. */ + public viewOnce: boolean; + + /** ImageMessage thumbnailDirectPath. */ + public thumbnailDirectPath: string; + + /** ImageMessage thumbnailSha256. */ + public thumbnailSha256: Uint8Array; + + /** ImageMessage thumbnailEncSha256. */ + public thumbnailEncSha256: Uint8Array; + + /** ImageMessage staticUrl. */ + public staticUrl: string; + + /** + * Creates a new ImageMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ImageMessage instance + */ + public static create(properties?: proto.Message.IImageMessage): proto.Message.ImageMessage; + + /** + * Encodes the specified ImageMessage message. Does not implicitly {@link proto.Message.ImageMessage.verify|verify} messages. + * @param message ImageMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IImageMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImageMessage message, length delimited. Does not implicitly {@link proto.Message.ImageMessage.verify|verify} messages. + * @param message ImageMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IImageMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImageMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImageMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ImageMessage; + + /** + * Decodes an ImageMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImageMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ImageMessage; + + /** + * Verifies an ImageMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImageMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImageMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ImageMessage; + + /** + * Creates a plain object from an ImageMessage message. Also converts values to other types if specified. + * @param message ImageMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ImageMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImageMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an InitialSecurityNotificationSettingSync. */ + interface IInitialSecurityNotificationSettingSync { + + /** InitialSecurityNotificationSettingSync securityNotificationEnabled */ + securityNotificationEnabled?: (boolean|null); + } + + /** Represents an InitialSecurityNotificationSettingSync. */ + class InitialSecurityNotificationSettingSync implements IInitialSecurityNotificationSettingSync { + + /** + * Constructs a new InitialSecurityNotificationSettingSync. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IInitialSecurityNotificationSettingSync); + + /** InitialSecurityNotificationSettingSync securityNotificationEnabled. */ + public securityNotificationEnabled: boolean; + + /** + * Creates a new InitialSecurityNotificationSettingSync instance using the specified properties. + * @param [properties] Properties to set + * @returns InitialSecurityNotificationSettingSync instance + */ + public static create(properties?: proto.Message.IInitialSecurityNotificationSettingSync): proto.Message.InitialSecurityNotificationSettingSync; + + /** + * Encodes the specified InitialSecurityNotificationSettingSync message. Does not implicitly {@link proto.Message.InitialSecurityNotificationSettingSync.verify|verify} messages. + * @param message InitialSecurityNotificationSettingSync message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IInitialSecurityNotificationSettingSync, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InitialSecurityNotificationSettingSync message, length delimited. Does not implicitly {@link proto.Message.InitialSecurityNotificationSettingSync.verify|verify} messages. + * @param message InitialSecurityNotificationSettingSync message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IInitialSecurityNotificationSettingSync, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InitialSecurityNotificationSettingSync message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InitialSecurityNotificationSettingSync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InitialSecurityNotificationSettingSync; + + /** + * Decodes an InitialSecurityNotificationSettingSync message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InitialSecurityNotificationSettingSync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InitialSecurityNotificationSettingSync; + + /** + * Verifies an InitialSecurityNotificationSettingSync message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InitialSecurityNotificationSettingSync message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InitialSecurityNotificationSettingSync + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InitialSecurityNotificationSettingSync; + + /** + * Creates a plain object from an InitialSecurityNotificationSettingSync message. Also converts values to other types if specified. + * @param message InitialSecurityNotificationSettingSync + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InitialSecurityNotificationSettingSync, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InitialSecurityNotificationSettingSync to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an InteractiveMessage. */ + interface IInteractiveMessage { + + /** InteractiveMessage header */ + header?: (proto.Message.InteractiveMessage.IHeader|null); + + /** InteractiveMessage body */ + body?: (proto.Message.InteractiveMessage.IBody|null); + + /** InteractiveMessage footer */ + footer?: (proto.Message.InteractiveMessage.IFooter|null); + + /** InteractiveMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** InteractiveMessage shopStorefrontMessage */ + shopStorefrontMessage?: (proto.Message.InteractiveMessage.IShopMessage|null); + + /** InteractiveMessage collectionMessage */ + collectionMessage?: (proto.Message.InteractiveMessage.ICollectionMessage|null); + + /** InteractiveMessage nativeFlowMessage */ + nativeFlowMessage?: (proto.Message.InteractiveMessage.INativeFlowMessage|null); + } + + /** Represents an InteractiveMessage. */ + class InteractiveMessage implements IInteractiveMessage { + + /** + * Constructs a new InteractiveMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IInteractiveMessage); + + /** InteractiveMessage header. */ + public header?: (proto.Message.InteractiveMessage.IHeader|null); + + /** InteractiveMessage body. */ + public body?: (proto.Message.InteractiveMessage.IBody|null); + + /** InteractiveMessage footer. */ + public footer?: (proto.Message.InteractiveMessage.IFooter|null); + + /** InteractiveMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** InteractiveMessage shopStorefrontMessage. */ + public shopStorefrontMessage?: (proto.Message.InteractiveMessage.IShopMessage|null); + + /** InteractiveMessage collectionMessage. */ + public collectionMessage?: (proto.Message.InteractiveMessage.ICollectionMessage|null); + + /** InteractiveMessage nativeFlowMessage. */ + public nativeFlowMessage?: (proto.Message.InteractiveMessage.INativeFlowMessage|null); + + /** InteractiveMessage interactiveMessage. */ + public interactiveMessage?: ("shopStorefrontMessage"|"collectionMessage"|"nativeFlowMessage"); + + /** + * Creates a new InteractiveMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns InteractiveMessage instance + */ + public static create(properties?: proto.Message.IInteractiveMessage): proto.Message.InteractiveMessage; + + /** + * Encodes the specified InteractiveMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.verify|verify} messages. + * @param message InteractiveMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IInteractiveMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InteractiveMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.verify|verify} messages. + * @param message InteractiveMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IInteractiveMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InteractiveMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InteractiveMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage; + + /** + * Decodes an InteractiveMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InteractiveMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage; + + /** + * Verifies an InteractiveMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InteractiveMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InteractiveMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage; + + /** + * Creates a plain object from an InteractiveMessage message. Also converts values to other types if specified. + * @param message InteractiveMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InteractiveMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace InteractiveMessage { + + /** Properties of a Body. */ + interface IBody { + + /** Body text */ + text?: (string|null); + } + + /** Represents a Body. */ + class Body implements IBody { + + /** + * Constructs a new Body. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.IBody); + + /** Body text. */ + public text: string; + + /** + * Creates a new Body instance using the specified properties. + * @param [properties] Properties to set + * @returns Body instance + */ + public static create(properties?: proto.Message.InteractiveMessage.IBody): proto.Message.InteractiveMessage.Body; + + /** + * Encodes the specified Body message. Does not implicitly {@link proto.Message.InteractiveMessage.Body.verify|verify} messages. + * @param message Body message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.IBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Body message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Body.verify|verify} messages. + * @param message Body message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.IBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Body message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.Body; + + /** + * Decodes a Body message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.Body; + + /** + * Verifies a Body message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Body message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Body + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.Body; + + /** + * Creates a plain object from a Body message. Also converts values to other types if specified. + * @param message Body + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.Body, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Body to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CollectionMessage. */ + interface ICollectionMessage { + + /** CollectionMessage bizJid */ + bizJid?: (string|null); + + /** CollectionMessage id */ + id?: (string|null); + + /** CollectionMessage messageVersion */ + messageVersion?: (number|null); + } + + /** Represents a CollectionMessage. */ + class CollectionMessage implements ICollectionMessage { + + /** + * Constructs a new CollectionMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.ICollectionMessage); + + /** CollectionMessage bizJid. */ + public bizJid: string; + + /** CollectionMessage id. */ + public id: string; + + /** CollectionMessage messageVersion. */ + public messageVersion: number; + + /** + * Creates a new CollectionMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns CollectionMessage instance + */ + public static create(properties?: proto.Message.InteractiveMessage.ICollectionMessage): proto.Message.InteractiveMessage.CollectionMessage; + + /** + * Encodes the specified CollectionMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.CollectionMessage.verify|verify} messages. + * @param message CollectionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.ICollectionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CollectionMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.CollectionMessage.verify|verify} messages. + * @param message CollectionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.ICollectionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CollectionMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CollectionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.CollectionMessage; + + /** + * Decodes a CollectionMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CollectionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.CollectionMessage; + + /** + * Verifies a CollectionMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CollectionMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CollectionMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.CollectionMessage; + + /** + * Creates a plain object from a CollectionMessage message. Also converts values to other types if specified. + * @param message CollectionMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.CollectionMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CollectionMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Footer. */ + interface IFooter { + + /** Footer text */ + text?: (string|null); + } + + /** Represents a Footer. */ + class Footer implements IFooter { + + /** + * Constructs a new Footer. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.IFooter); + + /** Footer text. */ + public text: string; + + /** + * Creates a new Footer instance using the specified properties. + * @param [properties] Properties to set + * @returns Footer instance + */ + public static create(properties?: proto.Message.InteractiveMessage.IFooter): proto.Message.InteractiveMessage.Footer; + + /** + * Encodes the specified Footer message. Does not implicitly {@link proto.Message.InteractiveMessage.Footer.verify|verify} messages. + * @param message Footer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.IFooter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Footer message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Footer.verify|verify} messages. + * @param message Footer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.IFooter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Footer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Footer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.Footer; + + /** + * Decodes a Footer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Footer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.Footer; + + /** + * Verifies a Footer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Footer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Footer + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.Footer; + + /** + * Creates a plain object from a Footer message. Also converts values to other types if specified. + * @param message Footer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.Footer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Footer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Header. */ + interface IHeader { + + /** Header title */ + title?: (string|null); + + /** Header subtitle */ + subtitle?: (string|null); + + /** Header hasMediaAttachment */ + hasMediaAttachment?: (boolean|null); + + /** Header documentMessage */ + documentMessage?: (proto.Message.IDocumentMessage|null); + + /** Header imageMessage */ + imageMessage?: (proto.Message.IImageMessage|null); + + /** Header jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** Header videoMessage */ + videoMessage?: (proto.Message.IVideoMessage|null); + } + + /** Represents a Header. */ + class Header implements IHeader { + + /** + * Constructs a new Header. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.IHeader); + + /** Header title. */ + public title: string; + + /** Header subtitle. */ + public subtitle: string; + + /** Header hasMediaAttachment. */ + public hasMediaAttachment: boolean; + + /** Header documentMessage. */ + public documentMessage?: (proto.Message.IDocumentMessage|null); + + /** Header imageMessage. */ + public imageMessage?: (proto.Message.IImageMessage|null); + + /** Header jpegThumbnail. */ + public jpegThumbnail?: (Uint8Array|null); + + /** Header videoMessage. */ + public videoMessage?: (proto.Message.IVideoMessage|null); + + /** Header media. */ + public media?: ("documentMessage"|"imageMessage"|"jpegThumbnail"|"videoMessage"); + + /** + * Creates a new Header instance using the specified properties. + * @param [properties] Properties to set + * @returns Header instance + */ + public static create(properties?: proto.Message.InteractiveMessage.IHeader): proto.Message.InteractiveMessage.Header; + + /** + * Encodes the specified Header message. Does not implicitly {@link proto.Message.InteractiveMessage.Header.verify|verify} messages. + * @param message Header message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.IHeader, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Header message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Header.verify|verify} messages. + * @param message Header message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.IHeader, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Header message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.Header; + + /** + * Decodes a Header message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.Header; + + /** + * Verifies a Header message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Header message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Header + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.Header; + + /** + * Creates a plain object from a Header message. Also converts values to other types if specified. + * @param message Header + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.Header, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Header to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NativeFlowMessage. */ + interface INativeFlowMessage { + + /** NativeFlowMessage buttons */ + buttons?: (proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[]|null); + + /** NativeFlowMessage messageParamsJson */ + messageParamsJson?: (string|null); + + /** NativeFlowMessage messageVersion */ + messageVersion?: (number|null); + } + + /** Represents a NativeFlowMessage. */ + class NativeFlowMessage implements INativeFlowMessage { + + /** + * Constructs a new NativeFlowMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.INativeFlowMessage); + + /** NativeFlowMessage buttons. */ + public buttons: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[]; + + /** NativeFlowMessage messageParamsJson. */ + public messageParamsJson: string; + + /** NativeFlowMessage messageVersion. */ + public messageVersion: number; + + /** + * Creates a new NativeFlowMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns NativeFlowMessage instance + */ + public static create(properties?: proto.Message.InteractiveMessage.INativeFlowMessage): proto.Message.InteractiveMessage.NativeFlowMessage; + + /** + * Encodes the specified NativeFlowMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.verify|verify} messages. + * @param message NativeFlowMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.INativeFlowMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NativeFlowMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.verify|verify} messages. + * @param message NativeFlowMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.INativeFlowMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NativeFlowMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NativeFlowMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.NativeFlowMessage; + + /** + * Decodes a NativeFlowMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NativeFlowMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.NativeFlowMessage; + + /** + * Verifies a NativeFlowMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NativeFlowMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NativeFlowMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.NativeFlowMessage; + + /** + * Creates a plain object from a NativeFlowMessage message. Also converts values to other types if specified. + * @param message NativeFlowMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.NativeFlowMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NativeFlowMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace NativeFlowMessage { + + /** Properties of a NativeFlowButton. */ + interface INativeFlowButton { + + /** NativeFlowButton name */ + name?: (string|null); + + /** NativeFlowButton buttonParamsJson */ + buttonParamsJson?: (string|null); + } + + /** Represents a NativeFlowButton. */ + class NativeFlowButton implements INativeFlowButton { + + /** + * Constructs a new NativeFlowButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton); + + /** NativeFlowButton name. */ + public name: string; + + /** NativeFlowButton buttonParamsJson. */ + public buttonParamsJson: string; + + /** + * Creates a new NativeFlowButton instance using the specified properties. + * @param [properties] Properties to set + * @returns NativeFlowButton instance + */ + public static create(properties?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton): proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton; + + /** + * Encodes the specified NativeFlowButton message. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.verify|verify} messages. + * @param message NativeFlowButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NativeFlowButton message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.verify|verify} messages. + * @param message NativeFlowButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NativeFlowButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NativeFlowButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton; + + /** + * Decodes a NativeFlowButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NativeFlowButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton; + + /** + * Verifies a NativeFlowButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NativeFlowButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NativeFlowButton + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton; + + /** + * Creates a plain object from a NativeFlowButton message. Also converts values to other types if specified. + * @param message NativeFlowButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NativeFlowButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ShopMessage. */ + interface IShopMessage { + + /** ShopMessage id */ + id?: (string|null); + + /** ShopMessage surface */ + surface?: (proto.Message.InteractiveMessage.ShopMessage.Surface|null); + + /** ShopMessage messageVersion */ + messageVersion?: (number|null); + } + + /** Represents a ShopMessage. */ + class ShopMessage implements IShopMessage { + + /** + * Constructs a new ShopMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveMessage.IShopMessage); + + /** ShopMessage id. */ + public id: string; + + /** ShopMessage surface. */ + public surface: proto.Message.InteractiveMessage.ShopMessage.Surface; + + /** ShopMessage messageVersion. */ + public messageVersion: number; + + /** + * Creates a new ShopMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ShopMessage instance + */ + public static create(properties?: proto.Message.InteractiveMessage.IShopMessage): proto.Message.InteractiveMessage.ShopMessage; + + /** + * Encodes the specified ShopMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.ShopMessage.verify|verify} messages. + * @param message ShopMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveMessage.IShopMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShopMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.ShopMessage.verify|verify} messages. + * @param message ShopMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveMessage.IShopMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShopMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShopMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveMessage.ShopMessage; + + /** + * Decodes a ShopMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShopMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveMessage.ShopMessage; + + /** + * Verifies a ShopMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ShopMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShopMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveMessage.ShopMessage; + + /** + * Creates a plain object from a ShopMessage message. Also converts values to other types if specified. + * @param message ShopMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveMessage.ShopMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShopMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ShopMessage { + + /** Surface enum. */ + enum Surface { + UNKNOWN_SURFACE = 0, + FB = 1, + IG = 2, + WA = 3 + } + } + } + + /** Properties of an InteractiveResponseMessage. */ + interface IInteractiveResponseMessage { + + /** InteractiveResponseMessage body */ + body?: (proto.Message.InteractiveResponseMessage.IBody|null); + + /** InteractiveResponseMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** InteractiveResponseMessage nativeFlowResponseMessage */ + nativeFlowResponseMessage?: (proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage|null); + } + + /** Represents an InteractiveResponseMessage. */ + class InteractiveResponseMessage implements IInteractiveResponseMessage { + + /** + * Constructs a new InteractiveResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IInteractiveResponseMessage); + + /** InteractiveResponseMessage body. */ + public body?: (proto.Message.InteractiveResponseMessage.IBody|null); + + /** InteractiveResponseMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** InteractiveResponseMessage nativeFlowResponseMessage. */ + public nativeFlowResponseMessage?: (proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage|null); + + /** InteractiveResponseMessage interactiveResponseMessage. */ + public interactiveResponseMessage?: "nativeFlowResponseMessage"; + + /** + * Creates a new InteractiveResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns InteractiveResponseMessage instance + */ + public static create(properties?: proto.Message.IInteractiveResponseMessage): proto.Message.InteractiveResponseMessage; + + /** + * Encodes the specified InteractiveResponseMessage message. Does not implicitly {@link proto.Message.InteractiveResponseMessage.verify|verify} messages. + * @param message InteractiveResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IInteractiveResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InteractiveResponseMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveResponseMessage.verify|verify} messages. + * @param message InteractiveResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IInteractiveResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InteractiveResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InteractiveResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveResponseMessage; + + /** + * Decodes an InteractiveResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InteractiveResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveResponseMessage; + + /** + * Verifies an InteractiveResponseMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InteractiveResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InteractiveResponseMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveResponseMessage; + + /** + * Creates a plain object from an InteractiveResponseMessage message. Also converts values to other types if specified. + * @param message InteractiveResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InteractiveResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace InteractiveResponseMessage { + + /** Properties of a Body. */ + interface IBody { + + /** Body text */ + text?: (string|null); + } + + /** Represents a Body. */ + class Body implements IBody { + + /** + * Constructs a new Body. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveResponseMessage.IBody); + + /** Body text. */ + public text: string; + + /** + * Creates a new Body instance using the specified properties. + * @param [properties] Properties to set + * @returns Body instance + */ + public static create(properties?: proto.Message.InteractiveResponseMessage.IBody): proto.Message.InteractiveResponseMessage.Body; + + /** + * Encodes the specified Body message. Does not implicitly {@link proto.Message.InteractiveResponseMessage.Body.verify|verify} messages. + * @param message Body message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveResponseMessage.IBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Body message, length delimited. Does not implicitly {@link proto.Message.InteractiveResponseMessage.Body.verify|verify} messages. + * @param message Body message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveResponseMessage.IBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Body message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveResponseMessage.Body; + + /** + * Decodes a Body message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveResponseMessage.Body; + + /** + * Verifies a Body message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Body message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Body + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveResponseMessage.Body; + + /** + * Creates a plain object from a Body message. Also converts values to other types if specified. + * @param message Body + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveResponseMessage.Body, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Body to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NativeFlowResponseMessage. */ + interface INativeFlowResponseMessage { + + /** NativeFlowResponseMessage name */ + name?: (string|null); + + /** NativeFlowResponseMessage paramsJson */ + paramsJson?: (string|null); + + /** NativeFlowResponseMessage version */ + version?: (number|null); + } + + /** Represents a NativeFlowResponseMessage. */ + class NativeFlowResponseMessage implements INativeFlowResponseMessage { + + /** + * Constructs a new NativeFlowResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage); + + /** NativeFlowResponseMessage name. */ + public name: string; + + /** NativeFlowResponseMessage paramsJson. */ + public paramsJson: string; + + /** NativeFlowResponseMessage version. */ + public version: number; + + /** + * Creates a new NativeFlowResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns NativeFlowResponseMessage instance + */ + public static create(properties?: proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage): proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage; + + /** + * Encodes the specified NativeFlowResponseMessage message. Does not implicitly {@link proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.verify|verify} messages. + * @param message NativeFlowResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NativeFlowResponseMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.verify|verify} messages. + * @param message NativeFlowResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NativeFlowResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NativeFlowResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage; + + /** + * Decodes a NativeFlowResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NativeFlowResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage; + + /** + * Verifies a NativeFlowResponseMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NativeFlowResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NativeFlowResponseMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage; + + /** + * Creates a plain object from a NativeFlowResponseMessage message. Also converts values to other types if specified. + * @param message NativeFlowResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NativeFlowResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an InvoiceMessage. */ + interface IInvoiceMessage { + + /** InvoiceMessage note */ + note?: (string|null); + + /** InvoiceMessage token */ + token?: (string|null); + + /** InvoiceMessage attachmentType */ + attachmentType?: (proto.Message.InvoiceMessage.AttachmentType|null); + + /** InvoiceMessage attachmentMimetype */ + attachmentMimetype?: (string|null); + + /** InvoiceMessage attachmentMediaKey */ + attachmentMediaKey?: (Uint8Array|null); + + /** InvoiceMessage attachmentMediaKeyTimestamp */ + attachmentMediaKeyTimestamp?: (number|Long|null); + + /** InvoiceMessage attachmentFileSha256 */ + attachmentFileSha256?: (Uint8Array|null); + + /** InvoiceMessage attachmentFileEncSha256 */ + attachmentFileEncSha256?: (Uint8Array|null); + + /** InvoiceMessage attachmentDirectPath */ + attachmentDirectPath?: (string|null); + + /** InvoiceMessage attachmentJpegThumbnail */ + attachmentJpegThumbnail?: (Uint8Array|null); + } + + /** Represents an InvoiceMessage. */ + class InvoiceMessage implements IInvoiceMessage { + + /** + * Constructs a new InvoiceMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IInvoiceMessage); + + /** InvoiceMessage note. */ + public note: string; + + /** InvoiceMessage token. */ + public token: string; + + /** InvoiceMessage attachmentType. */ + public attachmentType: proto.Message.InvoiceMessage.AttachmentType; + + /** InvoiceMessage attachmentMimetype. */ + public attachmentMimetype: string; + + /** InvoiceMessage attachmentMediaKey. */ + public attachmentMediaKey: Uint8Array; + + /** InvoiceMessage attachmentMediaKeyTimestamp. */ + public attachmentMediaKeyTimestamp: (number|Long); + + /** InvoiceMessage attachmentFileSha256. */ + public attachmentFileSha256: Uint8Array; + + /** InvoiceMessage attachmentFileEncSha256. */ + public attachmentFileEncSha256: Uint8Array; + + /** InvoiceMessage attachmentDirectPath. */ + public attachmentDirectPath: string; + + /** InvoiceMessage attachmentJpegThumbnail. */ + public attachmentJpegThumbnail: Uint8Array; + + /** + * Creates a new InvoiceMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns InvoiceMessage instance + */ + public static create(properties?: proto.Message.IInvoiceMessage): proto.Message.InvoiceMessage; + + /** + * Encodes the specified InvoiceMessage message. Does not implicitly {@link proto.Message.InvoiceMessage.verify|verify} messages. + * @param message InvoiceMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IInvoiceMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InvoiceMessage message, length delimited. Does not implicitly {@link proto.Message.InvoiceMessage.verify|verify} messages. + * @param message InvoiceMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IInvoiceMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InvoiceMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InvoiceMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.InvoiceMessage; + + /** + * Decodes an InvoiceMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InvoiceMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.InvoiceMessage; + + /** + * Verifies an InvoiceMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InvoiceMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InvoiceMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.InvoiceMessage; + + /** + * Creates a plain object from an InvoiceMessage message. Also converts values to other types if specified. + * @param message InvoiceMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.InvoiceMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InvoiceMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace InvoiceMessage { + + /** AttachmentType enum. */ + enum AttachmentType { + IMAGE = 0, + PDF = 1 + } + } + + /** Properties of a KeepInChatMessage. */ + interface IKeepInChatMessage { + + /** KeepInChatMessage key */ + key?: (proto.IMessageKey|null); + + /** KeepInChatMessage keepType */ + keepType?: (proto.KeepType|null); + + /** KeepInChatMessage timestampMs */ + timestampMs?: (number|Long|null); + } + + /** Represents a KeepInChatMessage. */ + class KeepInChatMessage implements IKeepInChatMessage { + + /** + * Constructs a new KeepInChatMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IKeepInChatMessage); + + /** KeepInChatMessage key. */ + public key?: (proto.IMessageKey|null); + + /** KeepInChatMessage keepType. */ + public keepType: proto.KeepType; + + /** KeepInChatMessage timestampMs. */ + public timestampMs: (number|Long); + + /** + * Creates a new KeepInChatMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns KeepInChatMessage instance + */ + public static create(properties?: proto.Message.IKeepInChatMessage): proto.Message.KeepInChatMessage; + + /** + * Encodes the specified KeepInChatMessage message. Does not implicitly {@link proto.Message.KeepInChatMessage.verify|verify} messages. + * @param message KeepInChatMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IKeepInChatMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeepInChatMessage message, length delimited. Does not implicitly {@link proto.Message.KeepInChatMessage.verify|verify} messages. + * @param message KeepInChatMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IKeepInChatMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeepInChatMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeepInChatMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.KeepInChatMessage; + + /** + * Decodes a KeepInChatMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeepInChatMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.KeepInChatMessage; + + /** + * Verifies a KeepInChatMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeepInChatMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeepInChatMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.KeepInChatMessage; + + /** + * Creates a plain object from a KeepInChatMessage message. Also converts values to other types if specified. + * @param message KeepInChatMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.KeepInChatMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeepInChatMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListMessage. */ + interface IListMessage { + + /** ListMessage title */ + title?: (string|null); + + /** ListMessage description */ + description?: (string|null); + + /** ListMessage buttonText */ + buttonText?: (string|null); + + /** ListMessage listType */ + listType?: (proto.Message.ListMessage.ListType|null); + + /** ListMessage sections */ + sections?: (proto.Message.ListMessage.ISection[]|null); + + /** ListMessage productListInfo */ + productListInfo?: (proto.Message.ListMessage.IProductListInfo|null); + + /** ListMessage footerText */ + footerText?: (string|null); + + /** ListMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a ListMessage. */ + class ListMessage implements IListMessage { + + /** + * Constructs a new ListMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IListMessage); + + /** ListMessage title. */ + public title: string; + + /** ListMessage description. */ + public description: string; + + /** ListMessage buttonText. */ + public buttonText: string; + + /** ListMessage listType. */ + public listType: proto.Message.ListMessage.ListType; + + /** ListMessage sections. */ + public sections: proto.Message.ListMessage.ISection[]; + + /** ListMessage productListInfo. */ + public productListInfo?: (proto.Message.ListMessage.IProductListInfo|null); + + /** ListMessage footerText. */ + public footerText: string; + + /** ListMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new ListMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMessage instance + */ + public static create(properties?: proto.Message.IListMessage): proto.Message.ListMessage; + + /** + * Encodes the specified ListMessage message. Does not implicitly {@link proto.Message.ListMessage.verify|verify} messages. + * @param message ListMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IListMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMessage message, length delimited. Does not implicitly {@link proto.Message.ListMessage.verify|verify} messages. + * @param message ListMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IListMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage; + + /** + * Decodes a ListMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage; + + /** + * Verifies a ListMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage; + + /** + * Creates a plain object from a ListMessage message. Also converts values to other types if specified. + * @param message ListMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ListMessage { + + /** ListType enum. */ + enum ListType { + UNKNOWN = 0, + SINGLE_SELECT = 1, + PRODUCT_LIST = 2 + } + + /** Properties of a Product. */ + interface IProduct { + + /** Product productId */ + productId?: (string|null); + } + + /** Represents a Product. */ + class Product implements IProduct { + + /** + * Constructs a new Product. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListMessage.IProduct); + + /** Product productId. */ + public productId: string; + + /** + * Creates a new Product instance using the specified properties. + * @param [properties] Properties to set + * @returns Product instance + */ + public static create(properties?: proto.Message.ListMessage.IProduct): proto.Message.ListMessage.Product; + + /** + * Encodes the specified Product message. Does not implicitly {@link proto.Message.ListMessage.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListMessage.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link proto.Message.ListMessage.Product.verify|verify} messages. + * @param message Product message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListMessage.IProduct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Product message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage.Product; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage.Product; + + /** + * Verifies a Product message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Product + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage.Product; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @param message Product + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage.Product, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Product to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductListHeaderImage. */ + interface IProductListHeaderImage { + + /** ProductListHeaderImage productId */ + productId?: (string|null); + + /** ProductListHeaderImage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + } + + /** Represents a ProductListHeaderImage. */ + class ProductListHeaderImage implements IProductListHeaderImage { + + /** + * Constructs a new ProductListHeaderImage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListMessage.IProductListHeaderImage); + + /** ProductListHeaderImage productId. */ + public productId: string; + + /** ProductListHeaderImage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** + * Creates a new ProductListHeaderImage instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductListHeaderImage instance + */ + public static create(properties?: proto.Message.ListMessage.IProductListHeaderImage): proto.Message.ListMessage.ProductListHeaderImage; + + /** + * Encodes the specified ProductListHeaderImage message. Does not implicitly {@link proto.Message.ListMessage.ProductListHeaderImage.verify|verify} messages. + * @param message ProductListHeaderImage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListMessage.IProductListHeaderImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductListHeaderImage message, length delimited. Does not implicitly {@link proto.Message.ListMessage.ProductListHeaderImage.verify|verify} messages. + * @param message ProductListHeaderImage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListMessage.IProductListHeaderImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductListHeaderImage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductListHeaderImage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage.ProductListHeaderImage; + + /** + * Decodes a ProductListHeaderImage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductListHeaderImage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage.ProductListHeaderImage; + + /** + * Verifies a ProductListHeaderImage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductListHeaderImage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductListHeaderImage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage.ProductListHeaderImage; + + /** + * Creates a plain object from a ProductListHeaderImage message. Also converts values to other types if specified. + * @param message ProductListHeaderImage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage.ProductListHeaderImage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductListHeaderImage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductListInfo. */ + interface IProductListInfo { + + /** ProductListInfo productSections */ + productSections?: (proto.Message.ListMessage.IProductSection[]|null); + + /** ProductListInfo headerImage */ + headerImage?: (proto.Message.ListMessage.IProductListHeaderImage|null); + + /** ProductListInfo businessOwnerJid */ + businessOwnerJid?: (string|null); + } + + /** Represents a ProductListInfo. */ + class ProductListInfo implements IProductListInfo { + + /** + * Constructs a new ProductListInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListMessage.IProductListInfo); + + /** ProductListInfo productSections. */ + public productSections: proto.Message.ListMessage.IProductSection[]; + + /** ProductListInfo headerImage. */ + public headerImage?: (proto.Message.ListMessage.IProductListHeaderImage|null); + + /** ProductListInfo businessOwnerJid. */ + public businessOwnerJid: string; + + /** + * Creates a new ProductListInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductListInfo instance + */ + public static create(properties?: proto.Message.ListMessage.IProductListInfo): proto.Message.ListMessage.ProductListInfo; + + /** + * Encodes the specified ProductListInfo message. Does not implicitly {@link proto.Message.ListMessage.ProductListInfo.verify|verify} messages. + * @param message ProductListInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListMessage.IProductListInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductListInfo message, length delimited. Does not implicitly {@link proto.Message.ListMessage.ProductListInfo.verify|verify} messages. + * @param message ProductListInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListMessage.IProductListInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductListInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductListInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage.ProductListInfo; + + /** + * Decodes a ProductListInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductListInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage.ProductListInfo; + + /** + * Verifies a ProductListInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductListInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductListInfo + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage.ProductListInfo; + + /** + * Creates a plain object from a ProductListInfo message. Also converts values to other types if specified. + * @param message ProductListInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage.ProductListInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductListInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductSection. */ + interface IProductSection { + + /** ProductSection title */ + title?: (string|null); + + /** ProductSection products */ + products?: (proto.Message.ListMessage.IProduct[]|null); + } + + /** Represents a ProductSection. */ + class ProductSection implements IProductSection { + + /** + * Constructs a new ProductSection. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListMessage.IProductSection); + + /** ProductSection title. */ + public title: string; + + /** ProductSection products. */ + public products: proto.Message.ListMessage.IProduct[]; + + /** + * Creates a new ProductSection instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductSection instance + */ + public static create(properties?: proto.Message.ListMessage.IProductSection): proto.Message.ListMessage.ProductSection; + + /** + * Encodes the specified ProductSection message. Does not implicitly {@link proto.Message.ListMessage.ProductSection.verify|verify} messages. + * @param message ProductSection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListMessage.IProductSection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductSection message, length delimited. Does not implicitly {@link proto.Message.ListMessage.ProductSection.verify|verify} messages. + * @param message ProductSection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListMessage.IProductSection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductSection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductSection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage.ProductSection; + + /** + * Decodes a ProductSection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductSection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage.ProductSection; + + /** + * Verifies a ProductSection message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductSection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductSection + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage.ProductSection; + + /** + * Creates a plain object from a ProductSection message. Also converts values to other types if specified. + * @param message ProductSection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage.ProductSection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductSection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Row. */ + interface IRow { + + /** Row title */ + title?: (string|null); + + /** Row description */ + description?: (string|null); + + /** Row rowId */ + rowId?: (string|null); + } + + /** Represents a Row. */ + class Row implements IRow { + + /** + * Constructs a new Row. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListMessage.IRow); + + /** Row title. */ + public title: string; + + /** Row description. */ + public description: string; + + /** Row rowId. */ + public rowId: string; + + /** + * Creates a new Row instance using the specified properties. + * @param [properties] Properties to set + * @returns Row instance + */ + public static create(properties?: proto.Message.ListMessage.IRow): proto.Message.ListMessage.Row; + + /** + * Encodes the specified Row message. Does not implicitly {@link proto.Message.ListMessage.Row.verify|verify} messages. + * @param message Row message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListMessage.IRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Row message, length delimited. Does not implicitly {@link proto.Message.ListMessage.Row.verify|verify} messages. + * @param message Row message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListMessage.IRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Row message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage.Row; + + /** + * Decodes a Row message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage.Row; + + /** + * Verifies a Row message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Row message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Row + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage.Row; + + /** + * Creates a plain object from a Row message. Also converts values to other types if specified. + * @param message Row + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage.Row, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Row to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Section. */ + interface ISection { + + /** Section title */ + title?: (string|null); + + /** Section rows */ + rows?: (proto.Message.ListMessage.IRow[]|null); + } + + /** Represents a Section. */ + class Section implements ISection { + + /** + * Constructs a new Section. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListMessage.ISection); + + /** Section title. */ + public title: string; + + /** Section rows. */ + public rows: proto.Message.ListMessage.IRow[]; + + /** + * Creates a new Section instance using the specified properties. + * @param [properties] Properties to set + * @returns Section instance + */ + public static create(properties?: proto.Message.ListMessage.ISection): proto.Message.ListMessage.Section; + + /** + * Encodes the specified Section message. Does not implicitly {@link proto.Message.ListMessage.Section.verify|verify} messages. + * @param message Section message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListMessage.ISection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Section message, length delimited. Does not implicitly {@link proto.Message.ListMessage.Section.verify|verify} messages. + * @param message Section message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListMessage.ISection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Section message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListMessage.Section; + + /** + * Decodes a Section message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListMessage.Section; + + /** + * Verifies a Section message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Section message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Section + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListMessage.Section; + + /** + * Creates a plain object from a Section message. Also converts values to other types if specified. + * @param message Section + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListMessage.Section, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Section to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ListResponseMessage. */ + interface IListResponseMessage { + + /** ListResponseMessage title */ + title?: (string|null); + + /** ListResponseMessage listType */ + listType?: (proto.Message.ListResponseMessage.ListType|null); + + /** ListResponseMessage singleSelectReply */ + singleSelectReply?: (proto.Message.ListResponseMessage.ISingleSelectReply|null); + + /** ListResponseMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** ListResponseMessage description */ + description?: (string|null); + } + + /** Represents a ListResponseMessage. */ + class ListResponseMessage implements IListResponseMessage { + + /** + * Constructs a new ListResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IListResponseMessage); + + /** ListResponseMessage title. */ + public title: string; + + /** ListResponseMessage listType. */ + public listType: proto.Message.ListResponseMessage.ListType; + + /** ListResponseMessage singleSelectReply. */ + public singleSelectReply?: (proto.Message.ListResponseMessage.ISingleSelectReply|null); + + /** ListResponseMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** ListResponseMessage description. */ + public description: string; + + /** + * Creates a new ListResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ListResponseMessage instance + */ + public static create(properties?: proto.Message.IListResponseMessage): proto.Message.ListResponseMessage; + + /** + * Encodes the specified ListResponseMessage message. Does not implicitly {@link proto.Message.ListResponseMessage.verify|verify} messages. + * @param message ListResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IListResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListResponseMessage message, length delimited. Does not implicitly {@link proto.Message.ListResponseMessage.verify|verify} messages. + * @param message ListResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IListResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListResponseMessage; + + /** + * Decodes a ListResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListResponseMessage; + + /** + * Verifies a ListResponseMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListResponseMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListResponseMessage; + + /** + * Creates a plain object from a ListResponseMessage message. Also converts values to other types if specified. + * @param message ListResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ListResponseMessage { + + /** ListType enum. */ + enum ListType { + UNKNOWN = 0, + SINGLE_SELECT = 1 + } + + /** Properties of a SingleSelectReply. */ + interface ISingleSelectReply { + + /** SingleSelectReply selectedRowId */ + selectedRowId?: (string|null); + } + + /** Represents a SingleSelectReply. */ + class SingleSelectReply implements ISingleSelectReply { + + /** + * Constructs a new SingleSelectReply. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ListResponseMessage.ISingleSelectReply); + + /** SingleSelectReply selectedRowId. */ + public selectedRowId: string; + + /** + * Creates a new SingleSelectReply instance using the specified properties. + * @param [properties] Properties to set + * @returns SingleSelectReply instance + */ + public static create(properties?: proto.Message.ListResponseMessage.ISingleSelectReply): proto.Message.ListResponseMessage.SingleSelectReply; + + /** + * Encodes the specified SingleSelectReply message. Does not implicitly {@link proto.Message.ListResponseMessage.SingleSelectReply.verify|verify} messages. + * @param message SingleSelectReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ListResponseMessage.ISingleSelectReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SingleSelectReply message, length delimited. Does not implicitly {@link proto.Message.ListResponseMessage.SingleSelectReply.verify|verify} messages. + * @param message SingleSelectReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ListResponseMessage.ISingleSelectReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SingleSelectReply message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SingleSelectReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ListResponseMessage.SingleSelectReply; + + /** + * Decodes a SingleSelectReply message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SingleSelectReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ListResponseMessage.SingleSelectReply; + + /** + * Verifies a SingleSelectReply message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SingleSelectReply message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SingleSelectReply + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ListResponseMessage.SingleSelectReply; + + /** + * Creates a plain object from a SingleSelectReply message. Also converts values to other types if specified. + * @param message SingleSelectReply + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ListResponseMessage.SingleSelectReply, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SingleSelectReply to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a LiveLocationMessage. */ + interface ILiveLocationMessage { + + /** LiveLocationMessage degreesLatitude */ + degreesLatitude?: (number|null); + + /** LiveLocationMessage degreesLongitude */ + degreesLongitude?: (number|null); + + /** LiveLocationMessage accuracyInMeters */ + accuracyInMeters?: (number|null); + + /** LiveLocationMessage speedInMps */ + speedInMps?: (number|null); + + /** LiveLocationMessage degreesClockwiseFromMagneticNorth */ + degreesClockwiseFromMagneticNorth?: (number|null); + + /** LiveLocationMessage caption */ + caption?: (string|null); + + /** LiveLocationMessage sequenceNumber */ + sequenceNumber?: (number|Long|null); + + /** LiveLocationMessage timeOffset */ + timeOffset?: (number|null); + + /** LiveLocationMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** LiveLocationMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a LiveLocationMessage. */ + class LiveLocationMessage implements ILiveLocationMessage { + + /** + * Constructs a new LiveLocationMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ILiveLocationMessage); + + /** LiveLocationMessage degreesLatitude. */ + public degreesLatitude: number; + + /** LiveLocationMessage degreesLongitude. */ + public degreesLongitude: number; + + /** LiveLocationMessage accuracyInMeters. */ + public accuracyInMeters: number; + + /** LiveLocationMessage speedInMps. */ + public speedInMps: number; + + /** LiveLocationMessage degreesClockwiseFromMagneticNorth. */ + public degreesClockwiseFromMagneticNorth: number; + + /** LiveLocationMessage caption. */ + public caption: string; + + /** LiveLocationMessage sequenceNumber. */ + public sequenceNumber: (number|Long); + + /** LiveLocationMessage timeOffset. */ + public timeOffset: number; + + /** LiveLocationMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** LiveLocationMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new LiveLocationMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns LiveLocationMessage instance + */ + public static create(properties?: proto.Message.ILiveLocationMessage): proto.Message.LiveLocationMessage; + + /** + * Encodes the specified LiveLocationMessage message. Does not implicitly {@link proto.Message.LiveLocationMessage.verify|verify} messages. + * @param message LiveLocationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ILiveLocationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LiveLocationMessage message, length delimited. Does not implicitly {@link proto.Message.LiveLocationMessage.verify|verify} messages. + * @param message LiveLocationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ILiveLocationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LiveLocationMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LiveLocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.LiveLocationMessage; + + /** + * Decodes a LiveLocationMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LiveLocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.LiveLocationMessage; + + /** + * Verifies a LiveLocationMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LiveLocationMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LiveLocationMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.LiveLocationMessage; + + /** + * Creates a plain object from a LiveLocationMessage message. Also converts values to other types if specified. + * @param message LiveLocationMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.LiveLocationMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LiveLocationMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LocationMessage. */ + interface ILocationMessage { + + /** LocationMessage degreesLatitude */ + degreesLatitude?: (number|null); + + /** LocationMessage degreesLongitude */ + degreesLongitude?: (number|null); + + /** LocationMessage name */ + name?: (string|null); + + /** LocationMessage address */ + address?: (string|null); + + /** LocationMessage url */ + url?: (string|null); + + /** LocationMessage isLive */ + isLive?: (boolean|null); + + /** LocationMessage accuracyInMeters */ + accuracyInMeters?: (number|null); + + /** LocationMessage speedInMps */ + speedInMps?: (number|null); + + /** LocationMessage degreesClockwiseFromMagneticNorth */ + degreesClockwiseFromMagneticNorth?: (number|null); + + /** LocationMessage comment */ + comment?: (string|null); + + /** LocationMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** LocationMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a LocationMessage. */ + class LocationMessage implements ILocationMessage { + + /** + * Constructs a new LocationMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ILocationMessage); + + /** LocationMessage degreesLatitude. */ + public degreesLatitude: number; + + /** LocationMessage degreesLongitude. */ + public degreesLongitude: number; + + /** LocationMessage name. */ + public name: string; + + /** LocationMessage address. */ + public address: string; + + /** LocationMessage url. */ + public url: string; + + /** LocationMessage isLive. */ + public isLive: boolean; + + /** LocationMessage accuracyInMeters. */ + public accuracyInMeters: number; + + /** LocationMessage speedInMps. */ + public speedInMps: number; + + /** LocationMessage degreesClockwiseFromMagneticNorth. */ + public degreesClockwiseFromMagneticNorth: number; + + /** LocationMessage comment. */ + public comment: string; + + /** LocationMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** LocationMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new LocationMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationMessage instance + */ + public static create(properties?: proto.Message.ILocationMessage): proto.Message.LocationMessage; + + /** + * Encodes the specified LocationMessage message. Does not implicitly {@link proto.Message.LocationMessage.verify|verify} messages. + * @param message LocationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ILocationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationMessage message, length delimited. Does not implicitly {@link proto.Message.LocationMessage.verify|verify} messages. + * @param message LocationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ILocationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.LocationMessage; + + /** + * Decodes a LocationMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.LocationMessage; + + /** + * Verifies a LocationMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.LocationMessage; + + /** + * Creates a plain object from a LocationMessage message. Also converts values to other types if specified. + * @param message LocationMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.LocationMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an OrderMessage. */ + interface IOrderMessage { + + /** OrderMessage orderId */ + orderId?: (string|null); + + /** OrderMessage thumbnail */ + thumbnail?: (Uint8Array|null); + + /** OrderMessage itemCount */ + itemCount?: (number|null); + + /** OrderMessage status */ + status?: (proto.Message.OrderMessage.OrderStatus|null); + + /** OrderMessage surface */ + surface?: (proto.Message.OrderMessage.OrderSurface|null); + + /** OrderMessage message */ + message?: (string|null); + + /** OrderMessage orderTitle */ + orderTitle?: (string|null); + + /** OrderMessage sellerJid */ + sellerJid?: (string|null); + + /** OrderMessage token */ + token?: (string|null); + + /** OrderMessage totalAmount1000 */ + totalAmount1000?: (number|Long|null); + + /** OrderMessage totalCurrencyCode */ + totalCurrencyCode?: (string|null); + + /** OrderMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents an OrderMessage. */ + class OrderMessage implements IOrderMessage { + + /** + * Constructs a new OrderMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IOrderMessage); + + /** OrderMessage orderId. */ + public orderId: string; + + /** OrderMessage thumbnail. */ + public thumbnail: Uint8Array; + + /** OrderMessage itemCount. */ + public itemCount: number; + + /** OrderMessage status. */ + public status: proto.Message.OrderMessage.OrderStatus; + + /** OrderMessage surface. */ + public surface: proto.Message.OrderMessage.OrderSurface; + + /** OrderMessage message. */ + public message: string; + + /** OrderMessage orderTitle. */ + public orderTitle: string; + + /** OrderMessage sellerJid. */ + public sellerJid: string; + + /** OrderMessage token. */ + public token: string; + + /** OrderMessage totalAmount1000. */ + public totalAmount1000: (number|Long); + + /** OrderMessage totalCurrencyCode. */ + public totalCurrencyCode: string; + + /** OrderMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new OrderMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns OrderMessage instance + */ + public static create(properties?: proto.Message.IOrderMessage): proto.Message.OrderMessage; + + /** + * Encodes the specified OrderMessage message. Does not implicitly {@link proto.Message.OrderMessage.verify|verify} messages. + * @param message OrderMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IOrderMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OrderMessage message, length delimited. Does not implicitly {@link proto.Message.OrderMessage.verify|verify} messages. + * @param message OrderMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IOrderMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OrderMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OrderMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.OrderMessage; + + /** + * Decodes an OrderMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OrderMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.OrderMessage; + + /** + * Verifies an OrderMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OrderMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OrderMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.OrderMessage; + + /** + * Creates a plain object from an OrderMessage message. Also converts values to other types if specified. + * @param message OrderMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.OrderMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OrderMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace OrderMessage { + + /** OrderStatus enum. */ + enum OrderStatus { + INQUIRY = 1 + } + + /** OrderSurface enum. */ + enum OrderSurface { + CATALOG = 1 + } + } + + /** Properties of a PaymentInviteMessage. */ + interface IPaymentInviteMessage { + + /** PaymentInviteMessage serviceType */ + serviceType?: (proto.Message.PaymentInviteMessage.ServiceType|null); + + /** PaymentInviteMessage expiryTimestamp */ + expiryTimestamp?: (number|Long|null); + } + + /** Represents a PaymentInviteMessage. */ + class PaymentInviteMessage implements IPaymentInviteMessage { + + /** + * Constructs a new PaymentInviteMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPaymentInviteMessage); + + /** PaymentInviteMessage serviceType. */ + public serviceType: proto.Message.PaymentInviteMessage.ServiceType; + + /** PaymentInviteMessage expiryTimestamp. */ + public expiryTimestamp: (number|Long); + + /** + * Creates a new PaymentInviteMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PaymentInviteMessage instance + */ + public static create(properties?: proto.Message.IPaymentInviteMessage): proto.Message.PaymentInviteMessage; + + /** + * Encodes the specified PaymentInviteMessage message. Does not implicitly {@link proto.Message.PaymentInviteMessage.verify|verify} messages. + * @param message PaymentInviteMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPaymentInviteMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PaymentInviteMessage message, length delimited. Does not implicitly {@link proto.Message.PaymentInviteMessage.verify|verify} messages. + * @param message PaymentInviteMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPaymentInviteMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PaymentInviteMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PaymentInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PaymentInviteMessage; + + /** + * Decodes a PaymentInviteMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PaymentInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PaymentInviteMessage; + + /** + * Verifies a PaymentInviteMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PaymentInviteMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PaymentInviteMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PaymentInviteMessage; + + /** + * Creates a plain object from a PaymentInviteMessage message. Also converts values to other types if specified. + * @param message PaymentInviteMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PaymentInviteMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PaymentInviteMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PaymentInviteMessage { + + /** ServiceType enum. */ + enum ServiceType { + UNKNOWN = 0, + FBPAY = 1, + NOVI = 2, + UPI = 3 + } + } + + /** Properties of a PeerDataOperationRequestMessage. */ + interface IPeerDataOperationRequestMessage { + + /** PeerDataOperationRequestMessage peerDataOperationRequestType */ + peerDataOperationRequestType?: (proto.Message.PeerDataOperationRequestType|null); + + /** PeerDataOperationRequestMessage requestStickerReupload */ + requestStickerReupload?: (proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload[]|null); + + /** PeerDataOperationRequestMessage requestUrlPreview */ + requestUrlPreview?: (proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview[]|null); + + /** PeerDataOperationRequestMessage historySyncOnDemandRequest */ + historySyncOnDemandRequest?: (proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest|null); + } + + /** Represents a PeerDataOperationRequestMessage. */ + class PeerDataOperationRequestMessage implements IPeerDataOperationRequestMessage { + + /** + * Constructs a new PeerDataOperationRequestMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPeerDataOperationRequestMessage); + + /** PeerDataOperationRequestMessage peerDataOperationRequestType. */ + public peerDataOperationRequestType: proto.Message.PeerDataOperationRequestType; + + /** PeerDataOperationRequestMessage requestStickerReupload. */ + public requestStickerReupload: proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload[]; + + /** PeerDataOperationRequestMessage requestUrlPreview. */ + public requestUrlPreview: proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview[]; + + /** PeerDataOperationRequestMessage historySyncOnDemandRequest. */ + public historySyncOnDemandRequest?: (proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest|null); + + /** + * Creates a new PeerDataOperationRequestMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PeerDataOperationRequestMessage instance + */ + public static create(properties?: proto.Message.IPeerDataOperationRequestMessage): proto.Message.PeerDataOperationRequestMessage; + + /** + * Encodes the specified PeerDataOperationRequestMessage message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.verify|verify} messages. + * @param message PeerDataOperationRequestMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPeerDataOperationRequestMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PeerDataOperationRequestMessage message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.verify|verify} messages. + * @param message PeerDataOperationRequestMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPeerDataOperationRequestMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PeerDataOperationRequestMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PeerDataOperationRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestMessage; + + /** + * Decodes a PeerDataOperationRequestMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PeerDataOperationRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestMessage; + + /** + * Verifies a PeerDataOperationRequestMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PeerDataOperationRequestMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PeerDataOperationRequestMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestMessage; + + /** + * Creates a plain object from a PeerDataOperationRequestMessage message. Also converts values to other types if specified. + * @param message PeerDataOperationRequestMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PeerDataOperationRequestMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PeerDataOperationRequestMessage { + + /** Properties of a HistorySyncOnDemandRequest. */ + interface IHistorySyncOnDemandRequest { + + /** HistorySyncOnDemandRequest chatJid */ + chatJid?: (string|null); + + /** HistorySyncOnDemandRequest oldestMsgId */ + oldestMsgId?: (string|null); + + /** HistorySyncOnDemandRequest oldestMsgFromMe */ + oldestMsgFromMe?: (boolean|null); + + /** HistorySyncOnDemandRequest onDemandMsgCount */ + onDemandMsgCount?: (number|null); + + /** HistorySyncOnDemandRequest oldestMsgTimestampMs */ + oldestMsgTimestampMs?: (number|Long|null); + } + + /** Represents a HistorySyncOnDemandRequest. */ + class HistorySyncOnDemandRequest implements IHistorySyncOnDemandRequest { + + /** + * Constructs a new HistorySyncOnDemandRequest. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest); + + /** HistorySyncOnDemandRequest chatJid. */ + public chatJid: string; + + /** HistorySyncOnDemandRequest oldestMsgId. */ + public oldestMsgId: string; + + /** HistorySyncOnDemandRequest oldestMsgFromMe. */ + public oldestMsgFromMe: boolean; + + /** HistorySyncOnDemandRequest onDemandMsgCount. */ + public onDemandMsgCount: number; + + /** HistorySyncOnDemandRequest oldestMsgTimestampMs. */ + public oldestMsgTimestampMs: (number|Long); + + /** + * Creates a new HistorySyncOnDemandRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns HistorySyncOnDemandRequest instance + */ + public static create(properties?: proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest): proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest; + + /** + * Encodes the specified HistorySyncOnDemandRequest message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.verify|verify} messages. + * @param message HistorySyncOnDemandRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HistorySyncOnDemandRequest message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.verify|verify} messages. + * @param message HistorySyncOnDemandRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HistorySyncOnDemandRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HistorySyncOnDemandRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest; + + /** + * Decodes a HistorySyncOnDemandRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HistorySyncOnDemandRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest; + + /** + * Verifies a HistorySyncOnDemandRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HistorySyncOnDemandRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HistorySyncOnDemandRequest + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest; + + /** + * Creates a plain object from a HistorySyncOnDemandRequest message. Also converts values to other types if specified. + * @param message HistorySyncOnDemandRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HistorySyncOnDemandRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RequestStickerReupload. */ + interface IRequestStickerReupload { + + /** RequestStickerReupload fileSha256 */ + fileSha256?: (string|null); + } + + /** Represents a RequestStickerReupload. */ + class RequestStickerReupload implements IRequestStickerReupload { + + /** + * Constructs a new RequestStickerReupload. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload); + + /** RequestStickerReupload fileSha256. */ + public fileSha256: string; + + /** + * Creates a new RequestStickerReupload instance using the specified properties. + * @param [properties] Properties to set + * @returns RequestStickerReupload instance + */ + public static create(properties?: proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload): proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload; + + /** + * Encodes the specified RequestStickerReupload message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.verify|verify} messages. + * @param message RequestStickerReupload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RequestStickerReupload message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.verify|verify} messages. + * @param message RequestStickerReupload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RequestStickerReupload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RequestStickerReupload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload; + + /** + * Decodes a RequestStickerReupload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RequestStickerReupload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload; + + /** + * Verifies a RequestStickerReupload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RequestStickerReupload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RequestStickerReupload + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload; + + /** + * Creates a plain object from a RequestStickerReupload message. Also converts values to other types if specified. + * @param message RequestStickerReupload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RequestStickerReupload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RequestUrlPreview. */ + interface IRequestUrlPreview { + + /** RequestUrlPreview url */ + url?: (string|null); + } + + /** Represents a RequestUrlPreview. */ + class RequestUrlPreview implements IRequestUrlPreview { + + /** + * Constructs a new RequestUrlPreview. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview); + + /** RequestUrlPreview url. */ + public url: string; + + /** + * Creates a new RequestUrlPreview instance using the specified properties. + * @param [properties] Properties to set + * @returns RequestUrlPreview instance + */ + public static create(properties?: proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview): proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview; + + /** + * Encodes the specified RequestUrlPreview message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.verify|verify} messages. + * @param message RequestUrlPreview message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RequestUrlPreview message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.verify|verify} messages. + * @param message RequestUrlPreview message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RequestUrlPreview message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RequestUrlPreview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview; + + /** + * Decodes a RequestUrlPreview message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RequestUrlPreview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview; + + /** + * Verifies a RequestUrlPreview message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RequestUrlPreview message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RequestUrlPreview + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview; + + /** + * Creates a plain object from a RequestUrlPreview message. Also converts values to other types if specified. + * @param message RequestUrlPreview + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RequestUrlPreview to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PeerDataOperationRequestResponseMessage. */ + interface IPeerDataOperationRequestResponseMessage { + + /** PeerDataOperationRequestResponseMessage peerDataOperationRequestType */ + peerDataOperationRequestType?: (proto.Message.PeerDataOperationRequestType|null); + + /** PeerDataOperationRequestResponseMessage stanzaId */ + stanzaId?: (string|null); + + /** PeerDataOperationRequestResponseMessage peerDataOperationResult */ + peerDataOperationResult?: (proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult[]|null); + } + + /** Represents a PeerDataOperationRequestResponseMessage. */ + class PeerDataOperationRequestResponseMessage implements IPeerDataOperationRequestResponseMessage { + + /** + * Constructs a new PeerDataOperationRequestResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPeerDataOperationRequestResponseMessage); + + /** PeerDataOperationRequestResponseMessage peerDataOperationRequestType. */ + public peerDataOperationRequestType: proto.Message.PeerDataOperationRequestType; + + /** PeerDataOperationRequestResponseMessage stanzaId. */ + public stanzaId: string; + + /** PeerDataOperationRequestResponseMessage peerDataOperationResult. */ + public peerDataOperationResult: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult[]; + + /** + * Creates a new PeerDataOperationRequestResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PeerDataOperationRequestResponseMessage instance + */ + public static create(properties?: proto.Message.IPeerDataOperationRequestResponseMessage): proto.Message.PeerDataOperationRequestResponseMessage; + + /** + * Encodes the specified PeerDataOperationRequestResponseMessage message. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.verify|verify} messages. + * @param message PeerDataOperationRequestResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPeerDataOperationRequestResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PeerDataOperationRequestResponseMessage message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.verify|verify} messages. + * @param message PeerDataOperationRequestResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPeerDataOperationRequestResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PeerDataOperationRequestResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PeerDataOperationRequestResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestResponseMessage; + + /** + * Decodes a PeerDataOperationRequestResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PeerDataOperationRequestResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestResponseMessage; + + /** + * Verifies a PeerDataOperationRequestResponseMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PeerDataOperationRequestResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PeerDataOperationRequestResponseMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestResponseMessage; + + /** + * Creates a plain object from a PeerDataOperationRequestResponseMessage message. Also converts values to other types if specified. + * @param message PeerDataOperationRequestResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PeerDataOperationRequestResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PeerDataOperationRequestResponseMessage { + + /** Properties of a PeerDataOperationResult. */ + interface IPeerDataOperationResult { + + /** PeerDataOperationResult mediaUploadResult */ + mediaUploadResult?: (proto.MediaRetryNotification.ResultType|null); + + /** PeerDataOperationResult stickerMessage */ + stickerMessage?: (proto.Message.IStickerMessage|null); + + /** PeerDataOperationResult linkPreviewResponse */ + linkPreviewResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse|null); + } + + /** Represents a PeerDataOperationResult. */ + class PeerDataOperationResult implements IPeerDataOperationResult { + + /** + * Constructs a new PeerDataOperationResult. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult); + + /** PeerDataOperationResult mediaUploadResult. */ + public mediaUploadResult: proto.MediaRetryNotification.ResultType; + + /** PeerDataOperationResult stickerMessage. */ + public stickerMessage?: (proto.Message.IStickerMessage|null); + + /** PeerDataOperationResult linkPreviewResponse. */ + public linkPreviewResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse|null); + + /** + * Creates a new PeerDataOperationResult instance using the specified properties. + * @param [properties] Properties to set + * @returns PeerDataOperationResult instance + */ + public static create(properties?: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult; + + /** + * Encodes the specified PeerDataOperationResult message. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.verify|verify} messages. + * @param message PeerDataOperationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PeerDataOperationResult message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.verify|verify} messages. + * @param message PeerDataOperationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PeerDataOperationResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PeerDataOperationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult; + + /** + * Decodes a PeerDataOperationResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PeerDataOperationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult; + + /** + * Verifies a PeerDataOperationResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PeerDataOperationResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PeerDataOperationResult + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult; + + /** + * Creates a plain object from a PeerDataOperationResult message. Also converts values to other types if specified. + * @param message PeerDataOperationResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PeerDataOperationResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PeerDataOperationResult { + + /** Properties of a LinkPreviewResponse. */ + interface ILinkPreviewResponse { + + /** LinkPreviewResponse url */ + url?: (string|null); + + /** LinkPreviewResponse title */ + title?: (string|null); + + /** LinkPreviewResponse description */ + description?: (string|null); + + /** LinkPreviewResponse thumbData */ + thumbData?: (Uint8Array|null); + + /** LinkPreviewResponse canonicalUrl */ + canonicalUrl?: (string|null); + + /** LinkPreviewResponse matchText */ + matchText?: (string|null); + + /** LinkPreviewResponse previewType */ + previewType?: (string|null); + } + + /** Represents a LinkPreviewResponse. */ + class LinkPreviewResponse implements ILinkPreviewResponse { + + /** + * Constructs a new LinkPreviewResponse. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse); + + /** LinkPreviewResponse url. */ + public url: string; + + /** LinkPreviewResponse title. */ + public title: string; + + /** LinkPreviewResponse description. */ + public description: string; + + /** LinkPreviewResponse thumbData. */ + public thumbData: Uint8Array; + + /** LinkPreviewResponse canonicalUrl. */ + public canonicalUrl: string; + + /** LinkPreviewResponse matchText. */ + public matchText: string; + + /** LinkPreviewResponse previewType. */ + public previewType: string; + + /** + * Creates a new LinkPreviewResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns LinkPreviewResponse instance + */ + public static create(properties?: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse; + + /** + * Encodes the specified LinkPreviewResponse message. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.verify|verify} messages. + * @param message LinkPreviewResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LinkPreviewResponse message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.verify|verify} messages. + * @param message LinkPreviewResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LinkPreviewResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LinkPreviewResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse; + + /** + * Decodes a LinkPreviewResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LinkPreviewResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse; + + /** + * Verifies a LinkPreviewResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LinkPreviewResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LinkPreviewResponse + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse; + + /** + * Creates a plain object from a LinkPreviewResponse message. Also converts values to other types if specified. + * @param message LinkPreviewResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LinkPreviewResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + + /** PeerDataOperationRequestType enum. */ + enum PeerDataOperationRequestType { + UPLOAD_STICKER = 0, + SEND_RECENT_STICKER_BOOTSTRAP = 1, + GENERATE_LINK_PREVIEW = 2, + HISTORY_SYNC_ON_DEMAND = 3 + } + + /** Properties of a PinMessage. */ + interface IPinMessage { + + /** PinMessage key */ + key?: (proto.IMessageKey|null); + + /** PinMessage pinMessageType */ + pinMessageType?: (proto.Message.PinMessage.PinMessageType|null); + + /** PinMessage senderTimestampMs */ + senderTimestampMs?: (number|Long|null); + } + + /** Represents a PinMessage. */ + class PinMessage implements IPinMessage { + + /** + * Constructs a new PinMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPinMessage); + + /** PinMessage key. */ + public key?: (proto.IMessageKey|null); + + /** PinMessage pinMessageType. */ + public pinMessageType: proto.Message.PinMessage.PinMessageType; + + /** PinMessage senderTimestampMs. */ + public senderTimestampMs: (number|Long); + + /** + * Creates a new PinMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PinMessage instance + */ + public static create(properties?: proto.Message.IPinMessage): proto.Message.PinMessage; + + /** + * Encodes the specified PinMessage message. Does not implicitly {@link proto.Message.PinMessage.verify|verify} messages. + * @param message PinMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPinMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PinMessage message, length delimited. Does not implicitly {@link proto.Message.PinMessage.verify|verify} messages. + * @param message PinMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPinMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PinMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PinMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PinMessage; + + /** + * Decodes a PinMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PinMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PinMessage; + + /** + * Verifies a PinMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PinMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PinMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PinMessage; + + /** + * Creates a plain object from a PinMessage message. Also converts values to other types if specified. + * @param message PinMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PinMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PinMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PinMessage { + + /** PinMessageType enum. */ + enum PinMessageType { + UNKNOWN_PIN_MESSAGE_TYPE = 0, + PIN_FOR_ALL = 1, + UNPIN_FOR_ALL = 2 + } + } + + /** Properties of a PollCreationMessage. */ + interface IPollCreationMessage { + + /** PollCreationMessage encKey */ + encKey?: (Uint8Array|null); + + /** PollCreationMessage name */ + name?: (string|null); + + /** PollCreationMessage options */ + options?: (proto.Message.PollCreationMessage.IOption[]|null); + + /** PollCreationMessage selectableOptionsCount */ + selectableOptionsCount?: (number|null); + + /** PollCreationMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a PollCreationMessage. */ + class PollCreationMessage implements IPollCreationMessage { + + /** + * Constructs a new PollCreationMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPollCreationMessage); + + /** PollCreationMessage encKey. */ + public encKey: Uint8Array; + + /** PollCreationMessage name. */ + public name: string; + + /** PollCreationMessage options. */ + public options: proto.Message.PollCreationMessage.IOption[]; + + /** PollCreationMessage selectableOptionsCount. */ + public selectableOptionsCount: number; + + /** PollCreationMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new PollCreationMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PollCreationMessage instance + */ + public static create(properties?: proto.Message.IPollCreationMessage): proto.Message.PollCreationMessage; + + /** + * Encodes the specified PollCreationMessage message. Does not implicitly {@link proto.Message.PollCreationMessage.verify|verify} messages. + * @param message PollCreationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPollCreationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollCreationMessage message, length delimited. Does not implicitly {@link proto.Message.PollCreationMessage.verify|verify} messages. + * @param message PollCreationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPollCreationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollCreationMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PollCreationMessage; + + /** + * Decodes a PollCreationMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PollCreationMessage; + + /** + * Verifies a PollCreationMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollCreationMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollCreationMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PollCreationMessage; + + /** + * Creates a plain object from a PollCreationMessage message. Also converts values to other types if specified. + * @param message PollCreationMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PollCreationMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollCreationMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PollCreationMessage { + + /** Properties of an Option. */ + interface IOption { + + /** Option optionName */ + optionName?: (string|null); + } + + /** Represents an Option. */ + class Option implements IOption { + + /** + * Constructs a new Option. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.PollCreationMessage.IOption); + + /** Option optionName. */ + public optionName: string; + + /** + * Creates a new Option instance using the specified properties. + * @param [properties] Properties to set + * @returns Option instance + */ + public static create(properties?: proto.Message.PollCreationMessage.IOption): proto.Message.PollCreationMessage.Option; + + /** + * Encodes the specified Option message. Does not implicitly {@link proto.Message.PollCreationMessage.Option.verify|verify} messages. + * @param message Option message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.PollCreationMessage.IOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Option message, length delimited. Does not implicitly {@link proto.Message.PollCreationMessage.Option.verify|verify} messages. + * @param message Option message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.PollCreationMessage.IOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Option message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Option + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PollCreationMessage.Option; + + /** + * Decodes an Option message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Option + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PollCreationMessage.Option; + + /** + * Verifies an Option message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Option message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Option + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PollCreationMessage.Option; + + /** + * Creates a plain object from an Option message. Also converts values to other types if specified. + * @param message Option + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PollCreationMessage.Option, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Option to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PollEncValue. */ + interface IPollEncValue { + + /** PollEncValue encPayload */ + encPayload?: (Uint8Array|null); + + /** PollEncValue encIv */ + encIv?: (Uint8Array|null); + } + + /** Represents a PollEncValue. */ + class PollEncValue implements IPollEncValue { + + /** + * Constructs a new PollEncValue. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPollEncValue); + + /** PollEncValue encPayload. */ + public encPayload: Uint8Array; + + /** PollEncValue encIv. */ + public encIv: Uint8Array; + + /** + * Creates a new PollEncValue instance using the specified properties. + * @param [properties] Properties to set + * @returns PollEncValue instance + */ + public static create(properties?: proto.Message.IPollEncValue): proto.Message.PollEncValue; + + /** + * Encodes the specified PollEncValue message. Does not implicitly {@link proto.Message.PollEncValue.verify|verify} messages. + * @param message PollEncValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPollEncValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollEncValue message, length delimited. Does not implicitly {@link proto.Message.PollEncValue.verify|verify} messages. + * @param message PollEncValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPollEncValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollEncValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PollEncValue; + + /** + * Decodes a PollEncValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PollEncValue; + + /** + * Verifies a PollEncValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollEncValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollEncValue + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PollEncValue; + + /** + * Creates a plain object from a PollEncValue message. Also converts values to other types if specified. + * @param message PollEncValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PollEncValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollEncValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PollUpdateMessage. */ + interface IPollUpdateMessage { + + /** PollUpdateMessage pollCreationMessageKey */ + pollCreationMessageKey?: (proto.IMessageKey|null); + + /** PollUpdateMessage vote */ + vote?: (proto.Message.IPollEncValue|null); + + /** PollUpdateMessage metadata */ + metadata?: (proto.Message.IPollUpdateMessageMetadata|null); + + /** PollUpdateMessage senderTimestampMs */ + senderTimestampMs?: (number|Long|null); + } + + /** Represents a PollUpdateMessage. */ + class PollUpdateMessage implements IPollUpdateMessage { + + /** + * Constructs a new PollUpdateMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPollUpdateMessage); + + /** PollUpdateMessage pollCreationMessageKey. */ + public pollCreationMessageKey?: (proto.IMessageKey|null); + + /** PollUpdateMessage vote. */ + public vote?: (proto.Message.IPollEncValue|null); + + /** PollUpdateMessage metadata. */ + public metadata?: (proto.Message.IPollUpdateMessageMetadata|null); + + /** PollUpdateMessage senderTimestampMs. */ + public senderTimestampMs: (number|Long); + + /** + * Creates a new PollUpdateMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PollUpdateMessage instance + */ + public static create(properties?: proto.Message.IPollUpdateMessage): proto.Message.PollUpdateMessage; + + /** + * Encodes the specified PollUpdateMessage message. Does not implicitly {@link proto.Message.PollUpdateMessage.verify|verify} messages. + * @param message PollUpdateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPollUpdateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollUpdateMessage message, length delimited. Does not implicitly {@link proto.Message.PollUpdateMessage.verify|verify} messages. + * @param message PollUpdateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPollUpdateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollUpdateMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollUpdateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PollUpdateMessage; + + /** + * Decodes a PollUpdateMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollUpdateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PollUpdateMessage; + + /** + * Verifies a PollUpdateMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollUpdateMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollUpdateMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PollUpdateMessage; + + /** + * Creates a plain object from a PollUpdateMessage message. Also converts values to other types if specified. + * @param message PollUpdateMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PollUpdateMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollUpdateMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PollUpdateMessageMetadata. */ + interface IPollUpdateMessageMetadata { + } + + /** Represents a PollUpdateMessageMetadata. */ + class PollUpdateMessageMetadata implements IPollUpdateMessageMetadata { + + /** + * Constructs a new PollUpdateMessageMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPollUpdateMessageMetadata); + + /** + * Creates a new PollUpdateMessageMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PollUpdateMessageMetadata instance + */ + public static create(properties?: proto.Message.IPollUpdateMessageMetadata): proto.Message.PollUpdateMessageMetadata; + + /** + * Encodes the specified PollUpdateMessageMetadata message. Does not implicitly {@link proto.Message.PollUpdateMessageMetadata.verify|verify} messages. + * @param message PollUpdateMessageMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPollUpdateMessageMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollUpdateMessageMetadata message, length delimited. Does not implicitly {@link proto.Message.PollUpdateMessageMetadata.verify|verify} messages. + * @param message PollUpdateMessageMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPollUpdateMessageMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollUpdateMessageMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollUpdateMessageMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PollUpdateMessageMetadata; + + /** + * Decodes a PollUpdateMessageMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollUpdateMessageMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PollUpdateMessageMetadata; + + /** + * Verifies a PollUpdateMessageMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollUpdateMessageMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollUpdateMessageMetadata + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PollUpdateMessageMetadata; + + /** + * Creates a plain object from a PollUpdateMessageMetadata message. Also converts values to other types if specified. + * @param message PollUpdateMessageMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PollUpdateMessageMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollUpdateMessageMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PollVoteMessage. */ + interface IPollVoteMessage { + + /** PollVoteMessage selectedOptions */ + selectedOptions?: (Uint8Array[]|null); + } + + /** Represents a PollVoteMessage. */ + class PollVoteMessage implements IPollVoteMessage { + + /** + * Constructs a new PollVoteMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IPollVoteMessage); + + /** PollVoteMessage selectedOptions. */ + public selectedOptions: Uint8Array[]; + + /** + * Creates a new PollVoteMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns PollVoteMessage instance + */ + public static create(properties?: proto.Message.IPollVoteMessage): proto.Message.PollVoteMessage; + + /** + * Encodes the specified PollVoteMessage message. Does not implicitly {@link proto.Message.PollVoteMessage.verify|verify} messages. + * @param message PollVoteMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IPollVoteMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollVoteMessage message, length delimited. Does not implicitly {@link proto.Message.PollVoteMessage.verify|verify} messages. + * @param message PollVoteMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IPollVoteMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollVoteMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollVoteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.PollVoteMessage; + + /** + * Decodes a PollVoteMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollVoteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.PollVoteMessage; + + /** + * Verifies a PollVoteMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollVoteMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollVoteMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.PollVoteMessage; + + /** + * Creates a plain object from a PollVoteMessage message. Also converts values to other types if specified. + * @param message PollVoteMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.PollVoteMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollVoteMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductMessage. */ + interface IProductMessage { + + /** ProductMessage product */ + product?: (proto.Message.ProductMessage.IProductSnapshot|null); + + /** ProductMessage businessOwnerJid */ + businessOwnerJid?: (string|null); + + /** ProductMessage catalog */ + catalog?: (proto.Message.ProductMessage.ICatalogSnapshot|null); + + /** ProductMessage body */ + body?: (string|null); + + /** ProductMessage footer */ + footer?: (string|null); + + /** ProductMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a ProductMessage. */ + class ProductMessage implements IProductMessage { + + /** + * Constructs a new ProductMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IProductMessage); + + /** ProductMessage product. */ + public product?: (proto.Message.ProductMessage.IProductSnapshot|null); + + /** ProductMessage businessOwnerJid. */ + public businessOwnerJid: string; + + /** ProductMessage catalog. */ + public catalog?: (proto.Message.ProductMessage.ICatalogSnapshot|null); + + /** ProductMessage body. */ + public body: string; + + /** ProductMessage footer. */ + public footer: string; + + /** ProductMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new ProductMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductMessage instance + */ + public static create(properties?: proto.Message.IProductMessage): proto.Message.ProductMessage; + + /** + * Encodes the specified ProductMessage message. Does not implicitly {@link proto.Message.ProductMessage.verify|verify} messages. + * @param message ProductMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IProductMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductMessage message, length delimited. Does not implicitly {@link proto.Message.ProductMessage.verify|verify} messages. + * @param message ProductMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IProductMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ProductMessage; + + /** + * Decodes a ProductMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ProductMessage; + + /** + * Verifies a ProductMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ProductMessage; + + /** + * Creates a plain object from a ProductMessage message. Also converts values to other types if specified. + * @param message ProductMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ProductMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ProductMessage { + + /** Properties of a CatalogSnapshot. */ + interface ICatalogSnapshot { + + /** CatalogSnapshot catalogImage */ + catalogImage?: (proto.Message.IImageMessage|null); + + /** CatalogSnapshot title */ + title?: (string|null); + + /** CatalogSnapshot description */ + description?: (string|null); + } + + /** Represents a CatalogSnapshot. */ + class CatalogSnapshot implements ICatalogSnapshot { + + /** + * Constructs a new CatalogSnapshot. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ProductMessage.ICatalogSnapshot); + + /** CatalogSnapshot catalogImage. */ + public catalogImage?: (proto.Message.IImageMessage|null); + + /** CatalogSnapshot title. */ + public title: string; + + /** CatalogSnapshot description. */ + public description: string; + + /** + * Creates a new CatalogSnapshot instance using the specified properties. + * @param [properties] Properties to set + * @returns CatalogSnapshot instance + */ + public static create(properties?: proto.Message.ProductMessage.ICatalogSnapshot): proto.Message.ProductMessage.CatalogSnapshot; + + /** + * Encodes the specified CatalogSnapshot message. Does not implicitly {@link proto.Message.ProductMessage.CatalogSnapshot.verify|verify} messages. + * @param message CatalogSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ProductMessage.ICatalogSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CatalogSnapshot message, length delimited. Does not implicitly {@link proto.Message.ProductMessage.CatalogSnapshot.verify|verify} messages. + * @param message CatalogSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ProductMessage.ICatalogSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CatalogSnapshot message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CatalogSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ProductMessage.CatalogSnapshot; + + /** + * Decodes a CatalogSnapshot message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CatalogSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ProductMessage.CatalogSnapshot; + + /** + * Verifies a CatalogSnapshot message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CatalogSnapshot message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CatalogSnapshot + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ProductMessage.CatalogSnapshot; + + /** + * Creates a plain object from a CatalogSnapshot message. Also converts values to other types if specified. + * @param message CatalogSnapshot + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ProductMessage.CatalogSnapshot, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CatalogSnapshot to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProductSnapshot. */ + interface IProductSnapshot { + + /** ProductSnapshot productImage */ + productImage?: (proto.Message.IImageMessage|null); + + /** ProductSnapshot productId */ + productId?: (string|null); + + /** ProductSnapshot title */ + title?: (string|null); + + /** ProductSnapshot description */ + description?: (string|null); + + /** ProductSnapshot currencyCode */ + currencyCode?: (string|null); + + /** ProductSnapshot priceAmount1000 */ + priceAmount1000?: (number|Long|null); + + /** ProductSnapshot retailerId */ + retailerId?: (string|null); + + /** ProductSnapshot url */ + url?: (string|null); + + /** ProductSnapshot productImageCount */ + productImageCount?: (number|null); + + /** ProductSnapshot firstImageId */ + firstImageId?: (string|null); + + /** ProductSnapshot salePriceAmount1000 */ + salePriceAmount1000?: (number|Long|null); + } + + /** Represents a ProductSnapshot. */ + class ProductSnapshot implements IProductSnapshot { + + /** + * Constructs a new ProductSnapshot. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ProductMessage.IProductSnapshot); + + /** ProductSnapshot productImage. */ + public productImage?: (proto.Message.IImageMessage|null); + + /** ProductSnapshot productId. */ + public productId: string; + + /** ProductSnapshot title. */ + public title: string; + + /** ProductSnapshot description. */ + public description: string; + + /** ProductSnapshot currencyCode. */ + public currencyCode: string; + + /** ProductSnapshot priceAmount1000. */ + public priceAmount1000: (number|Long); + + /** ProductSnapshot retailerId. */ + public retailerId: string; + + /** ProductSnapshot url. */ + public url: string; + + /** ProductSnapshot productImageCount. */ + public productImageCount: number; + + /** ProductSnapshot firstImageId. */ + public firstImageId: string; + + /** ProductSnapshot salePriceAmount1000. */ + public salePriceAmount1000: (number|Long); + + /** + * Creates a new ProductSnapshot instance using the specified properties. + * @param [properties] Properties to set + * @returns ProductSnapshot instance + */ + public static create(properties?: proto.Message.ProductMessage.IProductSnapshot): proto.Message.ProductMessage.ProductSnapshot; + + /** + * Encodes the specified ProductSnapshot message. Does not implicitly {@link proto.Message.ProductMessage.ProductSnapshot.verify|verify} messages. + * @param message ProductSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ProductMessage.IProductSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProductSnapshot message, length delimited. Does not implicitly {@link proto.Message.ProductMessage.ProductSnapshot.verify|verify} messages. + * @param message ProductSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ProductMessage.IProductSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProductSnapshot message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProductSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ProductMessage.ProductSnapshot; + + /** + * Decodes a ProductSnapshot message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProductSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ProductMessage.ProductSnapshot; + + /** + * Verifies a ProductSnapshot message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProductSnapshot message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProductSnapshot + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ProductMessage.ProductSnapshot; + + /** + * Creates a plain object from a ProductSnapshot message. Also converts values to other types if specified. + * @param message ProductSnapshot + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ProductMessage.ProductSnapshot, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProductSnapshot to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ProtocolMessage. */ + interface IProtocolMessage { + + /** ProtocolMessage key */ + key?: (proto.IMessageKey|null); + + /** ProtocolMessage type */ + type?: (proto.Message.ProtocolMessage.Type|null); + + /** ProtocolMessage ephemeralExpiration */ + ephemeralExpiration?: (number|null); + + /** ProtocolMessage ephemeralSettingTimestamp */ + ephemeralSettingTimestamp?: (number|Long|null); + + /** ProtocolMessage historySyncNotification */ + historySyncNotification?: (proto.Message.IHistorySyncNotification|null); + + /** ProtocolMessage appStateSyncKeyShare */ + appStateSyncKeyShare?: (proto.Message.IAppStateSyncKeyShare|null); + + /** ProtocolMessage appStateSyncKeyRequest */ + appStateSyncKeyRequest?: (proto.Message.IAppStateSyncKeyRequest|null); + + /** ProtocolMessage initialSecurityNotificationSettingSync */ + initialSecurityNotificationSettingSync?: (proto.Message.IInitialSecurityNotificationSettingSync|null); + + /** ProtocolMessage appStateFatalExceptionNotification */ + appStateFatalExceptionNotification?: (proto.Message.IAppStateFatalExceptionNotification|null); + + /** ProtocolMessage disappearingMode */ + disappearingMode?: (proto.IDisappearingMode|null); + + /** ProtocolMessage editedMessage */ + editedMessage?: (proto.IMessage|null); + + /** ProtocolMessage timestampMs */ + timestampMs?: (number|Long|null); + + /** ProtocolMessage peerDataOperationRequestMessage */ + peerDataOperationRequestMessage?: (proto.Message.IPeerDataOperationRequestMessage|null); + + /** ProtocolMessage peerDataOperationRequestResponseMessage */ + peerDataOperationRequestResponseMessage?: (proto.Message.IPeerDataOperationRequestResponseMessage|null); + } + + /** Represents a ProtocolMessage. */ + class ProtocolMessage implements IProtocolMessage { + + /** + * Constructs a new ProtocolMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IProtocolMessage); + + /** ProtocolMessage key. */ + public key?: (proto.IMessageKey|null); + + /** ProtocolMessage type. */ + public type: proto.Message.ProtocolMessage.Type; + + /** ProtocolMessage ephemeralExpiration. */ + public ephemeralExpiration: number; + + /** ProtocolMessage ephemeralSettingTimestamp. */ + public ephemeralSettingTimestamp: (number|Long); + + /** ProtocolMessage historySyncNotification. */ + public historySyncNotification?: (proto.Message.IHistorySyncNotification|null); + + /** ProtocolMessage appStateSyncKeyShare. */ + public appStateSyncKeyShare?: (proto.Message.IAppStateSyncKeyShare|null); + + /** ProtocolMessage appStateSyncKeyRequest. */ + public appStateSyncKeyRequest?: (proto.Message.IAppStateSyncKeyRequest|null); + + /** ProtocolMessage initialSecurityNotificationSettingSync. */ + public initialSecurityNotificationSettingSync?: (proto.Message.IInitialSecurityNotificationSettingSync|null); + + /** ProtocolMessage appStateFatalExceptionNotification. */ + public appStateFatalExceptionNotification?: (proto.Message.IAppStateFatalExceptionNotification|null); + + /** ProtocolMessage disappearingMode. */ + public disappearingMode?: (proto.IDisappearingMode|null); + + /** ProtocolMessage editedMessage. */ + public editedMessage?: (proto.IMessage|null); + + /** ProtocolMessage timestampMs. */ + public timestampMs: (number|Long); + + /** ProtocolMessage peerDataOperationRequestMessage. */ + public peerDataOperationRequestMessage?: (proto.Message.IPeerDataOperationRequestMessage|null); + + /** ProtocolMessage peerDataOperationRequestResponseMessage. */ + public peerDataOperationRequestResponseMessage?: (proto.Message.IPeerDataOperationRequestResponseMessage|null); + + /** + * Creates a new ProtocolMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ProtocolMessage instance + */ + public static create(properties?: proto.Message.IProtocolMessage): proto.Message.ProtocolMessage; + + /** + * Encodes the specified ProtocolMessage message. Does not implicitly {@link proto.Message.ProtocolMessage.verify|verify} messages. + * @param message ProtocolMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IProtocolMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProtocolMessage message, length delimited. Does not implicitly {@link proto.Message.ProtocolMessage.verify|verify} messages. + * @param message ProtocolMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IProtocolMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProtocolMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProtocolMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ProtocolMessage; + + /** + * Decodes a ProtocolMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProtocolMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ProtocolMessage; + + /** + * Verifies a ProtocolMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProtocolMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProtocolMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ProtocolMessage; + + /** + * Creates a plain object from a ProtocolMessage message. Also converts values to other types if specified. + * @param message ProtocolMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ProtocolMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProtocolMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ProtocolMessage { + + /** Type enum. */ + enum Type { + REVOKE = 0, + EPHEMERAL_SETTING = 3, + EPHEMERAL_SYNC_RESPONSE = 4, + HISTORY_SYNC_NOTIFICATION = 5, + APP_STATE_SYNC_KEY_SHARE = 6, + APP_STATE_SYNC_KEY_REQUEST = 7, + MSG_FANOUT_BACKFILL_REQUEST = 8, + INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9, + APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10, + SHARE_PHONE_NUMBER = 11, + MESSAGE_EDIT = 14, + PEER_DATA_OPERATION_REQUEST_MESSAGE = 16, + PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17 + } + } + + /** Properties of a ReactionMessage. */ + interface IReactionMessage { + + /** ReactionMessage key */ + key?: (proto.IMessageKey|null); + + /** ReactionMessage text */ + text?: (string|null); + + /** ReactionMessage groupingKey */ + groupingKey?: (string|null); + + /** ReactionMessage senderTimestampMs */ + senderTimestampMs?: (number|Long|null); + } + + /** Represents a ReactionMessage. */ + class ReactionMessage implements IReactionMessage { + + /** + * Constructs a new ReactionMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IReactionMessage); + + /** ReactionMessage key. */ + public key?: (proto.IMessageKey|null); + + /** ReactionMessage text. */ + public text: string; + + /** ReactionMessage groupingKey. */ + public groupingKey: string; + + /** ReactionMessage senderTimestampMs. */ + public senderTimestampMs: (number|Long); + + /** + * Creates a new ReactionMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ReactionMessage instance + */ + public static create(properties?: proto.Message.IReactionMessage): proto.Message.ReactionMessage; + + /** + * Encodes the specified ReactionMessage message. Does not implicitly {@link proto.Message.ReactionMessage.verify|verify} messages. + * @param message ReactionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IReactionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReactionMessage message, length delimited. Does not implicitly {@link proto.Message.ReactionMessage.verify|verify} messages. + * @param message ReactionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IReactionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReactionMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ReactionMessage; + + /** + * Decodes a ReactionMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ReactionMessage; + + /** + * Verifies a ReactionMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReactionMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReactionMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ReactionMessage; + + /** + * Creates a plain object from a ReactionMessage message. Also converts values to other types if specified. + * @param message ReactionMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ReactionMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReactionMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RequestPaymentMessage. */ + interface IRequestPaymentMessage { + + /** RequestPaymentMessage noteMessage */ + noteMessage?: (proto.IMessage|null); + + /** RequestPaymentMessage currencyCodeIso4217 */ + currencyCodeIso4217?: (string|null); + + /** RequestPaymentMessage amount1000 */ + amount1000?: (number|Long|null); + + /** RequestPaymentMessage requestFrom */ + requestFrom?: (string|null); + + /** RequestPaymentMessage expiryTimestamp */ + expiryTimestamp?: (number|Long|null); + + /** RequestPaymentMessage amount */ + amount?: (proto.IMoney|null); + + /** RequestPaymentMessage background */ + background?: (proto.IPaymentBackground|null); + } + + /** Represents a RequestPaymentMessage. */ + class RequestPaymentMessage implements IRequestPaymentMessage { + + /** + * Constructs a new RequestPaymentMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IRequestPaymentMessage); + + /** RequestPaymentMessage noteMessage. */ + public noteMessage?: (proto.IMessage|null); + + /** RequestPaymentMessage currencyCodeIso4217. */ + public currencyCodeIso4217: string; + + /** RequestPaymentMessage amount1000. */ + public amount1000: (number|Long); + + /** RequestPaymentMessage requestFrom. */ + public requestFrom: string; + + /** RequestPaymentMessage expiryTimestamp. */ + public expiryTimestamp: (number|Long); + + /** RequestPaymentMessage amount. */ + public amount?: (proto.IMoney|null); + + /** RequestPaymentMessage background. */ + public background?: (proto.IPaymentBackground|null); + + /** + * Creates a new RequestPaymentMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns RequestPaymentMessage instance + */ + public static create(properties?: proto.Message.IRequestPaymentMessage): proto.Message.RequestPaymentMessage; + + /** + * Encodes the specified RequestPaymentMessage message. Does not implicitly {@link proto.Message.RequestPaymentMessage.verify|verify} messages. + * @param message RequestPaymentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IRequestPaymentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RequestPaymentMessage message, length delimited. Does not implicitly {@link proto.Message.RequestPaymentMessage.verify|verify} messages. + * @param message RequestPaymentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IRequestPaymentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RequestPaymentMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RequestPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.RequestPaymentMessage; + + /** + * Decodes a RequestPaymentMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RequestPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.RequestPaymentMessage; + + /** + * Verifies a RequestPaymentMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RequestPaymentMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RequestPaymentMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.RequestPaymentMessage; + + /** + * Creates a plain object from a RequestPaymentMessage message. Also converts values to other types if specified. + * @param message RequestPaymentMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.RequestPaymentMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RequestPaymentMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RequestPhoneNumberMessage. */ + interface IRequestPhoneNumberMessage { + + /** RequestPhoneNumberMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + } + + /** Represents a RequestPhoneNumberMessage. */ + class RequestPhoneNumberMessage implements IRequestPhoneNumberMessage { + + /** + * Constructs a new RequestPhoneNumberMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IRequestPhoneNumberMessage); + + /** RequestPhoneNumberMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** + * Creates a new RequestPhoneNumberMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns RequestPhoneNumberMessage instance + */ + public static create(properties?: proto.Message.IRequestPhoneNumberMessage): proto.Message.RequestPhoneNumberMessage; + + /** + * Encodes the specified RequestPhoneNumberMessage message. Does not implicitly {@link proto.Message.RequestPhoneNumberMessage.verify|verify} messages. + * @param message RequestPhoneNumberMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IRequestPhoneNumberMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RequestPhoneNumberMessage message, length delimited. Does not implicitly {@link proto.Message.RequestPhoneNumberMessage.verify|verify} messages. + * @param message RequestPhoneNumberMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IRequestPhoneNumberMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RequestPhoneNumberMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RequestPhoneNumberMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.RequestPhoneNumberMessage; + + /** + * Decodes a RequestPhoneNumberMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RequestPhoneNumberMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.RequestPhoneNumberMessage; + + /** + * Verifies a RequestPhoneNumberMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RequestPhoneNumberMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RequestPhoneNumberMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.RequestPhoneNumberMessage; + + /** + * Creates a plain object from a RequestPhoneNumberMessage message. Also converts values to other types if specified. + * @param message RequestPhoneNumberMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.RequestPhoneNumberMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RequestPhoneNumberMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ScheduledCallCreationMessage. */ + interface IScheduledCallCreationMessage { + + /** ScheduledCallCreationMessage scheduledTimestampMs */ + scheduledTimestampMs?: (number|Long|null); + + /** ScheduledCallCreationMessage callType */ + callType?: (proto.Message.ScheduledCallCreationMessage.CallType|null); + + /** ScheduledCallCreationMessage title */ + title?: (string|null); + } + + /** Represents a ScheduledCallCreationMessage. */ + class ScheduledCallCreationMessage implements IScheduledCallCreationMessage { + + /** + * Constructs a new ScheduledCallCreationMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IScheduledCallCreationMessage); + + /** ScheduledCallCreationMessage scheduledTimestampMs. */ + public scheduledTimestampMs: (number|Long); + + /** ScheduledCallCreationMessage callType. */ + public callType: proto.Message.ScheduledCallCreationMessage.CallType; + + /** ScheduledCallCreationMessage title. */ + public title: string; + + /** + * Creates a new ScheduledCallCreationMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ScheduledCallCreationMessage instance + */ + public static create(properties?: proto.Message.IScheduledCallCreationMessage): proto.Message.ScheduledCallCreationMessage; + + /** + * Encodes the specified ScheduledCallCreationMessage message. Does not implicitly {@link proto.Message.ScheduledCallCreationMessage.verify|verify} messages. + * @param message ScheduledCallCreationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IScheduledCallCreationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ScheduledCallCreationMessage message, length delimited. Does not implicitly {@link proto.Message.ScheduledCallCreationMessage.verify|verify} messages. + * @param message ScheduledCallCreationMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IScheduledCallCreationMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ScheduledCallCreationMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ScheduledCallCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ScheduledCallCreationMessage; + + /** + * Decodes a ScheduledCallCreationMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ScheduledCallCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ScheduledCallCreationMessage; + + /** + * Verifies a ScheduledCallCreationMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ScheduledCallCreationMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ScheduledCallCreationMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ScheduledCallCreationMessage; + + /** + * Creates a plain object from a ScheduledCallCreationMessage message. Also converts values to other types if specified. + * @param message ScheduledCallCreationMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ScheduledCallCreationMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ScheduledCallCreationMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ScheduledCallCreationMessage { + + /** CallType enum. */ + enum CallType { + UNKNOWN = 0, + VOICE = 1, + VIDEO = 2 + } + } + + /** Properties of a ScheduledCallEditMessage. */ + interface IScheduledCallEditMessage { + + /** ScheduledCallEditMessage key */ + key?: (proto.IMessageKey|null); + + /** ScheduledCallEditMessage editType */ + editType?: (proto.Message.ScheduledCallEditMessage.EditType|null); + } + + /** Represents a ScheduledCallEditMessage. */ + class ScheduledCallEditMessage implements IScheduledCallEditMessage { + + /** + * Constructs a new ScheduledCallEditMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IScheduledCallEditMessage); + + /** ScheduledCallEditMessage key. */ + public key?: (proto.IMessageKey|null); + + /** ScheduledCallEditMessage editType. */ + public editType: proto.Message.ScheduledCallEditMessage.EditType; + + /** + * Creates a new ScheduledCallEditMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ScheduledCallEditMessage instance + */ + public static create(properties?: proto.Message.IScheduledCallEditMessage): proto.Message.ScheduledCallEditMessage; + + /** + * Encodes the specified ScheduledCallEditMessage message. Does not implicitly {@link proto.Message.ScheduledCallEditMessage.verify|verify} messages. + * @param message ScheduledCallEditMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IScheduledCallEditMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ScheduledCallEditMessage message, length delimited. Does not implicitly {@link proto.Message.ScheduledCallEditMessage.verify|verify} messages. + * @param message ScheduledCallEditMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IScheduledCallEditMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ScheduledCallEditMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ScheduledCallEditMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.ScheduledCallEditMessage; + + /** + * Decodes a ScheduledCallEditMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ScheduledCallEditMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.ScheduledCallEditMessage; + + /** + * Verifies a ScheduledCallEditMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ScheduledCallEditMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ScheduledCallEditMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.ScheduledCallEditMessage; + + /** + * Creates a plain object from a ScheduledCallEditMessage message. Also converts values to other types if specified. + * @param message ScheduledCallEditMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.ScheduledCallEditMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ScheduledCallEditMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ScheduledCallEditMessage { + + /** EditType enum. */ + enum EditType { + UNKNOWN = 0, + CANCEL = 1 + } + } + + /** Properties of a SendPaymentMessage. */ + interface ISendPaymentMessage { + + /** SendPaymentMessage noteMessage */ + noteMessage?: (proto.IMessage|null); + + /** SendPaymentMessage requestMessageKey */ + requestMessageKey?: (proto.IMessageKey|null); + + /** SendPaymentMessage background */ + background?: (proto.IPaymentBackground|null); + } + + /** Represents a SendPaymentMessage. */ + class SendPaymentMessage implements ISendPaymentMessage { + + /** + * Constructs a new SendPaymentMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ISendPaymentMessage); + + /** SendPaymentMessage noteMessage. */ + public noteMessage?: (proto.IMessage|null); + + /** SendPaymentMessage requestMessageKey. */ + public requestMessageKey?: (proto.IMessageKey|null); + + /** SendPaymentMessage background. */ + public background?: (proto.IPaymentBackground|null); + + /** + * Creates a new SendPaymentMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns SendPaymentMessage instance + */ + public static create(properties?: proto.Message.ISendPaymentMessage): proto.Message.SendPaymentMessage; + + /** + * Encodes the specified SendPaymentMessage message. Does not implicitly {@link proto.Message.SendPaymentMessage.verify|verify} messages. + * @param message SendPaymentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ISendPaymentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SendPaymentMessage message, length delimited. Does not implicitly {@link proto.Message.SendPaymentMessage.verify|verify} messages. + * @param message SendPaymentMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ISendPaymentMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SendPaymentMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SendPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.SendPaymentMessage; + + /** + * Decodes a SendPaymentMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SendPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.SendPaymentMessage; + + /** + * Verifies a SendPaymentMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SendPaymentMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SendPaymentMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.SendPaymentMessage; + + /** + * Creates a plain object from a SendPaymentMessage message. Also converts values to other types if specified. + * @param message SendPaymentMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.SendPaymentMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SendPaymentMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SenderKeyDistributionMessage. */ + interface ISenderKeyDistributionMessage { + + /** SenderKeyDistributionMessage groupId */ + groupId?: (string|null); + + /** SenderKeyDistributionMessage axolotlSenderKeyDistributionMessage */ + axolotlSenderKeyDistributionMessage?: (Uint8Array|null); + } + + /** Represents a SenderKeyDistributionMessage. */ + class SenderKeyDistributionMessage implements ISenderKeyDistributionMessage { + + /** + * Constructs a new SenderKeyDistributionMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ISenderKeyDistributionMessage); + + /** SenderKeyDistributionMessage groupId. */ + public groupId: string; + + /** SenderKeyDistributionMessage axolotlSenderKeyDistributionMessage. */ + public axolotlSenderKeyDistributionMessage: Uint8Array; + + /** + * Creates a new SenderKeyDistributionMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns SenderKeyDistributionMessage instance + */ + public static create(properties?: proto.Message.ISenderKeyDistributionMessage): proto.Message.SenderKeyDistributionMessage; + + /** + * Encodes the specified SenderKeyDistributionMessage message. Does not implicitly {@link proto.Message.SenderKeyDistributionMessage.verify|verify} messages. + * @param message SenderKeyDistributionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ISenderKeyDistributionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SenderKeyDistributionMessage message, length delimited. Does not implicitly {@link proto.Message.SenderKeyDistributionMessage.verify|verify} messages. + * @param message SenderKeyDistributionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ISenderKeyDistributionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SenderKeyDistributionMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SenderKeyDistributionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.SenderKeyDistributionMessage; + + /** + * Decodes a SenderKeyDistributionMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SenderKeyDistributionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.SenderKeyDistributionMessage; + + /** + * Verifies a SenderKeyDistributionMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SenderKeyDistributionMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SenderKeyDistributionMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.SenderKeyDistributionMessage; + + /** + * Creates a plain object from a SenderKeyDistributionMessage message. Also converts values to other types if specified. + * @param message SenderKeyDistributionMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.SenderKeyDistributionMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SenderKeyDistributionMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StickerMessage. */ + interface IStickerMessage { + + /** StickerMessage url */ + url?: (string|null); + + /** StickerMessage fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** StickerMessage fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** StickerMessage mediaKey */ + mediaKey?: (Uint8Array|null); + + /** StickerMessage mimetype */ + mimetype?: (string|null); + + /** StickerMessage height */ + height?: (number|null); + + /** StickerMessage width */ + width?: (number|null); + + /** StickerMessage directPath */ + directPath?: (string|null); + + /** StickerMessage fileLength */ + fileLength?: (number|Long|null); + + /** StickerMessage mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** StickerMessage firstFrameLength */ + firstFrameLength?: (number|null); + + /** StickerMessage firstFrameSidecar */ + firstFrameSidecar?: (Uint8Array|null); + + /** StickerMessage isAnimated */ + isAnimated?: (boolean|null); + + /** StickerMessage pngThumbnail */ + pngThumbnail?: (Uint8Array|null); + + /** StickerMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** StickerMessage stickerSentTs */ + stickerSentTs?: (number|Long|null); + + /** StickerMessage isAvatar */ + isAvatar?: (boolean|null); + } + + /** Represents a StickerMessage. */ + class StickerMessage implements IStickerMessage { + + /** + * Constructs a new StickerMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IStickerMessage); + + /** StickerMessage url. */ + public url: string; + + /** StickerMessage fileSha256. */ + public fileSha256: Uint8Array; + + /** StickerMessage fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** StickerMessage mediaKey. */ + public mediaKey: Uint8Array; + + /** StickerMessage mimetype. */ + public mimetype: string; + + /** StickerMessage height. */ + public height: number; + + /** StickerMessage width. */ + public width: number; + + /** StickerMessage directPath. */ + public directPath: string; + + /** StickerMessage fileLength. */ + public fileLength: (number|Long); + + /** StickerMessage mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** StickerMessage firstFrameLength. */ + public firstFrameLength: number; + + /** StickerMessage firstFrameSidecar. */ + public firstFrameSidecar: Uint8Array; + + /** StickerMessage isAnimated. */ + public isAnimated: boolean; + + /** StickerMessage pngThumbnail. */ + public pngThumbnail: Uint8Array; + + /** StickerMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** StickerMessage stickerSentTs. */ + public stickerSentTs: (number|Long); + + /** StickerMessage isAvatar. */ + public isAvatar: boolean; + + /** + * Creates a new StickerMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns StickerMessage instance + */ + public static create(properties?: proto.Message.IStickerMessage): proto.Message.StickerMessage; + + /** + * Encodes the specified StickerMessage message. Does not implicitly {@link proto.Message.StickerMessage.verify|verify} messages. + * @param message StickerMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IStickerMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StickerMessage message, length delimited. Does not implicitly {@link proto.Message.StickerMessage.verify|verify} messages. + * @param message StickerMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IStickerMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StickerMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StickerMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.StickerMessage; + + /** + * Decodes a StickerMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StickerMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.StickerMessage; + + /** + * Verifies a StickerMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StickerMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StickerMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.StickerMessage; + + /** + * Creates a plain object from a StickerMessage message. Also converts values to other types if specified. + * @param message StickerMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.StickerMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StickerMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StickerSyncRMRMessage. */ + interface IStickerSyncRMRMessage { + + /** StickerSyncRMRMessage filehash */ + filehash?: (string[]|null); + + /** StickerSyncRMRMessage rmrSource */ + rmrSource?: (string|null); + + /** StickerSyncRMRMessage requestTimestamp */ + requestTimestamp?: (number|Long|null); + } + + /** Represents a StickerSyncRMRMessage. */ + class StickerSyncRMRMessage implements IStickerSyncRMRMessage { + + /** + * Constructs a new StickerSyncRMRMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IStickerSyncRMRMessage); + + /** StickerSyncRMRMessage filehash. */ + public filehash: string[]; + + /** StickerSyncRMRMessage rmrSource. */ + public rmrSource: string; + + /** StickerSyncRMRMessage requestTimestamp. */ + public requestTimestamp: (number|Long); + + /** + * Creates a new StickerSyncRMRMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns StickerSyncRMRMessage instance + */ + public static create(properties?: proto.Message.IStickerSyncRMRMessage): proto.Message.StickerSyncRMRMessage; + + /** + * Encodes the specified StickerSyncRMRMessage message. Does not implicitly {@link proto.Message.StickerSyncRMRMessage.verify|verify} messages. + * @param message StickerSyncRMRMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IStickerSyncRMRMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StickerSyncRMRMessage message, length delimited. Does not implicitly {@link proto.Message.StickerSyncRMRMessage.verify|verify} messages. + * @param message StickerSyncRMRMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IStickerSyncRMRMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StickerSyncRMRMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StickerSyncRMRMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.StickerSyncRMRMessage; + + /** + * Decodes a StickerSyncRMRMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StickerSyncRMRMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.StickerSyncRMRMessage; + + /** + * Verifies a StickerSyncRMRMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StickerSyncRMRMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StickerSyncRMRMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.StickerSyncRMRMessage; + + /** + * Creates a plain object from a StickerSyncRMRMessage message. Also converts values to other types if specified. + * @param message StickerSyncRMRMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.StickerSyncRMRMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StickerSyncRMRMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TemplateButtonReplyMessage. */ + interface ITemplateButtonReplyMessage { + + /** TemplateButtonReplyMessage selectedId */ + selectedId?: (string|null); + + /** TemplateButtonReplyMessage selectedDisplayText */ + selectedDisplayText?: (string|null); + + /** TemplateButtonReplyMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** TemplateButtonReplyMessage selectedIndex */ + selectedIndex?: (number|null); + } + + /** Represents a TemplateButtonReplyMessage. */ + class TemplateButtonReplyMessage implements ITemplateButtonReplyMessage { + + /** + * Constructs a new TemplateButtonReplyMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ITemplateButtonReplyMessage); + + /** TemplateButtonReplyMessage selectedId. */ + public selectedId: string; + + /** TemplateButtonReplyMessage selectedDisplayText. */ + public selectedDisplayText: string; + + /** TemplateButtonReplyMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** TemplateButtonReplyMessage selectedIndex. */ + public selectedIndex: number; + + /** + * Creates a new TemplateButtonReplyMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns TemplateButtonReplyMessage instance + */ + public static create(properties?: proto.Message.ITemplateButtonReplyMessage): proto.Message.TemplateButtonReplyMessage; + + /** + * Encodes the specified TemplateButtonReplyMessage message. Does not implicitly {@link proto.Message.TemplateButtonReplyMessage.verify|verify} messages. + * @param message TemplateButtonReplyMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ITemplateButtonReplyMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TemplateButtonReplyMessage message, length delimited. Does not implicitly {@link proto.Message.TemplateButtonReplyMessage.verify|verify} messages. + * @param message TemplateButtonReplyMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ITemplateButtonReplyMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TemplateButtonReplyMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TemplateButtonReplyMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.TemplateButtonReplyMessage; + + /** + * Decodes a TemplateButtonReplyMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TemplateButtonReplyMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.TemplateButtonReplyMessage; + + /** + * Verifies a TemplateButtonReplyMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TemplateButtonReplyMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TemplateButtonReplyMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.TemplateButtonReplyMessage; + + /** + * Creates a plain object from a TemplateButtonReplyMessage message. Also converts values to other types if specified. + * @param message TemplateButtonReplyMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.TemplateButtonReplyMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TemplateButtonReplyMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TemplateMessage. */ + interface ITemplateMessage { + + /** TemplateMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** TemplateMessage hydratedTemplate */ + hydratedTemplate?: (proto.Message.TemplateMessage.IHydratedFourRowTemplate|null); + + /** TemplateMessage templateId */ + templateId?: (string|null); + + /** TemplateMessage fourRowTemplate */ + fourRowTemplate?: (proto.Message.TemplateMessage.IFourRowTemplate|null); + + /** TemplateMessage hydratedFourRowTemplate */ + hydratedFourRowTemplate?: (proto.Message.TemplateMessage.IHydratedFourRowTemplate|null); + + /** TemplateMessage interactiveMessageTemplate */ + interactiveMessageTemplate?: (proto.Message.IInteractiveMessage|null); + } + + /** Represents a TemplateMessage. */ + class TemplateMessage implements ITemplateMessage { + + /** + * Constructs a new TemplateMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.ITemplateMessage); + + /** TemplateMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** TemplateMessage hydratedTemplate. */ + public hydratedTemplate?: (proto.Message.TemplateMessage.IHydratedFourRowTemplate|null); + + /** TemplateMessage templateId. */ + public templateId: string; + + /** TemplateMessage fourRowTemplate. */ + public fourRowTemplate?: (proto.Message.TemplateMessage.IFourRowTemplate|null); + + /** TemplateMessage hydratedFourRowTemplate. */ + public hydratedFourRowTemplate?: (proto.Message.TemplateMessage.IHydratedFourRowTemplate|null); + + /** TemplateMessage interactiveMessageTemplate. */ + public interactiveMessageTemplate?: (proto.Message.IInteractiveMessage|null); + + /** TemplateMessage format. */ + public format?: ("fourRowTemplate"|"hydratedFourRowTemplate"|"interactiveMessageTemplate"); + + /** + * Creates a new TemplateMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns TemplateMessage instance + */ + public static create(properties?: proto.Message.ITemplateMessage): proto.Message.TemplateMessage; + + /** + * Encodes the specified TemplateMessage message. Does not implicitly {@link proto.Message.TemplateMessage.verify|verify} messages. + * @param message TemplateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.ITemplateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TemplateMessage message, length delimited. Does not implicitly {@link proto.Message.TemplateMessage.verify|verify} messages. + * @param message TemplateMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.ITemplateMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TemplateMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TemplateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.TemplateMessage; + + /** + * Decodes a TemplateMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TemplateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.TemplateMessage; + + /** + * Verifies a TemplateMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TemplateMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TemplateMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.TemplateMessage; + + /** + * Creates a plain object from a TemplateMessage message. Also converts values to other types if specified. + * @param message TemplateMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.TemplateMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TemplateMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TemplateMessage { + + /** Properties of a FourRowTemplate. */ + interface IFourRowTemplate { + + /** FourRowTemplate content */ + content?: (proto.Message.IHighlyStructuredMessage|null); + + /** FourRowTemplate footer */ + footer?: (proto.Message.IHighlyStructuredMessage|null); + + /** FourRowTemplate buttons */ + buttons?: (proto.ITemplateButton[]|null); + + /** FourRowTemplate documentMessage */ + documentMessage?: (proto.Message.IDocumentMessage|null); + + /** FourRowTemplate highlyStructuredMessage */ + highlyStructuredMessage?: (proto.Message.IHighlyStructuredMessage|null); + + /** FourRowTemplate imageMessage */ + imageMessage?: (proto.Message.IImageMessage|null); + + /** FourRowTemplate videoMessage */ + videoMessage?: (proto.Message.IVideoMessage|null); + + /** FourRowTemplate locationMessage */ + locationMessage?: (proto.Message.ILocationMessage|null); + } + + /** Represents a FourRowTemplate. */ + class FourRowTemplate implements IFourRowTemplate { + + /** + * Constructs a new FourRowTemplate. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.TemplateMessage.IFourRowTemplate); + + /** FourRowTemplate content. */ + public content?: (proto.Message.IHighlyStructuredMessage|null); + + /** FourRowTemplate footer. */ + public footer?: (proto.Message.IHighlyStructuredMessage|null); + + /** FourRowTemplate buttons. */ + public buttons: proto.ITemplateButton[]; + + /** FourRowTemplate documentMessage. */ + public documentMessage?: (proto.Message.IDocumentMessage|null); + + /** FourRowTemplate highlyStructuredMessage. */ + public highlyStructuredMessage?: (proto.Message.IHighlyStructuredMessage|null); + + /** FourRowTemplate imageMessage. */ + public imageMessage?: (proto.Message.IImageMessage|null); + + /** FourRowTemplate videoMessage. */ + public videoMessage?: (proto.Message.IVideoMessage|null); + + /** FourRowTemplate locationMessage. */ + public locationMessage?: (proto.Message.ILocationMessage|null); + + /** FourRowTemplate title. */ + public title?: ("documentMessage"|"highlyStructuredMessage"|"imageMessage"|"videoMessage"|"locationMessage"); + + /** + * Creates a new FourRowTemplate instance using the specified properties. + * @param [properties] Properties to set + * @returns FourRowTemplate instance + */ + public static create(properties?: proto.Message.TemplateMessage.IFourRowTemplate): proto.Message.TemplateMessage.FourRowTemplate; + + /** + * Encodes the specified FourRowTemplate message. Does not implicitly {@link proto.Message.TemplateMessage.FourRowTemplate.verify|verify} messages. + * @param message FourRowTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.TemplateMessage.IFourRowTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FourRowTemplate message, length delimited. Does not implicitly {@link proto.Message.TemplateMessage.FourRowTemplate.verify|verify} messages. + * @param message FourRowTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.TemplateMessage.IFourRowTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FourRowTemplate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.TemplateMessage.FourRowTemplate; + + /** + * Decodes a FourRowTemplate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.TemplateMessage.FourRowTemplate; + + /** + * Verifies a FourRowTemplate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FourRowTemplate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FourRowTemplate + */ + public static fromObject(object: { [k: string]: any }): proto.Message.TemplateMessage.FourRowTemplate; + + /** + * Creates a plain object from a FourRowTemplate message. Also converts values to other types if specified. + * @param message FourRowTemplate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.TemplateMessage.FourRowTemplate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FourRowTemplate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HydratedFourRowTemplate. */ + interface IHydratedFourRowTemplate { + + /** HydratedFourRowTemplate hydratedContentText */ + hydratedContentText?: (string|null); + + /** HydratedFourRowTemplate hydratedFooterText */ + hydratedFooterText?: (string|null); + + /** HydratedFourRowTemplate hydratedButtons */ + hydratedButtons?: (proto.IHydratedTemplateButton[]|null); + + /** HydratedFourRowTemplate templateId */ + templateId?: (string|null); + + /** HydratedFourRowTemplate documentMessage */ + documentMessage?: (proto.Message.IDocumentMessage|null); + + /** HydratedFourRowTemplate hydratedTitleText */ + hydratedTitleText?: (string|null); + + /** HydratedFourRowTemplate imageMessage */ + imageMessage?: (proto.Message.IImageMessage|null); + + /** HydratedFourRowTemplate videoMessage */ + videoMessage?: (proto.Message.IVideoMessage|null); + + /** HydratedFourRowTemplate locationMessage */ + locationMessage?: (proto.Message.ILocationMessage|null); + } + + /** Represents a HydratedFourRowTemplate. */ + class HydratedFourRowTemplate implements IHydratedFourRowTemplate { + + /** + * Constructs a new HydratedFourRowTemplate. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.TemplateMessage.IHydratedFourRowTemplate); + + /** HydratedFourRowTemplate hydratedContentText. */ + public hydratedContentText: string; + + /** HydratedFourRowTemplate hydratedFooterText. */ + public hydratedFooterText: string; + + /** HydratedFourRowTemplate hydratedButtons. */ + public hydratedButtons: proto.IHydratedTemplateButton[]; + + /** HydratedFourRowTemplate templateId. */ + public templateId: string; + + /** HydratedFourRowTemplate documentMessage. */ + public documentMessage?: (proto.Message.IDocumentMessage|null); + + /** HydratedFourRowTemplate hydratedTitleText. */ + public hydratedTitleText?: (string|null); + + /** HydratedFourRowTemplate imageMessage. */ + public imageMessage?: (proto.Message.IImageMessage|null); + + /** HydratedFourRowTemplate videoMessage. */ + public videoMessage?: (proto.Message.IVideoMessage|null); + + /** HydratedFourRowTemplate locationMessage. */ + public locationMessage?: (proto.Message.ILocationMessage|null); + + /** HydratedFourRowTemplate title. */ + public title?: ("documentMessage"|"hydratedTitleText"|"imageMessage"|"videoMessage"|"locationMessage"); + + /** + * Creates a new HydratedFourRowTemplate instance using the specified properties. + * @param [properties] Properties to set + * @returns HydratedFourRowTemplate instance + */ + public static create(properties?: proto.Message.TemplateMessage.IHydratedFourRowTemplate): proto.Message.TemplateMessage.HydratedFourRowTemplate; + + /** + * Encodes the specified HydratedFourRowTemplate message. Does not implicitly {@link proto.Message.TemplateMessage.HydratedFourRowTemplate.verify|verify} messages. + * @param message HydratedFourRowTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.TemplateMessage.IHydratedFourRowTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HydratedFourRowTemplate message, length delimited. Does not implicitly {@link proto.Message.TemplateMessage.HydratedFourRowTemplate.verify|verify} messages. + * @param message HydratedFourRowTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.TemplateMessage.IHydratedFourRowTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HydratedFourRowTemplate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HydratedFourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.TemplateMessage.HydratedFourRowTemplate; + + /** + * Decodes a HydratedFourRowTemplate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HydratedFourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.TemplateMessage.HydratedFourRowTemplate; + + /** + * Verifies a HydratedFourRowTemplate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HydratedFourRowTemplate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HydratedFourRowTemplate + */ + public static fromObject(object: { [k: string]: any }): proto.Message.TemplateMessage.HydratedFourRowTemplate; + + /** + * Creates a plain object from a HydratedFourRowTemplate message. Also converts values to other types if specified. + * @param message HydratedFourRowTemplate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.TemplateMessage.HydratedFourRowTemplate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HydratedFourRowTemplate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a VideoMessage. */ + interface IVideoMessage { + + /** VideoMessage url */ + url?: (string|null); + + /** VideoMessage mimetype */ + mimetype?: (string|null); + + /** VideoMessage fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** VideoMessage fileLength */ + fileLength?: (number|Long|null); + + /** VideoMessage seconds */ + seconds?: (number|null); + + /** VideoMessage mediaKey */ + mediaKey?: (Uint8Array|null); + + /** VideoMessage caption */ + caption?: (string|null); + + /** VideoMessage gifPlayback */ + gifPlayback?: (boolean|null); + + /** VideoMessage height */ + height?: (number|null); + + /** VideoMessage width */ + width?: (number|null); + + /** VideoMessage fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** VideoMessage interactiveAnnotations */ + interactiveAnnotations?: (proto.IInteractiveAnnotation[]|null); + + /** VideoMessage directPath */ + directPath?: (string|null); + + /** VideoMessage mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** VideoMessage jpegThumbnail */ + jpegThumbnail?: (Uint8Array|null); + + /** VideoMessage contextInfo */ + contextInfo?: (proto.IContextInfo|null); + + /** VideoMessage streamingSidecar */ + streamingSidecar?: (Uint8Array|null); + + /** VideoMessage gifAttribution */ + gifAttribution?: (proto.Message.VideoMessage.Attribution|null); + + /** VideoMessage viewOnce */ + viewOnce?: (boolean|null); + + /** VideoMessage thumbnailDirectPath */ + thumbnailDirectPath?: (string|null); + + /** VideoMessage thumbnailSha256 */ + thumbnailSha256?: (Uint8Array|null); + + /** VideoMessage thumbnailEncSha256 */ + thumbnailEncSha256?: (Uint8Array|null); + + /** VideoMessage staticUrl */ + staticUrl?: (string|null); + } + + /** Represents a VideoMessage. */ + class VideoMessage implements IVideoMessage { + + /** + * Constructs a new VideoMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.Message.IVideoMessage); + + /** VideoMessage url. */ + public url: string; + + /** VideoMessage mimetype. */ + public mimetype: string; + + /** VideoMessage fileSha256. */ + public fileSha256: Uint8Array; + + /** VideoMessage fileLength. */ + public fileLength: (number|Long); + + /** VideoMessage seconds. */ + public seconds: number; + + /** VideoMessage mediaKey. */ + public mediaKey: Uint8Array; + + /** VideoMessage caption. */ + public caption: string; + + /** VideoMessage gifPlayback. */ + public gifPlayback: boolean; + + /** VideoMessage height. */ + public height: number; + + /** VideoMessage width. */ + public width: number; + + /** VideoMessage fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** VideoMessage interactiveAnnotations. */ + public interactiveAnnotations: proto.IInteractiveAnnotation[]; + + /** VideoMessage directPath. */ + public directPath: string; + + /** VideoMessage mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** VideoMessage jpegThumbnail. */ + public jpegThumbnail: Uint8Array; + + /** VideoMessage contextInfo. */ + public contextInfo?: (proto.IContextInfo|null); + + /** VideoMessage streamingSidecar. */ + public streamingSidecar: Uint8Array; + + /** VideoMessage gifAttribution. */ + public gifAttribution: proto.Message.VideoMessage.Attribution; + + /** VideoMessage viewOnce. */ + public viewOnce: boolean; + + /** VideoMessage thumbnailDirectPath. */ + public thumbnailDirectPath: string; + + /** VideoMessage thumbnailSha256. */ + public thumbnailSha256: Uint8Array; + + /** VideoMessage thumbnailEncSha256. */ + public thumbnailEncSha256: Uint8Array; + + /** VideoMessage staticUrl. */ + public staticUrl: string; + + /** + * Creates a new VideoMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns VideoMessage instance + */ + public static create(properties?: proto.Message.IVideoMessage): proto.Message.VideoMessage; + + /** + * Encodes the specified VideoMessage message. Does not implicitly {@link proto.Message.VideoMessage.verify|verify} messages. + * @param message VideoMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.Message.IVideoMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VideoMessage message, length delimited. Does not implicitly {@link proto.Message.VideoMessage.verify|verify} messages. + * @param message VideoMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.Message.IVideoMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VideoMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VideoMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Message.VideoMessage; + + /** + * Decodes a VideoMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VideoMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Message.VideoMessage; + + /** + * Verifies a VideoMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VideoMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VideoMessage + */ + public static fromObject(object: { [k: string]: any }): proto.Message.VideoMessage; + + /** + * Creates a plain object from a VideoMessage message. Also converts values to other types if specified. + * @param message VideoMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Message.VideoMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VideoMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace VideoMessage { + + /** Attribution enum. */ + enum Attribution { + NONE = 0, + GIPHY = 1, + TENOR = 2 + } + } + } + + /** Properties of a MessageContextInfo. */ + interface IMessageContextInfo { + + /** MessageContextInfo deviceListMetadata */ + deviceListMetadata?: (proto.IDeviceListMetadata|null); + + /** MessageContextInfo deviceListMetadataVersion */ + deviceListMetadataVersion?: (number|null); + + /** MessageContextInfo messageSecret */ + messageSecret?: (Uint8Array|null); + + /** MessageContextInfo paddingBytes */ + paddingBytes?: (Uint8Array|null); + } + + /** Represents a MessageContextInfo. */ + class MessageContextInfo implements IMessageContextInfo { + + /** + * Constructs a new MessageContextInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMessageContextInfo); + + /** MessageContextInfo deviceListMetadata. */ + public deviceListMetadata?: (proto.IDeviceListMetadata|null); + + /** MessageContextInfo deviceListMetadataVersion. */ + public deviceListMetadataVersion: number; + + /** MessageContextInfo messageSecret. */ + public messageSecret: Uint8Array; + + /** MessageContextInfo paddingBytes. */ + public paddingBytes: Uint8Array; + + /** + * Creates a new MessageContextInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageContextInfo instance + */ + public static create(properties?: proto.IMessageContextInfo): proto.MessageContextInfo; + + /** + * Encodes the specified MessageContextInfo message. Does not implicitly {@link proto.MessageContextInfo.verify|verify} messages. + * @param message MessageContextInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMessageContextInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageContextInfo message, length delimited. Does not implicitly {@link proto.MessageContextInfo.verify|verify} messages. + * @param message MessageContextInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMessageContextInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageContextInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MessageContextInfo; + + /** + * Decodes a MessageContextInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MessageContextInfo; + + /** + * Verifies a MessageContextInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageContextInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageContextInfo + */ + public static fromObject(object: { [k: string]: any }): proto.MessageContextInfo; + + /** + * Creates a plain object from a MessageContextInfo message. Also converts values to other types if specified. + * @param message MessageContextInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MessageContextInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageContextInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MessageKey. */ + interface IMessageKey { + + /** MessageKey remoteJid */ + remoteJid?: (string|null); + + /** MessageKey fromMe */ + fromMe?: (boolean|null); + + /** MessageKey id */ + id?: (string|null); + + /** MessageKey participant */ + participant?: (string|null); + } + + /** Represents a MessageKey. */ + class MessageKey implements IMessageKey { + + /** + * Constructs a new MessageKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMessageKey); + + /** MessageKey remoteJid. */ + public remoteJid: string; + + /** MessageKey fromMe. */ + public fromMe: boolean; + + /** MessageKey id. */ + public id: string; + + /** MessageKey participant. */ + public participant: string; + + /** + * Creates a new MessageKey instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageKey instance + */ + public static create(properties?: proto.IMessageKey): proto.MessageKey; + + /** + * Encodes the specified MessageKey message. Does not implicitly {@link proto.MessageKey.verify|verify} messages. + * @param message MessageKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMessageKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageKey message, length delimited. Does not implicitly {@link proto.MessageKey.verify|verify} messages. + * @param message MessageKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMessageKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MessageKey; + + /** + * Decodes a MessageKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MessageKey; + + /** + * Verifies a MessageKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageKey + */ + public static fromObject(object: { [k: string]: any }): proto.MessageKey; + + /** + * Creates a plain object from a MessageKey message. Also converts values to other types if specified. + * @param message MessageKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MessageKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Money. */ + interface IMoney { + + /** Money value */ + value?: (number|Long|null); + + /** Money offset */ + offset?: (number|null); + + /** Money currencyCode */ + currencyCode?: (string|null); + } + + /** Represents a Money. */ + class Money implements IMoney { + + /** + * Constructs a new Money. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMoney); + + /** Money value. */ + public value: (number|Long); + + /** Money offset. */ + public offset: number; + + /** Money currencyCode. */ + public currencyCode: string; + + /** + * Creates a new Money instance using the specified properties. + * @param [properties] Properties to set + * @returns Money instance + */ + public static create(properties?: proto.IMoney): proto.Money; + + /** + * Encodes the specified Money message. Does not implicitly {@link proto.Money.verify|verify} messages. + * @param message Money message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Money message, length delimited. Does not implicitly {@link proto.Money.verify|verify} messages. + * @param message Money message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Money message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Money; + + /** + * Decodes a Money message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Money; + + /** + * Verifies a Money message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Money message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Money + */ + public static fromObject(object: { [k: string]: any }): proto.Money; + + /** + * Creates a plain object from a Money message. Also converts values to other types if specified. + * @param message Money + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Money, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Money to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MsgOpaqueData. */ + interface IMsgOpaqueData { + + /** MsgOpaqueData body */ + body?: (string|null); + + /** MsgOpaqueData caption */ + caption?: (string|null); + + /** MsgOpaqueData lng */ + lng?: (number|null); + + /** MsgOpaqueData isLive */ + isLive?: (boolean|null); + + /** MsgOpaqueData lat */ + lat?: (number|null); + + /** MsgOpaqueData paymentAmount1000 */ + paymentAmount1000?: (number|null); + + /** MsgOpaqueData paymentNoteMsgBody */ + paymentNoteMsgBody?: (string|null); + + /** MsgOpaqueData canonicalUrl */ + canonicalUrl?: (string|null); + + /** MsgOpaqueData matchedText */ + matchedText?: (string|null); + + /** MsgOpaqueData title */ + title?: (string|null); + + /** MsgOpaqueData description */ + description?: (string|null); + + /** MsgOpaqueData futureproofBuffer */ + futureproofBuffer?: (Uint8Array|null); + + /** MsgOpaqueData clientUrl */ + clientUrl?: (string|null); + + /** MsgOpaqueData loc */ + loc?: (string|null); + + /** MsgOpaqueData pollName */ + pollName?: (string|null); + + /** MsgOpaqueData pollOptions */ + pollOptions?: (proto.MsgOpaqueData.IPollOption[]|null); + + /** MsgOpaqueData pollSelectableOptionsCount */ + pollSelectableOptionsCount?: (number|null); + + /** MsgOpaqueData messageSecret */ + messageSecret?: (Uint8Array|null); + + /** MsgOpaqueData originalSelfAuthor */ + originalSelfAuthor?: (string|null); + + /** MsgOpaqueData senderTimestampMs */ + senderTimestampMs?: (number|Long|null); + + /** MsgOpaqueData pollUpdateParentKey */ + pollUpdateParentKey?: (string|null); + + /** MsgOpaqueData encPollVote */ + encPollVote?: (proto.IPollEncValue|null); + + /** MsgOpaqueData isSentCagPollCreation */ + isSentCagPollCreation?: (boolean|null); + + /** MsgOpaqueData encReactionTargetMessageKey */ + encReactionTargetMessageKey?: (string|null); + + /** MsgOpaqueData encReactionEncPayload */ + encReactionEncPayload?: (Uint8Array|null); + + /** MsgOpaqueData encReactionEncIv */ + encReactionEncIv?: (Uint8Array|null); + } + + /** Represents a MsgOpaqueData. */ + class MsgOpaqueData implements IMsgOpaqueData { + + /** + * Constructs a new MsgOpaqueData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMsgOpaqueData); + + /** MsgOpaqueData body. */ + public body: string; + + /** MsgOpaqueData caption. */ + public caption: string; + + /** MsgOpaqueData lng. */ + public lng: number; + + /** MsgOpaqueData isLive. */ + public isLive: boolean; + + /** MsgOpaqueData lat. */ + public lat: number; + + /** MsgOpaqueData paymentAmount1000. */ + public paymentAmount1000: number; + + /** MsgOpaqueData paymentNoteMsgBody. */ + public paymentNoteMsgBody: string; + + /** MsgOpaqueData canonicalUrl. */ + public canonicalUrl: string; + + /** MsgOpaqueData matchedText. */ + public matchedText: string; + + /** MsgOpaqueData title. */ + public title: string; + + /** MsgOpaqueData description. */ + public description: string; + + /** MsgOpaqueData futureproofBuffer. */ + public futureproofBuffer: Uint8Array; + + /** MsgOpaqueData clientUrl. */ + public clientUrl: string; + + /** MsgOpaqueData loc. */ + public loc: string; + + /** MsgOpaqueData pollName. */ + public pollName: string; + + /** MsgOpaqueData pollOptions. */ + public pollOptions: proto.MsgOpaqueData.IPollOption[]; + + /** MsgOpaqueData pollSelectableOptionsCount. */ + public pollSelectableOptionsCount: number; + + /** MsgOpaqueData messageSecret. */ + public messageSecret: Uint8Array; + + /** MsgOpaqueData originalSelfAuthor. */ + public originalSelfAuthor: string; + + /** MsgOpaqueData senderTimestampMs. */ + public senderTimestampMs: (number|Long); + + /** MsgOpaqueData pollUpdateParentKey. */ + public pollUpdateParentKey: string; + + /** MsgOpaqueData encPollVote. */ + public encPollVote?: (proto.IPollEncValue|null); + + /** MsgOpaqueData isSentCagPollCreation. */ + public isSentCagPollCreation: boolean; + + /** MsgOpaqueData encReactionTargetMessageKey. */ + public encReactionTargetMessageKey: string; + + /** MsgOpaqueData encReactionEncPayload. */ + public encReactionEncPayload: Uint8Array; + + /** MsgOpaqueData encReactionEncIv. */ + public encReactionEncIv: Uint8Array; + + /** + * Creates a new MsgOpaqueData instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgOpaqueData instance + */ + public static create(properties?: proto.IMsgOpaqueData): proto.MsgOpaqueData; + + /** + * Encodes the specified MsgOpaqueData message. Does not implicitly {@link proto.MsgOpaqueData.verify|verify} messages. + * @param message MsgOpaqueData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMsgOpaqueData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MsgOpaqueData message, length delimited. Does not implicitly {@link proto.MsgOpaqueData.verify|verify} messages. + * @param message MsgOpaqueData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMsgOpaqueData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgOpaqueData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MsgOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MsgOpaqueData; + + /** + * Decodes a MsgOpaqueData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MsgOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MsgOpaqueData; + + /** + * Verifies a MsgOpaqueData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MsgOpaqueData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MsgOpaqueData + */ + public static fromObject(object: { [k: string]: any }): proto.MsgOpaqueData; + + /** + * Creates a plain object from a MsgOpaqueData message. Also converts values to other types if specified. + * @param message MsgOpaqueData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MsgOpaqueData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MsgOpaqueData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace MsgOpaqueData { + + /** Properties of a PollOption. */ + interface IPollOption { + + /** PollOption name */ + name?: (string|null); + } + + /** Represents a PollOption. */ + class PollOption implements IPollOption { + + /** + * Constructs a new PollOption. + * @param [properties] Properties to set + */ + constructor(properties?: proto.MsgOpaqueData.IPollOption); + + /** PollOption name. */ + public name: string; + + /** + * Creates a new PollOption instance using the specified properties. + * @param [properties] Properties to set + * @returns PollOption instance + */ + public static create(properties?: proto.MsgOpaqueData.IPollOption): proto.MsgOpaqueData.PollOption; + + /** + * Encodes the specified PollOption message. Does not implicitly {@link proto.MsgOpaqueData.PollOption.verify|verify} messages. + * @param message PollOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.MsgOpaqueData.IPollOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollOption message, length delimited. Does not implicitly {@link proto.MsgOpaqueData.PollOption.verify|verify} messages. + * @param message PollOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.MsgOpaqueData.IPollOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MsgOpaqueData.PollOption; + + /** + * Decodes a PollOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MsgOpaqueData.PollOption; + + /** + * Verifies a PollOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollOption + */ + public static fromObject(object: { [k: string]: any }): proto.MsgOpaqueData.PollOption; + + /** + * Creates a plain object from a PollOption message. Also converts values to other types if specified. + * @param message PollOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MsgOpaqueData.PollOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a MsgRowOpaqueData. */ + interface IMsgRowOpaqueData { + + /** MsgRowOpaqueData currentMsg */ + currentMsg?: (proto.IMsgOpaqueData|null); + + /** MsgRowOpaqueData quotedMsg */ + quotedMsg?: (proto.IMsgOpaqueData|null); + } + + /** Represents a MsgRowOpaqueData. */ + class MsgRowOpaqueData implements IMsgRowOpaqueData { + + /** + * Constructs a new MsgRowOpaqueData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IMsgRowOpaqueData); + + /** MsgRowOpaqueData currentMsg. */ + public currentMsg?: (proto.IMsgOpaqueData|null); + + /** MsgRowOpaqueData quotedMsg. */ + public quotedMsg?: (proto.IMsgOpaqueData|null); + + /** + * Creates a new MsgRowOpaqueData instance using the specified properties. + * @param [properties] Properties to set + * @returns MsgRowOpaqueData instance + */ + public static create(properties?: proto.IMsgRowOpaqueData): proto.MsgRowOpaqueData; + + /** + * Encodes the specified MsgRowOpaqueData message. Does not implicitly {@link proto.MsgRowOpaqueData.verify|verify} messages. + * @param message MsgRowOpaqueData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IMsgRowOpaqueData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MsgRowOpaqueData message, length delimited. Does not implicitly {@link proto.MsgRowOpaqueData.verify|verify} messages. + * @param message MsgRowOpaqueData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IMsgRowOpaqueData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MsgRowOpaqueData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MsgRowOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.MsgRowOpaqueData; + + /** + * Decodes a MsgRowOpaqueData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MsgRowOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.MsgRowOpaqueData; + + /** + * Verifies a MsgRowOpaqueData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MsgRowOpaqueData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MsgRowOpaqueData + */ + public static fromObject(object: { [k: string]: any }): proto.MsgRowOpaqueData; + + /** + * Creates a plain object from a MsgRowOpaqueData message. Also converts values to other types if specified. + * @param message MsgRowOpaqueData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.MsgRowOpaqueData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MsgRowOpaqueData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NoiseCertificate. */ + interface INoiseCertificate { + + /** NoiseCertificate details */ + details?: (Uint8Array|null); + + /** NoiseCertificate signature */ + signature?: (Uint8Array|null); + } + + /** Represents a NoiseCertificate. */ + class NoiseCertificate implements INoiseCertificate { + + /** + * Constructs a new NoiseCertificate. + * @param [properties] Properties to set + */ + constructor(properties?: proto.INoiseCertificate); + + /** NoiseCertificate details. */ + public details: Uint8Array; + + /** NoiseCertificate signature. */ + public signature: Uint8Array; + + /** + * Creates a new NoiseCertificate instance using the specified properties. + * @param [properties] Properties to set + * @returns NoiseCertificate instance + */ + public static create(properties?: proto.INoiseCertificate): proto.NoiseCertificate; + + /** + * Encodes the specified NoiseCertificate message. Does not implicitly {@link proto.NoiseCertificate.verify|verify} messages. + * @param message NoiseCertificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.INoiseCertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NoiseCertificate message, length delimited. Does not implicitly {@link proto.NoiseCertificate.verify|verify} messages. + * @param message NoiseCertificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.INoiseCertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.NoiseCertificate; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.NoiseCertificate; + + /** + * Verifies a NoiseCertificate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NoiseCertificate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NoiseCertificate + */ + public static fromObject(object: { [k: string]: any }): proto.NoiseCertificate; + + /** + * Creates a plain object from a NoiseCertificate message. Also converts values to other types if specified. + * @param message NoiseCertificate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.NoiseCertificate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NoiseCertificate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace NoiseCertificate { + + /** Properties of a Details. */ + interface IDetails { + + /** Details serial */ + serial?: (number|null); + + /** Details issuer */ + issuer?: (string|null); + + /** Details expires */ + expires?: (number|Long|null); + + /** Details subject */ + subject?: (string|null); + + /** Details key */ + key?: (Uint8Array|null); + } + + /** Represents a Details. */ + class Details implements IDetails { + + /** + * Constructs a new Details. + * @param [properties] Properties to set + */ + constructor(properties?: proto.NoiseCertificate.IDetails); + + /** Details serial. */ + public serial: number; + + /** Details issuer. */ + public issuer: string; + + /** Details expires. */ + public expires: (number|Long); + + /** Details subject. */ + public subject: string; + + /** Details key. */ + public key: Uint8Array; + + /** + * Creates a new Details instance using the specified properties. + * @param [properties] Properties to set + * @returns Details instance + */ + public static create(properties?: proto.NoiseCertificate.IDetails): proto.NoiseCertificate.Details; + + /** + * Encodes the specified Details message. Does not implicitly {@link proto.NoiseCertificate.Details.verify|verify} messages. + * @param message Details message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.NoiseCertificate.IDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Details message, length delimited. Does not implicitly {@link proto.NoiseCertificate.Details.verify|verify} messages. + * @param message Details message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.NoiseCertificate.IDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Details message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.NoiseCertificate.Details; + + /** + * Decodes a Details message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.NoiseCertificate.Details; + + /** + * Verifies a Details message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Details message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Details + */ + public static fromObject(object: { [k: string]: any }): proto.NoiseCertificate.Details; + + /** + * Creates a plain object from a Details message. Also converts values to other types if specified. + * @param message Details + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.NoiseCertificate.Details, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Details to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a NotificationMessageInfo. */ + interface INotificationMessageInfo { + + /** NotificationMessageInfo key */ + key?: (proto.IMessageKey|null); + + /** NotificationMessageInfo message */ + message?: (proto.IMessage|null); + + /** NotificationMessageInfo messageTimestamp */ + messageTimestamp?: (number|Long|null); + + /** NotificationMessageInfo participant */ + participant?: (string|null); + } + + /** Represents a NotificationMessageInfo. */ + class NotificationMessageInfo implements INotificationMessageInfo { + + /** + * Constructs a new NotificationMessageInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.INotificationMessageInfo); + + /** NotificationMessageInfo key. */ + public key?: (proto.IMessageKey|null); + + /** NotificationMessageInfo message. */ + public message?: (proto.IMessage|null); + + /** NotificationMessageInfo messageTimestamp. */ + public messageTimestamp: (number|Long); + + /** NotificationMessageInfo participant. */ + public participant: string; + + /** + * Creates a new NotificationMessageInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns NotificationMessageInfo instance + */ + public static create(properties?: proto.INotificationMessageInfo): proto.NotificationMessageInfo; + + /** + * Encodes the specified NotificationMessageInfo message. Does not implicitly {@link proto.NotificationMessageInfo.verify|verify} messages. + * @param message NotificationMessageInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.INotificationMessageInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NotificationMessageInfo message, length delimited. Does not implicitly {@link proto.NotificationMessageInfo.verify|verify} messages. + * @param message NotificationMessageInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.INotificationMessageInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NotificationMessageInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NotificationMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.NotificationMessageInfo; + + /** + * Decodes a NotificationMessageInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NotificationMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.NotificationMessageInfo; + + /** + * Verifies a NotificationMessageInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NotificationMessageInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NotificationMessageInfo + */ + public static fromObject(object: { [k: string]: any }): proto.NotificationMessageInfo; + + /** + * Creates a plain object from a NotificationMessageInfo message. Also converts values to other types if specified. + * @param message NotificationMessageInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.NotificationMessageInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NotificationMessageInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PastParticipant. */ + interface IPastParticipant { + + /** PastParticipant userJid */ + userJid?: (string|null); + + /** PastParticipant leaveReason */ + leaveReason?: (proto.PastParticipant.LeaveReason|null); + + /** PastParticipant leaveTs */ + leaveTs?: (number|Long|null); + } + + /** Represents a PastParticipant. */ + class PastParticipant implements IPastParticipant { + + /** + * Constructs a new PastParticipant. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPastParticipant); + + /** PastParticipant userJid. */ + public userJid: string; + + /** PastParticipant leaveReason. */ + public leaveReason: proto.PastParticipant.LeaveReason; + + /** PastParticipant leaveTs. */ + public leaveTs: (number|Long); + + /** + * Creates a new PastParticipant instance using the specified properties. + * @param [properties] Properties to set + * @returns PastParticipant instance + */ + public static create(properties?: proto.IPastParticipant): proto.PastParticipant; + + /** + * Encodes the specified PastParticipant message. Does not implicitly {@link proto.PastParticipant.verify|verify} messages. + * @param message PastParticipant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPastParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PastParticipant message, length delimited. Does not implicitly {@link proto.PastParticipant.verify|verify} messages. + * @param message PastParticipant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPastParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PastParticipant message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PastParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PastParticipant; + + /** + * Decodes a PastParticipant message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PastParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PastParticipant; + + /** + * Verifies a PastParticipant message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PastParticipant message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PastParticipant + */ + public static fromObject(object: { [k: string]: any }): proto.PastParticipant; + + /** + * Creates a plain object from a PastParticipant message. Also converts values to other types if specified. + * @param message PastParticipant + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PastParticipant, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PastParticipant to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PastParticipant { + + /** LeaveReason enum. */ + enum LeaveReason { + LEFT = 0, + REMOVED = 1 + } + } + + /** Properties of a PastParticipants. */ + interface IPastParticipants { + + /** PastParticipants groupJid */ + groupJid?: (string|null); + + /** PastParticipants pastParticipants */ + pastParticipants?: (proto.IPastParticipant[]|null); + } + + /** Represents a PastParticipants. */ + class PastParticipants implements IPastParticipants { + + /** + * Constructs a new PastParticipants. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPastParticipants); + + /** PastParticipants groupJid. */ + public groupJid: string; + + /** PastParticipants pastParticipants. */ + public pastParticipants: proto.IPastParticipant[]; + + /** + * Creates a new PastParticipants instance using the specified properties. + * @param [properties] Properties to set + * @returns PastParticipants instance + */ + public static create(properties?: proto.IPastParticipants): proto.PastParticipants; + + /** + * Encodes the specified PastParticipants message. Does not implicitly {@link proto.PastParticipants.verify|verify} messages. + * @param message PastParticipants message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPastParticipants, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PastParticipants message, length delimited. Does not implicitly {@link proto.PastParticipants.verify|verify} messages. + * @param message PastParticipants message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPastParticipants, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PastParticipants message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PastParticipants + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PastParticipants; + + /** + * Decodes a PastParticipants message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PastParticipants + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PastParticipants; + + /** + * Verifies a PastParticipants message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PastParticipants message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PastParticipants + */ + public static fromObject(object: { [k: string]: any }): proto.PastParticipants; + + /** + * Creates a plain object from a PastParticipants message. Also converts values to other types if specified. + * @param message PastParticipants + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PastParticipants, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PastParticipants to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PaymentBackground. */ + interface IPaymentBackground { + + /** PaymentBackground id */ + id?: (string|null); + + /** PaymentBackground fileLength */ + fileLength?: (number|Long|null); + + /** PaymentBackground width */ + width?: (number|null); + + /** PaymentBackground height */ + height?: (number|null); + + /** PaymentBackground mimetype */ + mimetype?: (string|null); + + /** PaymentBackground placeholderArgb */ + placeholderArgb?: (number|null); + + /** PaymentBackground textArgb */ + textArgb?: (number|null); + + /** PaymentBackground subtextArgb */ + subtextArgb?: (number|null); + + /** PaymentBackground mediaData */ + mediaData?: (proto.PaymentBackground.IMediaData|null); + + /** PaymentBackground type */ + type?: (proto.PaymentBackground.Type|null); + } + + /** Represents a PaymentBackground. */ + class PaymentBackground implements IPaymentBackground { + + /** + * Constructs a new PaymentBackground. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPaymentBackground); + + /** PaymentBackground id. */ + public id: string; + + /** PaymentBackground fileLength. */ + public fileLength: (number|Long); + + /** PaymentBackground width. */ + public width: number; + + /** PaymentBackground height. */ + public height: number; + + /** PaymentBackground mimetype. */ + public mimetype: string; + + /** PaymentBackground placeholderArgb. */ + public placeholderArgb: number; + + /** PaymentBackground textArgb. */ + public textArgb: number; + + /** PaymentBackground subtextArgb. */ + public subtextArgb: number; + + /** PaymentBackground mediaData. */ + public mediaData?: (proto.PaymentBackground.IMediaData|null); + + /** PaymentBackground type. */ + public type: proto.PaymentBackground.Type; + + /** + * Creates a new PaymentBackground instance using the specified properties. + * @param [properties] Properties to set + * @returns PaymentBackground instance + */ + public static create(properties?: proto.IPaymentBackground): proto.PaymentBackground; + + /** + * Encodes the specified PaymentBackground message. Does not implicitly {@link proto.PaymentBackground.verify|verify} messages. + * @param message PaymentBackground message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPaymentBackground, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PaymentBackground message, length delimited. Does not implicitly {@link proto.PaymentBackground.verify|verify} messages. + * @param message PaymentBackground message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPaymentBackground, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PaymentBackground message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PaymentBackground + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PaymentBackground; + + /** + * Decodes a PaymentBackground message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PaymentBackground + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PaymentBackground; + + /** + * Verifies a PaymentBackground message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PaymentBackground message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PaymentBackground + */ + public static fromObject(object: { [k: string]: any }): proto.PaymentBackground; + + /** + * Creates a plain object from a PaymentBackground message. Also converts values to other types if specified. + * @param message PaymentBackground + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PaymentBackground, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PaymentBackground to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PaymentBackground { + + /** Properties of a MediaData. */ + interface IMediaData { + + /** MediaData mediaKey */ + mediaKey?: (Uint8Array|null); + + /** MediaData mediaKeyTimestamp */ + mediaKeyTimestamp?: (number|Long|null); + + /** MediaData fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** MediaData fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** MediaData directPath */ + directPath?: (string|null); + } + + /** Represents a MediaData. */ + class MediaData implements IMediaData { + + /** + * Constructs a new MediaData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.PaymentBackground.IMediaData); + + /** MediaData mediaKey. */ + public mediaKey: Uint8Array; + + /** MediaData mediaKeyTimestamp. */ + public mediaKeyTimestamp: (number|Long); + + /** MediaData fileSha256. */ + public fileSha256: Uint8Array; + + /** MediaData fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** MediaData directPath. */ + public directPath: string; + + /** + * Creates a new MediaData instance using the specified properties. + * @param [properties] Properties to set + * @returns MediaData instance + */ + public static create(properties?: proto.PaymentBackground.IMediaData): proto.PaymentBackground.MediaData; + + /** + * Encodes the specified MediaData message. Does not implicitly {@link proto.PaymentBackground.MediaData.verify|verify} messages. + * @param message MediaData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.PaymentBackground.IMediaData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MediaData message, length delimited. Does not implicitly {@link proto.PaymentBackground.MediaData.verify|verify} messages. + * @param message MediaData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.PaymentBackground.IMediaData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MediaData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PaymentBackground.MediaData; + + /** + * Decodes a MediaData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PaymentBackground.MediaData; + + /** + * Verifies a MediaData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MediaData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MediaData + */ + public static fromObject(object: { [k: string]: any }): proto.PaymentBackground.MediaData; + + /** + * Creates a plain object from a MediaData message. Also converts values to other types if specified. + * @param message MediaData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PaymentBackground.MediaData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MediaData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Type enum. */ + enum Type { + UNKNOWN = 0, + DEFAULT = 1 + } + } + + /** Properties of a PaymentInfo. */ + interface IPaymentInfo { + + /** PaymentInfo currencyDeprecated */ + currencyDeprecated?: (proto.PaymentInfo.Currency|null); + + /** PaymentInfo amount1000 */ + amount1000?: (number|Long|null); + + /** PaymentInfo receiverJid */ + receiverJid?: (string|null); + + /** PaymentInfo status */ + status?: (proto.PaymentInfo.Status|null); + + /** PaymentInfo transactionTimestamp */ + transactionTimestamp?: (number|Long|null); + + /** PaymentInfo requestMessageKey */ + requestMessageKey?: (proto.IMessageKey|null); + + /** PaymentInfo expiryTimestamp */ + expiryTimestamp?: (number|Long|null); + + /** PaymentInfo futureproofed */ + futureproofed?: (boolean|null); + + /** PaymentInfo currency */ + currency?: (string|null); + + /** PaymentInfo txnStatus */ + txnStatus?: (proto.PaymentInfo.TxnStatus|null); + + /** PaymentInfo useNoviFiatFormat */ + useNoviFiatFormat?: (boolean|null); + + /** PaymentInfo primaryAmount */ + primaryAmount?: (proto.IMoney|null); + + /** PaymentInfo exchangeAmount */ + exchangeAmount?: (proto.IMoney|null); + } + + /** Represents a PaymentInfo. */ + class PaymentInfo implements IPaymentInfo { + + /** + * Constructs a new PaymentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPaymentInfo); + + /** PaymentInfo currencyDeprecated. */ + public currencyDeprecated: proto.PaymentInfo.Currency; + + /** PaymentInfo amount1000. */ + public amount1000: (number|Long); + + /** PaymentInfo receiverJid. */ + public receiverJid: string; + + /** PaymentInfo status. */ + public status: proto.PaymentInfo.Status; + + /** PaymentInfo transactionTimestamp. */ + public transactionTimestamp: (number|Long); + + /** PaymentInfo requestMessageKey. */ + public requestMessageKey?: (proto.IMessageKey|null); + + /** PaymentInfo expiryTimestamp. */ + public expiryTimestamp: (number|Long); + + /** PaymentInfo futureproofed. */ + public futureproofed: boolean; + + /** PaymentInfo currency. */ + public currency: string; + + /** PaymentInfo txnStatus. */ + public txnStatus: proto.PaymentInfo.TxnStatus; + + /** PaymentInfo useNoviFiatFormat. */ + public useNoviFiatFormat: boolean; + + /** PaymentInfo primaryAmount. */ + public primaryAmount?: (proto.IMoney|null); + + /** PaymentInfo exchangeAmount. */ + public exchangeAmount?: (proto.IMoney|null); + + /** + * Creates a new PaymentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PaymentInfo instance + */ + public static create(properties?: proto.IPaymentInfo): proto.PaymentInfo; + + /** + * Encodes the specified PaymentInfo message. Does not implicitly {@link proto.PaymentInfo.verify|verify} messages. + * @param message PaymentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPaymentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PaymentInfo message, length delimited. Does not implicitly {@link proto.PaymentInfo.verify|verify} messages. + * @param message PaymentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPaymentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PaymentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PaymentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PaymentInfo; + + /** + * Decodes a PaymentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PaymentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PaymentInfo; + + /** + * Verifies a PaymentInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PaymentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PaymentInfo + */ + public static fromObject(object: { [k: string]: any }): proto.PaymentInfo; + + /** + * Creates a plain object from a PaymentInfo message. Also converts values to other types if specified. + * @param message PaymentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PaymentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PaymentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PaymentInfo { + + /** Currency enum. */ + enum Currency { + UNKNOWN_CURRENCY = 0, + INR = 1 + } + + /** Status enum. */ + enum Status { + UNKNOWN_STATUS = 0, + PROCESSING = 1, + SENT = 2, + NEED_TO_ACCEPT = 3, + COMPLETE = 4, + COULD_NOT_COMPLETE = 5, + REFUNDED = 6, + EXPIRED = 7, + REJECTED = 8, + CANCELLED = 9, + WAITING_FOR_PAYER = 10, + WAITING = 11 + } + + /** TxnStatus enum. */ + enum TxnStatus { + UNKNOWN = 0, + PENDING_SETUP = 1, + PENDING_RECEIVER_SETUP = 2, + INIT = 3, + SUCCESS = 4, + COMPLETED = 5, + FAILED = 6, + FAILED_RISK = 7, + FAILED_PROCESSING = 8, + FAILED_RECEIVER_PROCESSING = 9, + FAILED_DA = 10, + FAILED_DA_FINAL = 11, + REFUNDED_TXN = 12, + REFUND_FAILED = 13, + REFUND_FAILED_PROCESSING = 14, + REFUND_FAILED_DA = 15, + EXPIRED_TXN = 16, + AUTH_CANCELED = 17, + AUTH_CANCEL_FAILED_PROCESSING = 18, + AUTH_CANCEL_FAILED = 19, + COLLECT_INIT = 20, + COLLECT_SUCCESS = 21, + COLLECT_FAILED = 22, + COLLECT_FAILED_RISK = 23, + COLLECT_REJECTED = 24, + COLLECT_EXPIRED = 25, + COLLECT_CANCELED = 26, + COLLECT_CANCELLING = 27, + IN_REVIEW = 28, + REVERSAL_SUCCESS = 29, + REVERSAL_PENDING = 30, + REFUND_PENDING = 31 + } + } + + /** Properties of a PhotoChange. */ + interface IPhotoChange { + + /** PhotoChange oldPhoto */ + oldPhoto?: (Uint8Array|null); + + /** PhotoChange newPhoto */ + newPhoto?: (Uint8Array|null); + + /** PhotoChange newPhotoId */ + newPhotoId?: (number|null); + } + + /** Represents a PhotoChange. */ + class PhotoChange implements IPhotoChange { + + /** + * Constructs a new PhotoChange. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPhotoChange); + + /** PhotoChange oldPhoto. */ + public oldPhoto: Uint8Array; + + /** PhotoChange newPhoto. */ + public newPhoto: Uint8Array; + + /** PhotoChange newPhotoId. */ + public newPhotoId: number; + + /** + * Creates a new PhotoChange instance using the specified properties. + * @param [properties] Properties to set + * @returns PhotoChange instance + */ + public static create(properties?: proto.IPhotoChange): proto.PhotoChange; + + /** + * Encodes the specified PhotoChange message. Does not implicitly {@link proto.PhotoChange.verify|verify} messages. + * @param message PhotoChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPhotoChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PhotoChange message, length delimited. Does not implicitly {@link proto.PhotoChange.verify|verify} messages. + * @param message PhotoChange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPhotoChange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PhotoChange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PhotoChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PhotoChange; + + /** + * Decodes a PhotoChange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PhotoChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PhotoChange; + + /** + * Verifies a PhotoChange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PhotoChange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PhotoChange + */ + public static fromObject(object: { [k: string]: any }): proto.PhotoChange; + + /** + * Creates a plain object from a PhotoChange message. Also converts values to other types if specified. + * @param message PhotoChange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PhotoChange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PhotoChange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Point. */ + interface IPoint { + + /** Point xDeprecated */ + xDeprecated?: (number|null); + + /** Point yDeprecated */ + yDeprecated?: (number|null); + + /** Point x */ + x?: (number|null); + + /** Point y */ + y?: (number|null); + } + + /** Represents a Point. */ + class Point implements IPoint { + + /** + * Constructs a new Point. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPoint); + + /** Point xDeprecated. */ + public xDeprecated: number; + + /** Point yDeprecated. */ + public yDeprecated: number; + + /** Point x. */ + public x: number; + + /** Point y. */ + public y: number; + + /** + * Creates a new Point instance using the specified properties. + * @param [properties] Properties to set + * @returns Point instance + */ + public static create(properties?: proto.IPoint): proto.Point; + + /** + * Encodes the specified Point message. Does not implicitly {@link proto.Point.verify|verify} messages. + * @param message Point message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Point message, length delimited. Does not implicitly {@link proto.Point.verify|verify} messages. + * @param message Point message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Point message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Point; + + /** + * Decodes a Point message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Point; + + /** + * Verifies a Point message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Point message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Point + */ + public static fromObject(object: { [k: string]: any }): proto.Point; + + /** + * Creates a plain object from a Point message. Also converts values to other types if specified. + * @param message Point + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Point, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Point to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PollAdditionalMetadata. */ + interface IPollAdditionalMetadata { + + /** PollAdditionalMetadata pollInvalidated */ + pollInvalidated?: (boolean|null); + } + + /** Represents a PollAdditionalMetadata. */ + class PollAdditionalMetadata implements IPollAdditionalMetadata { + + /** + * Constructs a new PollAdditionalMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPollAdditionalMetadata); + + /** PollAdditionalMetadata pollInvalidated. */ + public pollInvalidated: boolean; + + /** + * Creates a new PollAdditionalMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns PollAdditionalMetadata instance + */ + public static create(properties?: proto.IPollAdditionalMetadata): proto.PollAdditionalMetadata; + + /** + * Encodes the specified PollAdditionalMetadata message. Does not implicitly {@link proto.PollAdditionalMetadata.verify|verify} messages. + * @param message PollAdditionalMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPollAdditionalMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollAdditionalMetadata message, length delimited. Does not implicitly {@link proto.PollAdditionalMetadata.verify|verify} messages. + * @param message PollAdditionalMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPollAdditionalMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollAdditionalMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollAdditionalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PollAdditionalMetadata; + + /** + * Decodes a PollAdditionalMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollAdditionalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PollAdditionalMetadata; + + /** + * Verifies a PollAdditionalMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollAdditionalMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollAdditionalMetadata + */ + public static fromObject(object: { [k: string]: any }): proto.PollAdditionalMetadata; + + /** + * Creates a plain object from a PollAdditionalMetadata message. Also converts values to other types if specified. + * @param message PollAdditionalMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PollAdditionalMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollAdditionalMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PollEncValue. */ + interface IPollEncValue { + + /** PollEncValue encPayload */ + encPayload?: (Uint8Array|null); + + /** PollEncValue encIv */ + encIv?: (Uint8Array|null); + } + + /** Represents a PollEncValue. */ + class PollEncValue implements IPollEncValue { + + /** + * Constructs a new PollEncValue. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPollEncValue); + + /** PollEncValue encPayload. */ + public encPayload: Uint8Array; + + /** PollEncValue encIv. */ + public encIv: Uint8Array; + + /** + * Creates a new PollEncValue instance using the specified properties. + * @param [properties] Properties to set + * @returns PollEncValue instance + */ + public static create(properties?: proto.IPollEncValue): proto.PollEncValue; + + /** + * Encodes the specified PollEncValue message. Does not implicitly {@link proto.PollEncValue.verify|verify} messages. + * @param message PollEncValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPollEncValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollEncValue message, length delimited. Does not implicitly {@link proto.PollEncValue.verify|verify} messages. + * @param message PollEncValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPollEncValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollEncValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PollEncValue; + + /** + * Decodes a PollEncValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PollEncValue; + + /** + * Verifies a PollEncValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollEncValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollEncValue + */ + public static fromObject(object: { [k: string]: any }): proto.PollEncValue; + + /** + * Creates a plain object from a PollEncValue message. Also converts values to other types if specified. + * @param message PollEncValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PollEncValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollEncValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PollUpdate. */ + interface IPollUpdate { + + /** PollUpdate pollUpdateMessageKey */ + pollUpdateMessageKey?: (proto.IMessageKey|null); + + /** PollUpdate vote */ + vote?: (proto.Message.IPollVoteMessage|null); + + /** PollUpdate senderTimestampMs */ + senderTimestampMs?: (number|Long|null); + + /** PollUpdate serverTimestampMs */ + serverTimestampMs?: (number|Long|null); + + /** PollUpdate unread */ + unread?: (boolean|null); + } + + /** Represents a PollUpdate. */ + class PollUpdate implements IPollUpdate { + + /** + * Constructs a new PollUpdate. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPollUpdate); + + /** PollUpdate pollUpdateMessageKey. */ + public pollUpdateMessageKey?: (proto.IMessageKey|null); + + /** PollUpdate vote. */ + public vote?: (proto.Message.IPollVoteMessage|null); + + /** PollUpdate senderTimestampMs. */ + public senderTimestampMs: (number|Long); + + /** PollUpdate serverTimestampMs. */ + public serverTimestampMs: (number|Long); + + /** PollUpdate unread. */ + public unread: boolean; + + /** + * Creates a new PollUpdate instance using the specified properties. + * @param [properties] Properties to set + * @returns PollUpdate instance + */ + public static create(properties?: proto.IPollUpdate): proto.PollUpdate; + + /** + * Encodes the specified PollUpdate message. Does not implicitly {@link proto.PollUpdate.verify|verify} messages. + * @param message PollUpdate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPollUpdate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PollUpdate message, length delimited. Does not implicitly {@link proto.PollUpdate.verify|verify} messages. + * @param message PollUpdate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPollUpdate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PollUpdate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PollUpdate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PollUpdate; + + /** + * Decodes a PollUpdate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PollUpdate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PollUpdate; + + /** + * Verifies a PollUpdate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PollUpdate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PollUpdate + */ + public static fromObject(object: { [k: string]: any }): proto.PollUpdate; + + /** + * Creates a plain object from a PollUpdate message. Also converts values to other types if specified. + * @param message PollUpdate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PollUpdate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PollUpdate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PreKeyRecordStructure. */ + interface IPreKeyRecordStructure { + + /** PreKeyRecordStructure id */ + id?: (number|null); + + /** PreKeyRecordStructure publicKey */ + publicKey?: (Uint8Array|null); + + /** PreKeyRecordStructure privateKey */ + privateKey?: (Uint8Array|null); + } + + /** Represents a PreKeyRecordStructure. */ + class PreKeyRecordStructure implements IPreKeyRecordStructure { + + /** + * Constructs a new PreKeyRecordStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPreKeyRecordStructure); + + /** PreKeyRecordStructure id. */ + public id: number; + + /** PreKeyRecordStructure publicKey. */ + public publicKey: Uint8Array; + + /** PreKeyRecordStructure privateKey. */ + public privateKey: Uint8Array; + + /** + * Creates a new PreKeyRecordStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns PreKeyRecordStructure instance + */ + public static create(properties?: proto.IPreKeyRecordStructure): proto.PreKeyRecordStructure; + + /** + * Encodes the specified PreKeyRecordStructure message. Does not implicitly {@link proto.PreKeyRecordStructure.verify|verify} messages. + * @param message PreKeyRecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPreKeyRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PreKeyRecordStructure message, length delimited. Does not implicitly {@link proto.PreKeyRecordStructure.verify|verify} messages. + * @param message PreKeyRecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPreKeyRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PreKeyRecordStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.PreKeyRecordStructure; + + /** + * Decodes a PreKeyRecordStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.PreKeyRecordStructure; + + /** + * Verifies a PreKeyRecordStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PreKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PreKeyRecordStructure + */ + public static fromObject(object: { [k: string]: any }): proto.PreKeyRecordStructure; + + /** + * Creates a plain object from a PreKeyRecordStructure message. Also converts values to other types if specified. + * @param message PreKeyRecordStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.PreKeyRecordStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PreKeyRecordStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Pushname. */ + interface IPushname { + + /** Pushname id */ + id?: (string|null); + + /** Pushname pushname */ + pushname?: (string|null); + } + + /** Represents a Pushname. */ + class Pushname implements IPushname { + + /** + * Constructs a new Pushname. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IPushname); + + /** Pushname id. */ + public id: string; + + /** Pushname pushname. */ + public pushname: string; + + /** + * Creates a new Pushname instance using the specified properties. + * @param [properties] Properties to set + * @returns Pushname instance + */ + public static create(properties?: proto.IPushname): proto.Pushname; + + /** + * Encodes the specified Pushname message. Does not implicitly {@link proto.Pushname.verify|verify} messages. + * @param message Pushname message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IPushname, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Pushname message, length delimited. Does not implicitly {@link proto.Pushname.verify|verify} messages. + * @param message Pushname message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IPushname, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Pushname message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Pushname + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Pushname; + + /** + * Decodes a Pushname message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Pushname + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Pushname; + + /** + * Verifies a Pushname message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Pushname message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Pushname + */ + public static fromObject(object: { [k: string]: any }): proto.Pushname; + + /** + * Creates a plain object from a Pushname message. Also converts values to other types if specified. + * @param message Pushname + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Pushname, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Pushname to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Reaction. */ + interface IReaction { + + /** Reaction key */ + key?: (proto.IMessageKey|null); + + /** Reaction text */ + text?: (string|null); + + /** Reaction groupingKey */ + groupingKey?: (string|null); + + /** Reaction senderTimestampMs */ + senderTimestampMs?: (number|Long|null); + + /** Reaction unread */ + unread?: (boolean|null); + } + + /** Represents a Reaction. */ + class Reaction implements IReaction { + + /** + * Constructs a new Reaction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IReaction); + + /** Reaction key. */ + public key?: (proto.IMessageKey|null); + + /** Reaction text. */ + public text: string; + + /** Reaction groupingKey. */ + public groupingKey: string; + + /** Reaction senderTimestampMs. */ + public senderTimestampMs: (number|Long); + + /** Reaction unread. */ + public unread: boolean; + + /** + * Creates a new Reaction instance using the specified properties. + * @param [properties] Properties to set + * @returns Reaction instance + */ + public static create(properties?: proto.IReaction): proto.Reaction; + + /** + * Encodes the specified Reaction message. Does not implicitly {@link proto.Reaction.verify|verify} messages. + * @param message Reaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IReaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Reaction message, length delimited. Does not implicitly {@link proto.Reaction.verify|verify} messages. + * @param message Reaction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IReaction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Reaction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Reaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.Reaction; + + /** + * Decodes a Reaction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Reaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.Reaction; + + /** + * Verifies a Reaction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Reaction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Reaction + */ + public static fromObject(object: { [k: string]: any }): proto.Reaction; + + /** + * Creates a plain object from a Reaction message. Also converts values to other types if specified. + * @param message Reaction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.Reaction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Reaction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecentEmojiWeight. */ + interface IRecentEmojiWeight { + + /** RecentEmojiWeight emoji */ + emoji?: (string|null); + + /** RecentEmojiWeight weight */ + weight?: (number|null); + } + + /** Represents a RecentEmojiWeight. */ + class RecentEmojiWeight implements IRecentEmojiWeight { + + /** + * Constructs a new RecentEmojiWeight. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IRecentEmojiWeight); + + /** RecentEmojiWeight emoji. */ + public emoji: string; + + /** RecentEmojiWeight weight. */ + public weight: number; + + /** + * Creates a new RecentEmojiWeight instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentEmojiWeight instance + */ + public static create(properties?: proto.IRecentEmojiWeight): proto.RecentEmojiWeight; + + /** + * Encodes the specified RecentEmojiWeight message. Does not implicitly {@link proto.RecentEmojiWeight.verify|verify} messages. + * @param message RecentEmojiWeight message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IRecentEmojiWeight, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentEmojiWeight message, length delimited. Does not implicitly {@link proto.RecentEmojiWeight.verify|verify} messages. + * @param message RecentEmojiWeight message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IRecentEmojiWeight, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentEmojiWeight message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentEmojiWeight + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.RecentEmojiWeight; + + /** + * Decodes a RecentEmojiWeight message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentEmojiWeight + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.RecentEmojiWeight; + + /** + * Verifies a RecentEmojiWeight message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentEmojiWeight message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentEmojiWeight + */ + public static fromObject(object: { [k: string]: any }): proto.RecentEmojiWeight; + + /** + * Creates a plain object from a RecentEmojiWeight message. Also converts values to other types if specified. + * @param message RecentEmojiWeight + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.RecentEmojiWeight, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentEmojiWeight to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecordStructure. */ + interface IRecordStructure { + + /** RecordStructure currentSession */ + currentSession?: (proto.ISessionStructure|null); + + /** RecordStructure previousSessions */ + previousSessions?: (proto.ISessionStructure[]|null); + } + + /** Represents a RecordStructure. */ + class RecordStructure implements IRecordStructure { + + /** + * Constructs a new RecordStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IRecordStructure); + + /** RecordStructure currentSession. */ + public currentSession?: (proto.ISessionStructure|null); + + /** RecordStructure previousSessions. */ + public previousSessions: proto.ISessionStructure[]; + + /** + * Creates a new RecordStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns RecordStructure instance + */ + public static create(properties?: proto.IRecordStructure): proto.RecordStructure; + + /** + * Encodes the specified RecordStructure message. Does not implicitly {@link proto.RecordStructure.verify|verify} messages. + * @param message RecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecordStructure message, length delimited. Does not implicitly {@link proto.RecordStructure.verify|verify} messages. + * @param message RecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecordStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.RecordStructure; + + /** + * Decodes a RecordStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.RecordStructure; + + /** + * Verifies a RecordStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecordStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecordStructure + */ + public static fromObject(object: { [k: string]: any }): proto.RecordStructure; + + /** + * Creates a plain object from a RecordStructure message. Also converts values to other types if specified. + * @param message RecordStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.RecordStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecordStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SenderKeyRecordStructure. */ + interface ISenderKeyRecordStructure { + + /** SenderKeyRecordStructure senderKeyStates */ + senderKeyStates?: (proto.ISenderKeyStateStructure[]|null); + } + + /** Represents a SenderKeyRecordStructure. */ + class SenderKeyRecordStructure implements ISenderKeyRecordStructure { + + /** + * Constructs a new SenderKeyRecordStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISenderKeyRecordStructure); + + /** SenderKeyRecordStructure senderKeyStates. */ + public senderKeyStates: proto.ISenderKeyStateStructure[]; + + /** + * Creates a new SenderKeyRecordStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns SenderKeyRecordStructure instance + */ + public static create(properties?: proto.ISenderKeyRecordStructure): proto.SenderKeyRecordStructure; + + /** + * Encodes the specified SenderKeyRecordStructure message. Does not implicitly {@link proto.SenderKeyRecordStructure.verify|verify} messages. + * @param message SenderKeyRecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISenderKeyRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SenderKeyRecordStructure message, length delimited. Does not implicitly {@link proto.SenderKeyRecordStructure.verify|verify} messages. + * @param message SenderKeyRecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISenderKeyRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SenderKeyRecordStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SenderKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SenderKeyRecordStructure; + + /** + * Decodes a SenderKeyRecordStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SenderKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SenderKeyRecordStructure; + + /** + * Verifies a SenderKeyRecordStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SenderKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SenderKeyRecordStructure + */ + public static fromObject(object: { [k: string]: any }): proto.SenderKeyRecordStructure; + + /** + * Creates a plain object from a SenderKeyRecordStructure message. Also converts values to other types if specified. + * @param message SenderKeyRecordStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SenderKeyRecordStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SenderKeyRecordStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SenderKeyStateStructure. */ + interface ISenderKeyStateStructure { + + /** SenderKeyStateStructure senderKeyId */ + senderKeyId?: (number|null); + + /** SenderKeyStateStructure senderChainKey */ + senderChainKey?: (proto.SenderKeyStateStructure.ISenderChainKey|null); + + /** SenderKeyStateStructure senderSigningKey */ + senderSigningKey?: (proto.SenderKeyStateStructure.ISenderSigningKey|null); + + /** SenderKeyStateStructure senderMessageKeys */ + senderMessageKeys?: (proto.SenderKeyStateStructure.ISenderMessageKey[]|null); + } + + /** Represents a SenderKeyStateStructure. */ + class SenderKeyStateStructure implements ISenderKeyStateStructure { + + /** + * Constructs a new SenderKeyStateStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISenderKeyStateStructure); + + /** SenderKeyStateStructure senderKeyId. */ + public senderKeyId: number; + + /** SenderKeyStateStructure senderChainKey. */ + public senderChainKey?: (proto.SenderKeyStateStructure.ISenderChainKey|null); + + /** SenderKeyStateStructure senderSigningKey. */ + public senderSigningKey?: (proto.SenderKeyStateStructure.ISenderSigningKey|null); + + /** SenderKeyStateStructure senderMessageKeys. */ + public senderMessageKeys: proto.SenderKeyStateStructure.ISenderMessageKey[]; + + /** + * Creates a new SenderKeyStateStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns SenderKeyStateStructure instance + */ + public static create(properties?: proto.ISenderKeyStateStructure): proto.SenderKeyStateStructure; + + /** + * Encodes the specified SenderKeyStateStructure message. Does not implicitly {@link proto.SenderKeyStateStructure.verify|verify} messages. + * @param message SenderKeyStateStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISenderKeyStateStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SenderKeyStateStructure message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.verify|verify} messages. + * @param message SenderKeyStateStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISenderKeyStateStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SenderKeyStateStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SenderKeyStateStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SenderKeyStateStructure; + + /** + * Decodes a SenderKeyStateStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SenderKeyStateStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SenderKeyStateStructure; + + /** + * Verifies a SenderKeyStateStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SenderKeyStateStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SenderKeyStateStructure + */ + public static fromObject(object: { [k: string]: any }): proto.SenderKeyStateStructure; + + /** + * Creates a plain object from a SenderKeyStateStructure message. Also converts values to other types if specified. + * @param message SenderKeyStateStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SenderKeyStateStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SenderKeyStateStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SenderKeyStateStructure { + + /** Properties of a SenderChainKey. */ + interface ISenderChainKey { + + /** SenderChainKey iteration */ + iteration?: (number|null); + + /** SenderChainKey seed */ + seed?: (Uint8Array|null); + } + + /** Represents a SenderChainKey. */ + class SenderChainKey implements ISenderChainKey { + + /** + * Constructs a new SenderChainKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SenderKeyStateStructure.ISenderChainKey); + + /** SenderChainKey iteration. */ + public iteration: number; + + /** SenderChainKey seed. */ + public seed: Uint8Array; + + /** + * Creates a new SenderChainKey instance using the specified properties. + * @param [properties] Properties to set + * @returns SenderChainKey instance + */ + public static create(properties?: proto.SenderKeyStateStructure.ISenderChainKey): proto.SenderKeyStateStructure.SenderChainKey; + + /** + * Encodes the specified SenderChainKey message. Does not implicitly {@link proto.SenderKeyStateStructure.SenderChainKey.verify|verify} messages. + * @param message SenderChainKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SenderKeyStateStructure.ISenderChainKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SenderChainKey message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.SenderChainKey.verify|verify} messages. + * @param message SenderChainKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SenderKeyStateStructure.ISenderChainKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SenderChainKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SenderChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SenderKeyStateStructure.SenderChainKey; + + /** + * Decodes a SenderChainKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SenderChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SenderKeyStateStructure.SenderChainKey; + + /** + * Verifies a SenderChainKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SenderChainKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SenderChainKey + */ + public static fromObject(object: { [k: string]: any }): proto.SenderKeyStateStructure.SenderChainKey; + + /** + * Creates a plain object from a SenderChainKey message. Also converts values to other types if specified. + * @param message SenderChainKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SenderKeyStateStructure.SenderChainKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SenderChainKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SenderMessageKey. */ + interface ISenderMessageKey { + + /** SenderMessageKey iteration */ + iteration?: (number|null); + + /** SenderMessageKey seed */ + seed?: (Uint8Array|null); + } + + /** Represents a SenderMessageKey. */ + class SenderMessageKey implements ISenderMessageKey { + + /** + * Constructs a new SenderMessageKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SenderKeyStateStructure.ISenderMessageKey); + + /** SenderMessageKey iteration. */ + public iteration: number; + + /** SenderMessageKey seed. */ + public seed: Uint8Array; + + /** + * Creates a new SenderMessageKey instance using the specified properties. + * @param [properties] Properties to set + * @returns SenderMessageKey instance + */ + public static create(properties?: proto.SenderKeyStateStructure.ISenderMessageKey): proto.SenderKeyStateStructure.SenderMessageKey; + + /** + * Encodes the specified SenderMessageKey message. Does not implicitly {@link proto.SenderKeyStateStructure.SenderMessageKey.verify|verify} messages. + * @param message SenderMessageKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SenderKeyStateStructure.ISenderMessageKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SenderMessageKey message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.SenderMessageKey.verify|verify} messages. + * @param message SenderMessageKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SenderKeyStateStructure.ISenderMessageKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SenderMessageKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SenderMessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SenderKeyStateStructure.SenderMessageKey; + + /** + * Decodes a SenderMessageKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SenderMessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SenderKeyStateStructure.SenderMessageKey; + + /** + * Verifies a SenderMessageKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SenderMessageKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SenderMessageKey + */ + public static fromObject(object: { [k: string]: any }): proto.SenderKeyStateStructure.SenderMessageKey; + + /** + * Creates a plain object from a SenderMessageKey message. Also converts values to other types if specified. + * @param message SenderMessageKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SenderKeyStateStructure.SenderMessageKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SenderMessageKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SenderSigningKey. */ + interface ISenderSigningKey { + + /** SenderSigningKey public */ + "public"?: (Uint8Array|null); + + /** SenderSigningKey private */ + "private"?: (Uint8Array|null); + } + + /** Represents a SenderSigningKey. */ + class SenderSigningKey implements ISenderSigningKey { + + /** + * Constructs a new SenderSigningKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SenderKeyStateStructure.ISenderSigningKey); + + /** SenderSigningKey public. */ + public public: Uint8Array; + + /** SenderSigningKey private. */ + public private: Uint8Array; + + /** + * Creates a new SenderSigningKey instance using the specified properties. + * @param [properties] Properties to set + * @returns SenderSigningKey instance + */ + public static create(properties?: proto.SenderKeyStateStructure.ISenderSigningKey): proto.SenderKeyStateStructure.SenderSigningKey; + + /** + * Encodes the specified SenderSigningKey message. Does not implicitly {@link proto.SenderKeyStateStructure.SenderSigningKey.verify|verify} messages. + * @param message SenderSigningKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SenderKeyStateStructure.ISenderSigningKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SenderSigningKey message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.SenderSigningKey.verify|verify} messages. + * @param message SenderSigningKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SenderKeyStateStructure.ISenderSigningKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SenderSigningKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SenderSigningKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SenderKeyStateStructure.SenderSigningKey; + + /** + * Decodes a SenderSigningKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SenderSigningKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SenderKeyStateStructure.SenderSigningKey; + + /** + * Verifies a SenderSigningKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SenderSigningKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SenderSigningKey + */ + public static fromObject(object: { [k: string]: any }): proto.SenderKeyStateStructure.SenderSigningKey; + + /** + * Creates a plain object from a SenderSigningKey message. Also converts values to other types if specified. + * @param message SenderSigningKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SenderKeyStateStructure.SenderSigningKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SenderSigningKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a ServerErrorReceipt. */ + interface IServerErrorReceipt { + + /** ServerErrorReceipt stanzaId */ + stanzaId?: (string|null); + } + + /** Represents a ServerErrorReceipt. */ + class ServerErrorReceipt implements IServerErrorReceipt { + + /** + * Constructs a new ServerErrorReceipt. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IServerErrorReceipt); + + /** ServerErrorReceipt stanzaId. */ + public stanzaId: string; + + /** + * Creates a new ServerErrorReceipt instance using the specified properties. + * @param [properties] Properties to set + * @returns ServerErrorReceipt instance + */ + public static create(properties?: proto.IServerErrorReceipt): proto.ServerErrorReceipt; + + /** + * Encodes the specified ServerErrorReceipt message. Does not implicitly {@link proto.ServerErrorReceipt.verify|verify} messages. + * @param message ServerErrorReceipt message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IServerErrorReceipt, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServerErrorReceipt message, length delimited. Does not implicitly {@link proto.ServerErrorReceipt.verify|verify} messages. + * @param message ServerErrorReceipt message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IServerErrorReceipt, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServerErrorReceipt message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServerErrorReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.ServerErrorReceipt; + + /** + * Decodes a ServerErrorReceipt message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServerErrorReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.ServerErrorReceipt; + + /** + * Verifies a ServerErrorReceipt message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServerErrorReceipt message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServerErrorReceipt + */ + public static fromObject(object: { [k: string]: any }): proto.ServerErrorReceipt; + + /** + * Creates a plain object from a ServerErrorReceipt message. Also converts values to other types if specified. + * @param message ServerErrorReceipt + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.ServerErrorReceipt, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServerErrorReceipt to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SessionStructure. */ + interface ISessionStructure { + + /** SessionStructure sessionVersion */ + sessionVersion?: (number|null); + + /** SessionStructure localIdentityPublic */ + localIdentityPublic?: (Uint8Array|null); + + /** SessionStructure remoteIdentityPublic */ + remoteIdentityPublic?: (Uint8Array|null); + + /** SessionStructure rootKey */ + rootKey?: (Uint8Array|null); + + /** SessionStructure previousCounter */ + previousCounter?: (number|null); + + /** SessionStructure senderChain */ + senderChain?: (proto.SessionStructure.IChain|null); + + /** SessionStructure receiverChains */ + receiverChains?: (proto.SessionStructure.IChain[]|null); + + /** SessionStructure pendingKeyExchange */ + pendingKeyExchange?: (proto.SessionStructure.IPendingKeyExchange|null); + + /** SessionStructure pendingPreKey */ + pendingPreKey?: (proto.SessionStructure.IPendingPreKey|null); + + /** SessionStructure remoteRegistrationId */ + remoteRegistrationId?: (number|null); + + /** SessionStructure localRegistrationId */ + localRegistrationId?: (number|null); + + /** SessionStructure needsRefresh */ + needsRefresh?: (boolean|null); + + /** SessionStructure aliceBaseKey */ + aliceBaseKey?: (Uint8Array|null); + } + + /** Represents a SessionStructure. */ + class SessionStructure implements ISessionStructure { + + /** + * Constructs a new SessionStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISessionStructure); + + /** SessionStructure sessionVersion. */ + public sessionVersion: number; + + /** SessionStructure localIdentityPublic. */ + public localIdentityPublic: Uint8Array; + + /** SessionStructure remoteIdentityPublic. */ + public remoteIdentityPublic: Uint8Array; + + /** SessionStructure rootKey. */ + public rootKey: Uint8Array; + + /** SessionStructure previousCounter. */ + public previousCounter: number; + + /** SessionStructure senderChain. */ + public senderChain?: (proto.SessionStructure.IChain|null); + + /** SessionStructure receiverChains. */ + public receiverChains: proto.SessionStructure.IChain[]; + + /** SessionStructure pendingKeyExchange. */ + public pendingKeyExchange?: (proto.SessionStructure.IPendingKeyExchange|null); + + /** SessionStructure pendingPreKey. */ + public pendingPreKey?: (proto.SessionStructure.IPendingPreKey|null); + + /** SessionStructure remoteRegistrationId. */ + public remoteRegistrationId: number; + + /** SessionStructure localRegistrationId. */ + public localRegistrationId: number; + + /** SessionStructure needsRefresh. */ + public needsRefresh: boolean; + + /** SessionStructure aliceBaseKey. */ + public aliceBaseKey: Uint8Array; + + /** + * Creates a new SessionStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns SessionStructure instance + */ + public static create(properties?: proto.ISessionStructure): proto.SessionStructure; + + /** + * Encodes the specified SessionStructure message. Does not implicitly {@link proto.SessionStructure.verify|verify} messages. + * @param message SessionStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISessionStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SessionStructure message, length delimited. Does not implicitly {@link proto.SessionStructure.verify|verify} messages. + * @param message SessionStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISessionStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SessionStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SessionStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SessionStructure; + + /** + * Decodes a SessionStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SessionStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SessionStructure; + + /** + * Verifies a SessionStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SessionStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SessionStructure + */ + public static fromObject(object: { [k: string]: any }): proto.SessionStructure; + + /** + * Creates a plain object from a SessionStructure message. Also converts values to other types if specified. + * @param message SessionStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SessionStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SessionStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SessionStructure { + + /** Properties of a Chain. */ + interface IChain { + + /** Chain senderRatchetKey */ + senderRatchetKey?: (Uint8Array|null); + + /** Chain senderRatchetKeyPrivate */ + senderRatchetKeyPrivate?: (Uint8Array|null); + + /** Chain chainKey */ + chainKey?: (proto.SessionStructure.Chain.IChainKey|null); + + /** Chain messageKeys */ + messageKeys?: (proto.SessionStructure.Chain.IMessageKey[]|null); + } + + /** Represents a Chain. */ + class Chain implements IChain { + + /** + * Constructs a new Chain. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SessionStructure.IChain); + + /** Chain senderRatchetKey. */ + public senderRatchetKey: Uint8Array; + + /** Chain senderRatchetKeyPrivate. */ + public senderRatchetKeyPrivate: Uint8Array; + + /** Chain chainKey. */ + public chainKey?: (proto.SessionStructure.Chain.IChainKey|null); + + /** Chain messageKeys. */ + public messageKeys: proto.SessionStructure.Chain.IMessageKey[]; + + /** + * Creates a new Chain instance using the specified properties. + * @param [properties] Properties to set + * @returns Chain instance + */ + public static create(properties?: proto.SessionStructure.IChain): proto.SessionStructure.Chain; + + /** + * Encodes the specified Chain message. Does not implicitly {@link proto.SessionStructure.Chain.verify|verify} messages. + * @param message Chain message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SessionStructure.IChain, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Chain message, length delimited. Does not implicitly {@link proto.SessionStructure.Chain.verify|verify} messages. + * @param message Chain message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SessionStructure.IChain, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Chain message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Chain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SessionStructure.Chain; + + /** + * Decodes a Chain message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Chain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SessionStructure.Chain; + + /** + * Verifies a Chain message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Chain message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Chain + */ + public static fromObject(object: { [k: string]: any }): proto.SessionStructure.Chain; + + /** + * Creates a plain object from a Chain message. Also converts values to other types if specified. + * @param message Chain + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SessionStructure.Chain, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Chain to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Chain { + + /** Properties of a ChainKey. */ + interface IChainKey { + + /** ChainKey index */ + index?: (number|null); + + /** ChainKey key */ + key?: (Uint8Array|null); + } + + /** Represents a ChainKey. */ + class ChainKey implements IChainKey { + + /** + * Constructs a new ChainKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SessionStructure.Chain.IChainKey); + + /** ChainKey index. */ + public index: number; + + /** ChainKey key. */ + public key: Uint8Array; + + /** + * Creates a new ChainKey instance using the specified properties. + * @param [properties] Properties to set + * @returns ChainKey instance + */ + public static create(properties?: proto.SessionStructure.Chain.IChainKey): proto.SessionStructure.Chain.ChainKey; + + /** + * Encodes the specified ChainKey message. Does not implicitly {@link proto.SessionStructure.Chain.ChainKey.verify|verify} messages. + * @param message ChainKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SessionStructure.Chain.IChainKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChainKey message, length delimited. Does not implicitly {@link proto.SessionStructure.Chain.ChainKey.verify|verify} messages. + * @param message ChainKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SessionStructure.Chain.IChainKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChainKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SessionStructure.Chain.ChainKey; + + /** + * Decodes a ChainKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SessionStructure.Chain.ChainKey; + + /** + * Verifies a ChainKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ChainKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChainKey + */ + public static fromObject(object: { [k: string]: any }): proto.SessionStructure.Chain.ChainKey; + + /** + * Creates a plain object from a ChainKey message. Also converts values to other types if specified. + * @param message ChainKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SessionStructure.Chain.ChainKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChainKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MessageKey. */ + interface IMessageKey { + + /** MessageKey index */ + index?: (number|null); + + /** MessageKey cipherKey */ + cipherKey?: (Uint8Array|null); + + /** MessageKey macKey */ + macKey?: (Uint8Array|null); + + /** MessageKey iv */ + iv?: (Uint8Array|null); + } + + /** Represents a MessageKey. */ + class MessageKey implements IMessageKey { + + /** + * Constructs a new MessageKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SessionStructure.Chain.IMessageKey); + + /** MessageKey index. */ + public index: number; + + /** MessageKey cipherKey. */ + public cipherKey: Uint8Array; + + /** MessageKey macKey. */ + public macKey: Uint8Array; + + /** MessageKey iv. */ + public iv: Uint8Array; + + /** + * Creates a new MessageKey instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageKey instance + */ + public static create(properties?: proto.SessionStructure.Chain.IMessageKey): proto.SessionStructure.Chain.MessageKey; + + /** + * Encodes the specified MessageKey message. Does not implicitly {@link proto.SessionStructure.Chain.MessageKey.verify|verify} messages. + * @param message MessageKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SessionStructure.Chain.IMessageKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageKey message, length delimited. Does not implicitly {@link proto.SessionStructure.Chain.MessageKey.verify|verify} messages. + * @param message MessageKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SessionStructure.Chain.IMessageKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SessionStructure.Chain.MessageKey; + + /** + * Decodes a MessageKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SessionStructure.Chain.MessageKey; + + /** + * Verifies a MessageKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageKey + */ + public static fromObject(object: { [k: string]: any }): proto.SessionStructure.Chain.MessageKey; + + /** + * Creates a plain object from a MessageKey message. Also converts values to other types if specified. + * @param message MessageKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SessionStructure.Chain.MessageKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a PendingKeyExchange. */ + interface IPendingKeyExchange { + + /** PendingKeyExchange sequence */ + sequence?: (number|null); + + /** PendingKeyExchange localBaseKey */ + localBaseKey?: (Uint8Array|null); + + /** PendingKeyExchange localBaseKeyPrivate */ + localBaseKeyPrivate?: (Uint8Array|null); + + /** PendingKeyExchange localRatchetKey */ + localRatchetKey?: (Uint8Array|null); + + /** PendingKeyExchange localRatchetKeyPrivate */ + localRatchetKeyPrivate?: (Uint8Array|null); + + /** PendingKeyExchange localIdentityKey */ + localIdentityKey?: (Uint8Array|null); + + /** PendingKeyExchange localIdentityKeyPrivate */ + localIdentityKeyPrivate?: (Uint8Array|null); + } + + /** Represents a PendingKeyExchange. */ + class PendingKeyExchange implements IPendingKeyExchange { + + /** + * Constructs a new PendingKeyExchange. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SessionStructure.IPendingKeyExchange); + + /** PendingKeyExchange sequence. */ + public sequence: number; + + /** PendingKeyExchange localBaseKey. */ + public localBaseKey: Uint8Array; + + /** PendingKeyExchange localBaseKeyPrivate. */ + public localBaseKeyPrivate: Uint8Array; + + /** PendingKeyExchange localRatchetKey. */ + public localRatchetKey: Uint8Array; + + /** PendingKeyExchange localRatchetKeyPrivate. */ + public localRatchetKeyPrivate: Uint8Array; + + /** PendingKeyExchange localIdentityKey. */ + public localIdentityKey: Uint8Array; + + /** PendingKeyExchange localIdentityKeyPrivate. */ + public localIdentityKeyPrivate: Uint8Array; + + /** + * Creates a new PendingKeyExchange instance using the specified properties. + * @param [properties] Properties to set + * @returns PendingKeyExchange instance + */ + public static create(properties?: proto.SessionStructure.IPendingKeyExchange): proto.SessionStructure.PendingKeyExchange; + + /** + * Encodes the specified PendingKeyExchange message. Does not implicitly {@link proto.SessionStructure.PendingKeyExchange.verify|verify} messages. + * @param message PendingKeyExchange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SessionStructure.IPendingKeyExchange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PendingKeyExchange message, length delimited. Does not implicitly {@link proto.SessionStructure.PendingKeyExchange.verify|verify} messages. + * @param message PendingKeyExchange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SessionStructure.IPendingKeyExchange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PendingKeyExchange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PendingKeyExchange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SessionStructure.PendingKeyExchange; + + /** + * Decodes a PendingKeyExchange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PendingKeyExchange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SessionStructure.PendingKeyExchange; + + /** + * Verifies a PendingKeyExchange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PendingKeyExchange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PendingKeyExchange + */ + public static fromObject(object: { [k: string]: any }): proto.SessionStructure.PendingKeyExchange; + + /** + * Creates a plain object from a PendingKeyExchange message. Also converts values to other types if specified. + * @param message PendingKeyExchange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SessionStructure.PendingKeyExchange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PendingKeyExchange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PendingPreKey. */ + interface IPendingPreKey { + + /** PendingPreKey preKeyId */ + preKeyId?: (number|null); + + /** PendingPreKey signedPreKeyId */ + signedPreKeyId?: (number|null); + + /** PendingPreKey baseKey */ + baseKey?: (Uint8Array|null); + } + + /** Represents a PendingPreKey. */ + class PendingPreKey implements IPendingPreKey { + + /** + * Constructs a new PendingPreKey. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SessionStructure.IPendingPreKey); + + /** PendingPreKey preKeyId. */ + public preKeyId: number; + + /** PendingPreKey signedPreKeyId. */ + public signedPreKeyId: number; + + /** PendingPreKey baseKey. */ + public baseKey: Uint8Array; + + /** + * Creates a new PendingPreKey instance using the specified properties. + * @param [properties] Properties to set + * @returns PendingPreKey instance + */ + public static create(properties?: proto.SessionStructure.IPendingPreKey): proto.SessionStructure.PendingPreKey; + + /** + * Encodes the specified PendingPreKey message. Does not implicitly {@link proto.SessionStructure.PendingPreKey.verify|verify} messages. + * @param message PendingPreKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SessionStructure.IPendingPreKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PendingPreKey message, length delimited. Does not implicitly {@link proto.SessionStructure.PendingPreKey.verify|verify} messages. + * @param message PendingPreKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SessionStructure.IPendingPreKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PendingPreKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PendingPreKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SessionStructure.PendingPreKey; + + /** + * Decodes a PendingPreKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PendingPreKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SessionStructure.PendingPreKey; + + /** + * Verifies a PendingPreKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PendingPreKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PendingPreKey + */ + public static fromObject(object: { [k: string]: any }): proto.SessionStructure.PendingPreKey; + + /** + * Creates a plain object from a PendingPreKey message. Also converts values to other types if specified. + * @param message PendingPreKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SessionStructure.PendingPreKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PendingPreKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SignedPreKeyRecordStructure. */ + interface ISignedPreKeyRecordStructure { + + /** SignedPreKeyRecordStructure id */ + id?: (number|null); + + /** SignedPreKeyRecordStructure publicKey */ + publicKey?: (Uint8Array|null); + + /** SignedPreKeyRecordStructure privateKey */ + privateKey?: (Uint8Array|null); + + /** SignedPreKeyRecordStructure signature */ + signature?: (Uint8Array|null); + + /** SignedPreKeyRecordStructure timestamp */ + timestamp?: (number|Long|null); + } + + /** Represents a SignedPreKeyRecordStructure. */ + class SignedPreKeyRecordStructure implements ISignedPreKeyRecordStructure { + + /** + * Constructs a new SignedPreKeyRecordStructure. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISignedPreKeyRecordStructure); + + /** SignedPreKeyRecordStructure id. */ + public id: number; + + /** SignedPreKeyRecordStructure publicKey. */ + public publicKey: Uint8Array; + + /** SignedPreKeyRecordStructure privateKey. */ + public privateKey: Uint8Array; + + /** SignedPreKeyRecordStructure signature. */ + public signature: Uint8Array; + + /** SignedPreKeyRecordStructure timestamp. */ + public timestamp: (number|Long); + + /** + * Creates a new SignedPreKeyRecordStructure instance using the specified properties. + * @param [properties] Properties to set + * @returns SignedPreKeyRecordStructure instance + */ + public static create(properties?: proto.ISignedPreKeyRecordStructure): proto.SignedPreKeyRecordStructure; + + /** + * Encodes the specified SignedPreKeyRecordStructure message. Does not implicitly {@link proto.SignedPreKeyRecordStructure.verify|verify} messages. + * @param message SignedPreKeyRecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISignedPreKeyRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SignedPreKeyRecordStructure message, length delimited. Does not implicitly {@link proto.SignedPreKeyRecordStructure.verify|verify} messages. + * @param message SignedPreKeyRecordStructure message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISignedPreKeyRecordStructure, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SignedPreKeyRecordStructure message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SignedPreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SignedPreKeyRecordStructure; + + /** + * Decodes a SignedPreKeyRecordStructure message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SignedPreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SignedPreKeyRecordStructure; + + /** + * Verifies a SignedPreKeyRecordStructure message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SignedPreKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SignedPreKeyRecordStructure + */ + public static fromObject(object: { [k: string]: any }): proto.SignedPreKeyRecordStructure; + + /** + * Creates a plain object from a SignedPreKeyRecordStructure message. Also converts values to other types if specified. + * @param message SignedPreKeyRecordStructure + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SignedPreKeyRecordStructure, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SignedPreKeyRecordStructure to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StatusPSA. */ + interface IStatusPSA { + + /** StatusPSA campaignId */ + campaignId: (number|Long); + + /** StatusPSA campaignExpirationTimestamp */ + campaignExpirationTimestamp?: (number|Long|null); + } + + /** Represents a StatusPSA. */ + class StatusPSA implements IStatusPSA { + + /** + * Constructs a new StatusPSA. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IStatusPSA); + + /** StatusPSA campaignId. */ + public campaignId: (number|Long); + + /** StatusPSA campaignExpirationTimestamp. */ + public campaignExpirationTimestamp: (number|Long); + + /** + * Creates a new StatusPSA instance using the specified properties. + * @param [properties] Properties to set + * @returns StatusPSA instance + */ + public static create(properties?: proto.IStatusPSA): proto.StatusPSA; + + /** + * Encodes the specified StatusPSA message. Does not implicitly {@link proto.StatusPSA.verify|verify} messages. + * @param message StatusPSA message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IStatusPSA, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StatusPSA message, length delimited. Does not implicitly {@link proto.StatusPSA.verify|verify} messages. + * @param message StatusPSA message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IStatusPSA, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StatusPSA message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StatusPSA + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.StatusPSA; + + /** + * Decodes a StatusPSA message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StatusPSA + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.StatusPSA; + + /** + * Verifies a StatusPSA message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StatusPSA message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StatusPSA + */ + public static fromObject(object: { [k: string]: any }): proto.StatusPSA; + + /** + * Creates a plain object from a StatusPSA message. Also converts values to other types if specified. + * @param message StatusPSA + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.StatusPSA, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StatusPSA to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StickerMetadata. */ + interface IStickerMetadata { + + /** StickerMetadata url */ + url?: (string|null); + + /** StickerMetadata fileSha256 */ + fileSha256?: (Uint8Array|null); + + /** StickerMetadata fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** StickerMetadata mediaKey */ + mediaKey?: (Uint8Array|null); + + /** StickerMetadata mimetype */ + mimetype?: (string|null); + + /** StickerMetadata height */ + height?: (number|null); + + /** StickerMetadata width */ + width?: (number|null); + + /** StickerMetadata directPath */ + directPath?: (string|null); + + /** StickerMetadata fileLength */ + fileLength?: (number|Long|null); + + /** StickerMetadata weight */ + weight?: (number|null); + + /** StickerMetadata lastStickerSentTs */ + lastStickerSentTs?: (number|Long|null); + } + + /** Represents a StickerMetadata. */ + class StickerMetadata implements IStickerMetadata { + + /** + * Constructs a new StickerMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IStickerMetadata); + + /** StickerMetadata url. */ + public url: string; + + /** StickerMetadata fileSha256. */ + public fileSha256: Uint8Array; + + /** StickerMetadata fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** StickerMetadata mediaKey. */ + public mediaKey: Uint8Array; + + /** StickerMetadata mimetype. */ + public mimetype: string; + + /** StickerMetadata height. */ + public height: number; + + /** StickerMetadata width. */ + public width: number; + + /** StickerMetadata directPath. */ + public directPath: string; + + /** StickerMetadata fileLength. */ + public fileLength: (number|Long); + + /** StickerMetadata weight. */ + public weight: number; + + /** StickerMetadata lastStickerSentTs. */ + public lastStickerSentTs: (number|Long); + + /** + * Creates a new StickerMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns StickerMetadata instance + */ + public static create(properties?: proto.IStickerMetadata): proto.StickerMetadata; + + /** + * Encodes the specified StickerMetadata message. Does not implicitly {@link proto.StickerMetadata.verify|verify} messages. + * @param message StickerMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IStickerMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StickerMetadata message, length delimited. Does not implicitly {@link proto.StickerMetadata.verify|verify} messages. + * @param message StickerMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IStickerMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StickerMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StickerMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.StickerMetadata; + + /** + * Decodes a StickerMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StickerMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.StickerMetadata; + + /** + * Verifies a StickerMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StickerMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StickerMetadata + */ + public static fromObject(object: { [k: string]: any }): proto.StickerMetadata; + + /** + * Creates a plain object from a StickerMetadata message. Also converts values to other types if specified. + * @param message StickerMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.StickerMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StickerMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncActionData. */ + interface ISyncActionData { + + /** SyncActionData index */ + index?: (Uint8Array|null); + + /** SyncActionData value */ + value?: (proto.ISyncActionValue|null); + + /** SyncActionData padding */ + padding?: (Uint8Array|null); + + /** SyncActionData version */ + version?: (number|null); + } + + /** Represents a SyncActionData. */ + class SyncActionData implements ISyncActionData { + + /** + * Constructs a new SyncActionData. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncActionData); + + /** SyncActionData index. */ + public index: Uint8Array; + + /** SyncActionData value. */ + public value?: (proto.ISyncActionValue|null); + + /** SyncActionData padding. */ + public padding: Uint8Array; + + /** SyncActionData version. */ + public version: number; + + /** + * Creates a new SyncActionData instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncActionData instance + */ + public static create(properties?: proto.ISyncActionData): proto.SyncActionData; + + /** + * Encodes the specified SyncActionData message. Does not implicitly {@link proto.SyncActionData.verify|verify} messages. + * @param message SyncActionData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncActionData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncActionData message, length delimited. Does not implicitly {@link proto.SyncActionData.verify|verify} messages. + * @param message SyncActionData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncActionData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncActionData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncActionData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionData; + + /** + * Decodes a SyncActionData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncActionData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionData; + + /** + * Verifies a SyncActionData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncActionData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncActionData + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionData; + + /** + * Creates a plain object from a SyncActionData message. Also converts values to other types if specified. + * @param message SyncActionData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncActionData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncActionValue. */ + interface ISyncActionValue { + + /** SyncActionValue timestamp */ + timestamp?: (number|Long|null); + + /** SyncActionValue starAction */ + starAction?: (proto.SyncActionValue.IStarAction|null); + + /** SyncActionValue contactAction */ + contactAction?: (proto.SyncActionValue.IContactAction|null); + + /** SyncActionValue muteAction */ + muteAction?: (proto.SyncActionValue.IMuteAction|null); + + /** SyncActionValue pinAction */ + pinAction?: (proto.SyncActionValue.IPinAction|null); + + /** SyncActionValue securityNotificationSetting */ + securityNotificationSetting?: (proto.SyncActionValue.ISecurityNotificationSetting|null); + + /** SyncActionValue pushNameSetting */ + pushNameSetting?: (proto.SyncActionValue.IPushNameSetting|null); + + /** SyncActionValue quickReplyAction */ + quickReplyAction?: (proto.SyncActionValue.IQuickReplyAction|null); + + /** SyncActionValue recentEmojiWeightsAction */ + recentEmojiWeightsAction?: (proto.SyncActionValue.IRecentEmojiWeightsAction|null); + + /** SyncActionValue labelEditAction */ + labelEditAction?: (proto.SyncActionValue.ILabelEditAction|null); + + /** SyncActionValue labelAssociationAction */ + labelAssociationAction?: (proto.SyncActionValue.ILabelAssociationAction|null); + + /** SyncActionValue localeSetting */ + localeSetting?: (proto.SyncActionValue.ILocaleSetting|null); + + /** SyncActionValue archiveChatAction */ + archiveChatAction?: (proto.SyncActionValue.IArchiveChatAction|null); + + /** SyncActionValue deleteMessageForMeAction */ + deleteMessageForMeAction?: (proto.SyncActionValue.IDeleteMessageForMeAction|null); + + /** SyncActionValue keyExpiration */ + keyExpiration?: (proto.SyncActionValue.IKeyExpiration|null); + + /** SyncActionValue markChatAsReadAction */ + markChatAsReadAction?: (proto.SyncActionValue.IMarkChatAsReadAction|null); + + /** SyncActionValue clearChatAction */ + clearChatAction?: (proto.SyncActionValue.IClearChatAction|null); + + /** SyncActionValue deleteChatAction */ + deleteChatAction?: (proto.SyncActionValue.IDeleteChatAction|null); + + /** SyncActionValue unarchiveChatsSetting */ + unarchiveChatsSetting?: (proto.SyncActionValue.IUnarchiveChatsSetting|null); + + /** SyncActionValue primaryFeature */ + primaryFeature?: (proto.SyncActionValue.IPrimaryFeature|null); + + /** SyncActionValue androidUnsupportedActions */ + androidUnsupportedActions?: (proto.SyncActionValue.IAndroidUnsupportedActions|null); + + /** SyncActionValue agentAction */ + agentAction?: (proto.SyncActionValue.IAgentAction|null); + + /** SyncActionValue subscriptionAction */ + subscriptionAction?: (proto.SyncActionValue.ISubscriptionAction|null); + + /** SyncActionValue userStatusMuteAction */ + userStatusMuteAction?: (proto.SyncActionValue.IUserStatusMuteAction|null); + + /** SyncActionValue timeFormatAction */ + timeFormatAction?: (proto.SyncActionValue.ITimeFormatAction|null); + + /** SyncActionValue nuxAction */ + nuxAction?: (proto.SyncActionValue.INuxAction|null); + + /** SyncActionValue primaryVersionAction */ + primaryVersionAction?: (proto.SyncActionValue.IPrimaryVersionAction|null); + + /** SyncActionValue stickerAction */ + stickerAction?: (proto.SyncActionValue.IStickerAction|null); + + /** SyncActionValue removeRecentStickerAction */ + removeRecentStickerAction?: (proto.SyncActionValue.IRemoveRecentStickerAction|null); + + /** SyncActionValue chatAssignment */ + chatAssignment?: (proto.SyncActionValue.IChatAssignmentAction|null); + + /** SyncActionValue chatAssignmentOpenedStatus */ + chatAssignmentOpenedStatus?: (proto.SyncActionValue.IChatAssignmentOpenedStatusAction|null); + + /** SyncActionValue pnForLidChatAction */ + pnForLidChatAction?: (proto.SyncActionValue.IPnForLidChatAction|null); + } + + /** Represents a SyncActionValue. */ + class SyncActionValue implements ISyncActionValue { + + /** + * Constructs a new SyncActionValue. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncActionValue); + + /** SyncActionValue timestamp. */ + public timestamp: (number|Long); + + /** SyncActionValue starAction. */ + public starAction?: (proto.SyncActionValue.IStarAction|null); + + /** SyncActionValue contactAction. */ + public contactAction?: (proto.SyncActionValue.IContactAction|null); + + /** SyncActionValue muteAction. */ + public muteAction?: (proto.SyncActionValue.IMuteAction|null); + + /** SyncActionValue pinAction. */ + public pinAction?: (proto.SyncActionValue.IPinAction|null); + + /** SyncActionValue securityNotificationSetting. */ + public securityNotificationSetting?: (proto.SyncActionValue.ISecurityNotificationSetting|null); + + /** SyncActionValue pushNameSetting. */ + public pushNameSetting?: (proto.SyncActionValue.IPushNameSetting|null); + + /** SyncActionValue quickReplyAction. */ + public quickReplyAction?: (proto.SyncActionValue.IQuickReplyAction|null); + + /** SyncActionValue recentEmojiWeightsAction. */ + public recentEmojiWeightsAction?: (proto.SyncActionValue.IRecentEmojiWeightsAction|null); + + /** SyncActionValue labelEditAction. */ + public labelEditAction?: (proto.SyncActionValue.ILabelEditAction|null); + + /** SyncActionValue labelAssociationAction. */ + public labelAssociationAction?: (proto.SyncActionValue.ILabelAssociationAction|null); + + /** SyncActionValue localeSetting. */ + public localeSetting?: (proto.SyncActionValue.ILocaleSetting|null); + + /** SyncActionValue archiveChatAction. */ + public archiveChatAction?: (proto.SyncActionValue.IArchiveChatAction|null); + + /** SyncActionValue deleteMessageForMeAction. */ + public deleteMessageForMeAction?: (proto.SyncActionValue.IDeleteMessageForMeAction|null); + + /** SyncActionValue keyExpiration. */ + public keyExpiration?: (proto.SyncActionValue.IKeyExpiration|null); + + /** SyncActionValue markChatAsReadAction. */ + public markChatAsReadAction?: (proto.SyncActionValue.IMarkChatAsReadAction|null); + + /** SyncActionValue clearChatAction. */ + public clearChatAction?: (proto.SyncActionValue.IClearChatAction|null); + + /** SyncActionValue deleteChatAction. */ + public deleteChatAction?: (proto.SyncActionValue.IDeleteChatAction|null); + + /** SyncActionValue unarchiveChatsSetting. */ + public unarchiveChatsSetting?: (proto.SyncActionValue.IUnarchiveChatsSetting|null); + + /** SyncActionValue primaryFeature. */ + public primaryFeature?: (proto.SyncActionValue.IPrimaryFeature|null); + + /** SyncActionValue androidUnsupportedActions. */ + public androidUnsupportedActions?: (proto.SyncActionValue.IAndroidUnsupportedActions|null); + + /** SyncActionValue agentAction. */ + public agentAction?: (proto.SyncActionValue.IAgentAction|null); + + /** SyncActionValue subscriptionAction. */ + public subscriptionAction?: (proto.SyncActionValue.ISubscriptionAction|null); + + /** SyncActionValue userStatusMuteAction. */ + public userStatusMuteAction?: (proto.SyncActionValue.IUserStatusMuteAction|null); + + /** SyncActionValue timeFormatAction. */ + public timeFormatAction?: (proto.SyncActionValue.ITimeFormatAction|null); + + /** SyncActionValue nuxAction. */ + public nuxAction?: (proto.SyncActionValue.INuxAction|null); + + /** SyncActionValue primaryVersionAction. */ + public primaryVersionAction?: (proto.SyncActionValue.IPrimaryVersionAction|null); + + /** SyncActionValue stickerAction. */ + public stickerAction?: (proto.SyncActionValue.IStickerAction|null); + + /** SyncActionValue removeRecentStickerAction. */ + public removeRecentStickerAction?: (proto.SyncActionValue.IRemoveRecentStickerAction|null); + + /** SyncActionValue chatAssignment. */ + public chatAssignment?: (proto.SyncActionValue.IChatAssignmentAction|null); + + /** SyncActionValue chatAssignmentOpenedStatus. */ + public chatAssignmentOpenedStatus?: (proto.SyncActionValue.IChatAssignmentOpenedStatusAction|null); + + /** SyncActionValue pnForLidChatAction. */ + public pnForLidChatAction?: (proto.SyncActionValue.IPnForLidChatAction|null); + + /** + * Creates a new SyncActionValue instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncActionValue instance + */ + public static create(properties?: proto.ISyncActionValue): proto.SyncActionValue; + + /** + * Encodes the specified SyncActionValue message. Does not implicitly {@link proto.SyncActionValue.verify|verify} messages. + * @param message SyncActionValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncActionValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncActionValue message, length delimited. Does not implicitly {@link proto.SyncActionValue.verify|verify} messages. + * @param message SyncActionValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncActionValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncActionValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncActionValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue; + + /** + * Decodes a SyncActionValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncActionValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue; + + /** + * Verifies a SyncActionValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncActionValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncActionValue + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue; + + /** + * Creates a plain object from a SyncActionValue message. Also converts values to other types if specified. + * @param message SyncActionValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncActionValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SyncActionValue { + + /** Properties of an AgentAction. */ + interface IAgentAction { + + /** AgentAction name */ + name?: (string|null); + + /** AgentAction deviceID */ + deviceID?: (number|null); + + /** AgentAction isDeleted */ + isDeleted?: (boolean|null); + } + + /** Represents an AgentAction. */ + class AgentAction implements IAgentAction { + + /** + * Constructs a new AgentAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IAgentAction); + + /** AgentAction name. */ + public name: string; + + /** AgentAction deviceID. */ + public deviceID: number; + + /** AgentAction isDeleted. */ + public isDeleted: boolean; + + /** + * Creates a new AgentAction instance using the specified properties. + * @param [properties] Properties to set + * @returns AgentAction instance + */ + public static create(properties?: proto.SyncActionValue.IAgentAction): proto.SyncActionValue.AgentAction; + + /** + * Encodes the specified AgentAction message. Does not implicitly {@link proto.SyncActionValue.AgentAction.verify|verify} messages. + * @param message AgentAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IAgentAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AgentAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.AgentAction.verify|verify} messages. + * @param message AgentAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IAgentAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AgentAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AgentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.AgentAction; + + /** + * Decodes an AgentAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AgentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.AgentAction; + + /** + * Verifies an AgentAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AgentAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AgentAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.AgentAction; + + /** + * Creates a plain object from an AgentAction message. Also converts values to other types if specified. + * @param message AgentAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.AgentAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AgentAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an AndroidUnsupportedActions. */ + interface IAndroidUnsupportedActions { + + /** AndroidUnsupportedActions allowed */ + allowed?: (boolean|null); + } + + /** Represents an AndroidUnsupportedActions. */ + class AndroidUnsupportedActions implements IAndroidUnsupportedActions { + + /** + * Constructs a new AndroidUnsupportedActions. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IAndroidUnsupportedActions); + + /** AndroidUnsupportedActions allowed. */ + public allowed: boolean; + + /** + * Creates a new AndroidUnsupportedActions instance using the specified properties. + * @param [properties] Properties to set + * @returns AndroidUnsupportedActions instance + */ + public static create(properties?: proto.SyncActionValue.IAndroidUnsupportedActions): proto.SyncActionValue.AndroidUnsupportedActions; + + /** + * Encodes the specified AndroidUnsupportedActions message. Does not implicitly {@link proto.SyncActionValue.AndroidUnsupportedActions.verify|verify} messages. + * @param message AndroidUnsupportedActions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IAndroidUnsupportedActions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AndroidUnsupportedActions message, length delimited. Does not implicitly {@link proto.SyncActionValue.AndroidUnsupportedActions.verify|verify} messages. + * @param message AndroidUnsupportedActions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IAndroidUnsupportedActions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AndroidUnsupportedActions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AndroidUnsupportedActions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.AndroidUnsupportedActions; + + /** + * Decodes an AndroidUnsupportedActions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AndroidUnsupportedActions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.AndroidUnsupportedActions; + + /** + * Verifies an AndroidUnsupportedActions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AndroidUnsupportedActions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AndroidUnsupportedActions + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.AndroidUnsupportedActions; + + /** + * Creates a plain object from an AndroidUnsupportedActions message. Also converts values to other types if specified. + * @param message AndroidUnsupportedActions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.AndroidUnsupportedActions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AndroidUnsupportedActions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an ArchiveChatAction. */ + interface IArchiveChatAction { + + /** ArchiveChatAction archived */ + archived?: (boolean|null); + + /** ArchiveChatAction messageRange */ + messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + } + + /** Represents an ArchiveChatAction. */ + class ArchiveChatAction implements IArchiveChatAction { + + /** + * Constructs a new ArchiveChatAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IArchiveChatAction); + + /** ArchiveChatAction archived. */ + public archived: boolean; + + /** ArchiveChatAction messageRange. */ + public messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + + /** + * Creates a new ArchiveChatAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ArchiveChatAction instance + */ + public static create(properties?: proto.SyncActionValue.IArchiveChatAction): proto.SyncActionValue.ArchiveChatAction; + + /** + * Encodes the specified ArchiveChatAction message. Does not implicitly {@link proto.SyncActionValue.ArchiveChatAction.verify|verify} messages. + * @param message ArchiveChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IArchiveChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ArchiveChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ArchiveChatAction.verify|verify} messages. + * @param message ArchiveChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IArchiveChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ArchiveChatAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArchiveChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.ArchiveChatAction; + + /** + * Decodes an ArchiveChatAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArchiveChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.ArchiveChatAction; + + /** + * Verifies an ArchiveChatAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ArchiveChatAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArchiveChatAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.ArchiveChatAction; + + /** + * Creates a plain object from an ArchiveChatAction message. Also converts values to other types if specified. + * @param message ArchiveChatAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.ArchiveChatAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ArchiveChatAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ChatAssignmentAction. */ + interface IChatAssignmentAction { + + /** ChatAssignmentAction deviceAgentID */ + deviceAgentID?: (string|null); + } + + /** Represents a ChatAssignmentAction. */ + class ChatAssignmentAction implements IChatAssignmentAction { + + /** + * Constructs a new ChatAssignmentAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IChatAssignmentAction); + + /** ChatAssignmentAction deviceAgentID. */ + public deviceAgentID: string; + + /** + * Creates a new ChatAssignmentAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ChatAssignmentAction instance + */ + public static create(properties?: proto.SyncActionValue.IChatAssignmentAction): proto.SyncActionValue.ChatAssignmentAction; + + /** + * Encodes the specified ChatAssignmentAction message. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentAction.verify|verify} messages. + * @param message ChatAssignmentAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IChatAssignmentAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChatAssignmentAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentAction.verify|verify} messages. + * @param message ChatAssignmentAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IChatAssignmentAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChatAssignmentAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChatAssignmentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.ChatAssignmentAction; + + /** + * Decodes a ChatAssignmentAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChatAssignmentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.ChatAssignmentAction; + + /** + * Verifies a ChatAssignmentAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ChatAssignmentAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChatAssignmentAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.ChatAssignmentAction; + + /** + * Creates a plain object from a ChatAssignmentAction message. Also converts values to other types if specified. + * @param message ChatAssignmentAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.ChatAssignmentAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChatAssignmentAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ChatAssignmentOpenedStatusAction. */ + interface IChatAssignmentOpenedStatusAction { + + /** ChatAssignmentOpenedStatusAction chatOpened */ + chatOpened?: (boolean|null); + } + + /** Represents a ChatAssignmentOpenedStatusAction. */ + class ChatAssignmentOpenedStatusAction implements IChatAssignmentOpenedStatusAction { + + /** + * Constructs a new ChatAssignmentOpenedStatusAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IChatAssignmentOpenedStatusAction); + + /** ChatAssignmentOpenedStatusAction chatOpened. */ + public chatOpened: boolean; + + /** + * Creates a new ChatAssignmentOpenedStatusAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ChatAssignmentOpenedStatusAction instance + */ + public static create(properties?: proto.SyncActionValue.IChatAssignmentOpenedStatusAction): proto.SyncActionValue.ChatAssignmentOpenedStatusAction; + + /** + * Encodes the specified ChatAssignmentOpenedStatusAction message. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentOpenedStatusAction.verify|verify} messages. + * @param message ChatAssignmentOpenedStatusAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IChatAssignmentOpenedStatusAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChatAssignmentOpenedStatusAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentOpenedStatusAction.verify|verify} messages. + * @param message ChatAssignmentOpenedStatusAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IChatAssignmentOpenedStatusAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChatAssignmentOpenedStatusAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChatAssignmentOpenedStatusAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.ChatAssignmentOpenedStatusAction; + + /** + * Decodes a ChatAssignmentOpenedStatusAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChatAssignmentOpenedStatusAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.ChatAssignmentOpenedStatusAction; + + /** + * Verifies a ChatAssignmentOpenedStatusAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ChatAssignmentOpenedStatusAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChatAssignmentOpenedStatusAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.ChatAssignmentOpenedStatusAction; + + /** + * Creates a plain object from a ChatAssignmentOpenedStatusAction message. Also converts values to other types if specified. + * @param message ChatAssignmentOpenedStatusAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.ChatAssignmentOpenedStatusAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChatAssignmentOpenedStatusAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ClearChatAction. */ + interface IClearChatAction { + + /** ClearChatAction messageRange */ + messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + } + + /** Represents a ClearChatAction. */ + class ClearChatAction implements IClearChatAction { + + /** + * Constructs a new ClearChatAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IClearChatAction); + + /** ClearChatAction messageRange. */ + public messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + + /** + * Creates a new ClearChatAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ClearChatAction instance + */ + public static create(properties?: proto.SyncActionValue.IClearChatAction): proto.SyncActionValue.ClearChatAction; + + /** + * Encodes the specified ClearChatAction message. Does not implicitly {@link proto.SyncActionValue.ClearChatAction.verify|verify} messages. + * @param message ClearChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IClearChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClearChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ClearChatAction.verify|verify} messages. + * @param message ClearChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IClearChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClearChatAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClearChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.ClearChatAction; + + /** + * Decodes a ClearChatAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClearChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.ClearChatAction; + + /** + * Verifies a ClearChatAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClearChatAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClearChatAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.ClearChatAction; + + /** + * Creates a plain object from a ClearChatAction message. Also converts values to other types if specified. + * @param message ClearChatAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.ClearChatAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClearChatAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ContactAction. */ + interface IContactAction { + + /** ContactAction fullName */ + fullName?: (string|null); + + /** ContactAction firstName */ + firstName?: (string|null); + + /** ContactAction lidJid */ + lidJid?: (string|null); + } + + /** Represents a ContactAction. */ + class ContactAction implements IContactAction { + + /** + * Constructs a new ContactAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IContactAction); + + /** ContactAction fullName. */ + public fullName: string; + + /** ContactAction firstName. */ + public firstName: string; + + /** ContactAction lidJid. */ + public lidJid: string; + + /** + * Creates a new ContactAction instance using the specified properties. + * @param [properties] Properties to set + * @returns ContactAction instance + */ + public static create(properties?: proto.SyncActionValue.IContactAction): proto.SyncActionValue.ContactAction; + + /** + * Encodes the specified ContactAction message. Does not implicitly {@link proto.SyncActionValue.ContactAction.verify|verify} messages. + * @param message ContactAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IContactAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContactAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ContactAction.verify|verify} messages. + * @param message ContactAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IContactAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContactAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContactAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.ContactAction; + + /** + * Decodes a ContactAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContactAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.ContactAction; + + /** + * Verifies a ContactAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContactAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContactAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.ContactAction; + + /** + * Creates a plain object from a ContactAction message. Also converts values to other types if specified. + * @param message ContactAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.ContactAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContactAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteChatAction. */ + interface IDeleteChatAction { + + /** DeleteChatAction messageRange */ + messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + } + + /** Represents a DeleteChatAction. */ + class DeleteChatAction implements IDeleteChatAction { + + /** + * Constructs a new DeleteChatAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IDeleteChatAction); + + /** DeleteChatAction messageRange. */ + public messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + + /** + * Creates a new DeleteChatAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteChatAction instance + */ + public static create(properties?: proto.SyncActionValue.IDeleteChatAction): proto.SyncActionValue.DeleteChatAction; + + /** + * Encodes the specified DeleteChatAction message. Does not implicitly {@link proto.SyncActionValue.DeleteChatAction.verify|verify} messages. + * @param message DeleteChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IDeleteChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.DeleteChatAction.verify|verify} messages. + * @param message DeleteChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IDeleteChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteChatAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.DeleteChatAction; + + /** + * Decodes a DeleteChatAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.DeleteChatAction; + + /** + * Verifies a DeleteChatAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteChatAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteChatAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.DeleteChatAction; + + /** + * Creates a plain object from a DeleteChatAction message. Also converts values to other types if specified. + * @param message DeleteChatAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.DeleteChatAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteChatAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteMessageForMeAction. */ + interface IDeleteMessageForMeAction { + + /** DeleteMessageForMeAction deleteMedia */ + deleteMedia?: (boolean|null); + + /** DeleteMessageForMeAction messageTimestamp */ + messageTimestamp?: (number|Long|null); + } + + /** Represents a DeleteMessageForMeAction. */ + class DeleteMessageForMeAction implements IDeleteMessageForMeAction { + + /** + * Constructs a new DeleteMessageForMeAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IDeleteMessageForMeAction); + + /** DeleteMessageForMeAction deleteMedia. */ + public deleteMedia: boolean; + + /** DeleteMessageForMeAction messageTimestamp. */ + public messageTimestamp: (number|Long); + + /** + * Creates a new DeleteMessageForMeAction instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteMessageForMeAction instance + */ + public static create(properties?: proto.SyncActionValue.IDeleteMessageForMeAction): proto.SyncActionValue.DeleteMessageForMeAction; + + /** + * Encodes the specified DeleteMessageForMeAction message. Does not implicitly {@link proto.SyncActionValue.DeleteMessageForMeAction.verify|verify} messages. + * @param message DeleteMessageForMeAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IDeleteMessageForMeAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteMessageForMeAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.DeleteMessageForMeAction.verify|verify} messages. + * @param message DeleteMessageForMeAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IDeleteMessageForMeAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteMessageForMeAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteMessageForMeAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.DeleteMessageForMeAction; + + /** + * Decodes a DeleteMessageForMeAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteMessageForMeAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.DeleteMessageForMeAction; + + /** + * Verifies a DeleteMessageForMeAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteMessageForMeAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteMessageForMeAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.DeleteMessageForMeAction; + + /** + * Creates a plain object from a DeleteMessageForMeAction message. Also converts values to other types if specified. + * @param message DeleteMessageForMeAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.DeleteMessageForMeAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteMessageForMeAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a KeyExpiration. */ + interface IKeyExpiration { + + /** KeyExpiration expiredKeyEpoch */ + expiredKeyEpoch?: (number|null); + } + + /** Represents a KeyExpiration. */ + class KeyExpiration implements IKeyExpiration { + + /** + * Constructs a new KeyExpiration. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IKeyExpiration); + + /** KeyExpiration expiredKeyEpoch. */ + public expiredKeyEpoch: number; + + /** + * Creates a new KeyExpiration instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyExpiration instance + */ + public static create(properties?: proto.SyncActionValue.IKeyExpiration): proto.SyncActionValue.KeyExpiration; + + /** + * Encodes the specified KeyExpiration message. Does not implicitly {@link proto.SyncActionValue.KeyExpiration.verify|verify} messages. + * @param message KeyExpiration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IKeyExpiration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeyExpiration message, length delimited. Does not implicitly {@link proto.SyncActionValue.KeyExpiration.verify|verify} messages. + * @param message KeyExpiration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IKeyExpiration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeyExpiration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyExpiration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.KeyExpiration; + + /** + * Decodes a KeyExpiration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyExpiration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.KeyExpiration; + + /** + * Verifies a KeyExpiration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeyExpiration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyExpiration + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.KeyExpiration; + + /** + * Creates a plain object from a KeyExpiration message. Also converts values to other types if specified. + * @param message KeyExpiration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.KeyExpiration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyExpiration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LabelAssociationAction. */ + interface ILabelAssociationAction { + + /** LabelAssociationAction labeled */ + labeled?: (boolean|null); + } + + /** Represents a LabelAssociationAction. */ + class LabelAssociationAction implements ILabelAssociationAction { + + /** + * Constructs a new LabelAssociationAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ILabelAssociationAction); + + /** LabelAssociationAction labeled. */ + public labeled: boolean; + + /** + * Creates a new LabelAssociationAction instance using the specified properties. + * @param [properties] Properties to set + * @returns LabelAssociationAction instance + */ + public static create(properties?: proto.SyncActionValue.ILabelAssociationAction): proto.SyncActionValue.LabelAssociationAction; + + /** + * Encodes the specified LabelAssociationAction message. Does not implicitly {@link proto.SyncActionValue.LabelAssociationAction.verify|verify} messages. + * @param message LabelAssociationAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ILabelAssociationAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LabelAssociationAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.LabelAssociationAction.verify|verify} messages. + * @param message LabelAssociationAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ILabelAssociationAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LabelAssociationAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LabelAssociationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.LabelAssociationAction; + + /** + * Decodes a LabelAssociationAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LabelAssociationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.LabelAssociationAction; + + /** + * Verifies a LabelAssociationAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LabelAssociationAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LabelAssociationAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.LabelAssociationAction; + + /** + * Creates a plain object from a LabelAssociationAction message. Also converts values to other types if specified. + * @param message LabelAssociationAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.LabelAssociationAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LabelAssociationAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LabelEditAction. */ + interface ILabelEditAction { + + /** LabelEditAction name */ + name?: (string|null); + + /** LabelEditAction color */ + color?: (number|null); + + /** LabelEditAction predefinedId */ + predefinedId?: (number|null); + + /** LabelEditAction deleted */ + deleted?: (boolean|null); + } + + /** Represents a LabelEditAction. */ + class LabelEditAction implements ILabelEditAction { + + /** + * Constructs a new LabelEditAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ILabelEditAction); + + /** LabelEditAction name. */ + public name: string; + + /** LabelEditAction color. */ + public color: number; + + /** LabelEditAction predefinedId. */ + public predefinedId: number; + + /** LabelEditAction deleted. */ + public deleted: boolean; + + /** + * Creates a new LabelEditAction instance using the specified properties. + * @param [properties] Properties to set + * @returns LabelEditAction instance + */ + public static create(properties?: proto.SyncActionValue.ILabelEditAction): proto.SyncActionValue.LabelEditAction; + + /** + * Encodes the specified LabelEditAction message. Does not implicitly {@link proto.SyncActionValue.LabelEditAction.verify|verify} messages. + * @param message LabelEditAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ILabelEditAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LabelEditAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.LabelEditAction.verify|verify} messages. + * @param message LabelEditAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ILabelEditAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LabelEditAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LabelEditAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.LabelEditAction; + + /** + * Decodes a LabelEditAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LabelEditAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.LabelEditAction; + + /** + * Verifies a LabelEditAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LabelEditAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LabelEditAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.LabelEditAction; + + /** + * Creates a plain object from a LabelEditAction message. Also converts values to other types if specified. + * @param message LabelEditAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.LabelEditAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LabelEditAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a LocaleSetting. */ + interface ILocaleSetting { + + /** LocaleSetting locale */ + locale?: (string|null); + } + + /** Represents a LocaleSetting. */ + class LocaleSetting implements ILocaleSetting { + + /** + * Constructs a new LocaleSetting. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ILocaleSetting); + + /** LocaleSetting locale. */ + public locale: string; + + /** + * Creates a new LocaleSetting instance using the specified properties. + * @param [properties] Properties to set + * @returns LocaleSetting instance + */ + public static create(properties?: proto.SyncActionValue.ILocaleSetting): proto.SyncActionValue.LocaleSetting; + + /** + * Encodes the specified LocaleSetting message. Does not implicitly {@link proto.SyncActionValue.LocaleSetting.verify|verify} messages. + * @param message LocaleSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ILocaleSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocaleSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.LocaleSetting.verify|verify} messages. + * @param message LocaleSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ILocaleSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocaleSetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocaleSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.LocaleSetting; + + /** + * Decodes a LocaleSetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocaleSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.LocaleSetting; + + /** + * Verifies a LocaleSetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocaleSetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocaleSetting + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.LocaleSetting; + + /** + * Creates a plain object from a LocaleSetting message. Also converts values to other types if specified. + * @param message LocaleSetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.LocaleSetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocaleSetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MarkChatAsReadAction. */ + interface IMarkChatAsReadAction { + + /** MarkChatAsReadAction read */ + read?: (boolean|null); + + /** MarkChatAsReadAction messageRange */ + messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + } + + /** Represents a MarkChatAsReadAction. */ + class MarkChatAsReadAction implements IMarkChatAsReadAction { + + /** + * Constructs a new MarkChatAsReadAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IMarkChatAsReadAction); + + /** MarkChatAsReadAction read. */ + public read: boolean; + + /** MarkChatAsReadAction messageRange. */ + public messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null); + + /** + * Creates a new MarkChatAsReadAction instance using the specified properties. + * @param [properties] Properties to set + * @returns MarkChatAsReadAction instance + */ + public static create(properties?: proto.SyncActionValue.IMarkChatAsReadAction): proto.SyncActionValue.MarkChatAsReadAction; + + /** + * Encodes the specified MarkChatAsReadAction message. Does not implicitly {@link proto.SyncActionValue.MarkChatAsReadAction.verify|verify} messages. + * @param message MarkChatAsReadAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IMarkChatAsReadAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MarkChatAsReadAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.MarkChatAsReadAction.verify|verify} messages. + * @param message MarkChatAsReadAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IMarkChatAsReadAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MarkChatAsReadAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MarkChatAsReadAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.MarkChatAsReadAction; + + /** + * Decodes a MarkChatAsReadAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MarkChatAsReadAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.MarkChatAsReadAction; + + /** + * Verifies a MarkChatAsReadAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MarkChatAsReadAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MarkChatAsReadAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.MarkChatAsReadAction; + + /** + * Creates a plain object from a MarkChatAsReadAction message. Also converts values to other types if specified. + * @param message MarkChatAsReadAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.MarkChatAsReadAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MarkChatAsReadAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MuteAction. */ + interface IMuteAction { + + /** MuteAction muted */ + muted?: (boolean|null); + + /** MuteAction muteEndTimestamp */ + muteEndTimestamp?: (number|Long|null); + + /** MuteAction autoMuted */ + autoMuted?: (boolean|null); + } + + /** Represents a MuteAction. */ + class MuteAction implements IMuteAction { + + /** + * Constructs a new MuteAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IMuteAction); + + /** MuteAction muted. */ + public muted: boolean; + + /** MuteAction muteEndTimestamp. */ + public muteEndTimestamp: (number|Long); + + /** MuteAction autoMuted. */ + public autoMuted: boolean; + + /** + * Creates a new MuteAction instance using the specified properties. + * @param [properties] Properties to set + * @returns MuteAction instance + */ + public static create(properties?: proto.SyncActionValue.IMuteAction): proto.SyncActionValue.MuteAction; + + /** + * Encodes the specified MuteAction message. Does not implicitly {@link proto.SyncActionValue.MuteAction.verify|verify} messages. + * @param message MuteAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IMuteAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MuteAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.MuteAction.verify|verify} messages. + * @param message MuteAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IMuteAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MuteAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.MuteAction; + + /** + * Decodes a MuteAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.MuteAction; + + /** + * Verifies a MuteAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MuteAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MuteAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.MuteAction; + + /** + * Creates a plain object from a MuteAction message. Also converts values to other types if specified. + * @param message MuteAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.MuteAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MuteAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NuxAction. */ + interface INuxAction { + + /** NuxAction acknowledged */ + acknowledged?: (boolean|null); + } + + /** Represents a NuxAction. */ + class NuxAction implements INuxAction { + + /** + * Constructs a new NuxAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.INuxAction); + + /** NuxAction acknowledged. */ + public acknowledged: boolean; + + /** + * Creates a new NuxAction instance using the specified properties. + * @param [properties] Properties to set + * @returns NuxAction instance + */ + public static create(properties?: proto.SyncActionValue.INuxAction): proto.SyncActionValue.NuxAction; + + /** + * Encodes the specified NuxAction message. Does not implicitly {@link proto.SyncActionValue.NuxAction.verify|verify} messages. + * @param message NuxAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.INuxAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NuxAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.NuxAction.verify|verify} messages. + * @param message NuxAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.INuxAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NuxAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NuxAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.NuxAction; + + /** + * Decodes a NuxAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NuxAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.NuxAction; + + /** + * Verifies a NuxAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NuxAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NuxAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.NuxAction; + + /** + * Creates a plain object from a NuxAction message. Also converts values to other types if specified. + * @param message NuxAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.NuxAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NuxAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PinAction. */ + interface IPinAction { + + /** PinAction pinned */ + pinned?: (boolean|null); + } + + /** Represents a PinAction. */ + class PinAction implements IPinAction { + + /** + * Constructs a new PinAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IPinAction); + + /** PinAction pinned. */ + public pinned: boolean; + + /** + * Creates a new PinAction instance using the specified properties. + * @param [properties] Properties to set + * @returns PinAction instance + */ + public static create(properties?: proto.SyncActionValue.IPinAction): proto.SyncActionValue.PinAction; + + /** + * Encodes the specified PinAction message. Does not implicitly {@link proto.SyncActionValue.PinAction.verify|verify} messages. + * @param message PinAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IPinAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PinAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.PinAction.verify|verify} messages. + * @param message PinAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IPinAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PinAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PinAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.PinAction; + + /** + * Decodes a PinAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PinAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.PinAction; + + /** + * Verifies a PinAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PinAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PinAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.PinAction; + + /** + * Creates a plain object from a PinAction message. Also converts values to other types if specified. + * @param message PinAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.PinAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PinAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PnForLidChatAction. */ + interface IPnForLidChatAction { + + /** PnForLidChatAction pnJid */ + pnJid?: (string|null); + } + + /** Represents a PnForLidChatAction. */ + class PnForLidChatAction implements IPnForLidChatAction { + + /** + * Constructs a new PnForLidChatAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IPnForLidChatAction); + + /** PnForLidChatAction pnJid. */ + public pnJid: string; + + /** + * Creates a new PnForLidChatAction instance using the specified properties. + * @param [properties] Properties to set + * @returns PnForLidChatAction instance + */ + public static create(properties?: proto.SyncActionValue.IPnForLidChatAction): proto.SyncActionValue.PnForLidChatAction; + + /** + * Encodes the specified PnForLidChatAction message. Does not implicitly {@link proto.SyncActionValue.PnForLidChatAction.verify|verify} messages. + * @param message PnForLidChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IPnForLidChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PnForLidChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.PnForLidChatAction.verify|verify} messages. + * @param message PnForLidChatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IPnForLidChatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PnForLidChatAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PnForLidChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.PnForLidChatAction; + + /** + * Decodes a PnForLidChatAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PnForLidChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.PnForLidChatAction; + + /** + * Verifies a PnForLidChatAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PnForLidChatAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PnForLidChatAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.PnForLidChatAction; + + /** + * Creates a plain object from a PnForLidChatAction message. Also converts values to other types if specified. + * @param message PnForLidChatAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.PnForLidChatAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PnForLidChatAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PrimaryFeature. */ + interface IPrimaryFeature { + + /** PrimaryFeature flags */ + flags?: (string[]|null); + } + + /** Represents a PrimaryFeature. */ + class PrimaryFeature implements IPrimaryFeature { + + /** + * Constructs a new PrimaryFeature. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IPrimaryFeature); + + /** PrimaryFeature flags. */ + public flags: string[]; + + /** + * Creates a new PrimaryFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns PrimaryFeature instance + */ + public static create(properties?: proto.SyncActionValue.IPrimaryFeature): proto.SyncActionValue.PrimaryFeature; + + /** + * Encodes the specified PrimaryFeature message. Does not implicitly {@link proto.SyncActionValue.PrimaryFeature.verify|verify} messages. + * @param message PrimaryFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IPrimaryFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PrimaryFeature message, length delimited. Does not implicitly {@link proto.SyncActionValue.PrimaryFeature.verify|verify} messages. + * @param message PrimaryFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IPrimaryFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PrimaryFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PrimaryFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.PrimaryFeature; + + /** + * Decodes a PrimaryFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PrimaryFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.PrimaryFeature; + + /** + * Verifies a PrimaryFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PrimaryFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PrimaryFeature + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.PrimaryFeature; + + /** + * Creates a plain object from a PrimaryFeature message. Also converts values to other types if specified. + * @param message PrimaryFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.PrimaryFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PrimaryFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PrimaryVersionAction. */ + interface IPrimaryVersionAction { + + /** PrimaryVersionAction version */ + version?: (string|null); + } + + /** Represents a PrimaryVersionAction. */ + class PrimaryVersionAction implements IPrimaryVersionAction { + + /** + * Constructs a new PrimaryVersionAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IPrimaryVersionAction); + + /** PrimaryVersionAction version. */ + public version: string; + + /** + * Creates a new PrimaryVersionAction instance using the specified properties. + * @param [properties] Properties to set + * @returns PrimaryVersionAction instance + */ + public static create(properties?: proto.SyncActionValue.IPrimaryVersionAction): proto.SyncActionValue.PrimaryVersionAction; + + /** + * Encodes the specified PrimaryVersionAction message. Does not implicitly {@link proto.SyncActionValue.PrimaryVersionAction.verify|verify} messages. + * @param message PrimaryVersionAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IPrimaryVersionAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PrimaryVersionAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.PrimaryVersionAction.verify|verify} messages. + * @param message PrimaryVersionAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IPrimaryVersionAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PrimaryVersionAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PrimaryVersionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.PrimaryVersionAction; + + /** + * Decodes a PrimaryVersionAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PrimaryVersionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.PrimaryVersionAction; + + /** + * Verifies a PrimaryVersionAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PrimaryVersionAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PrimaryVersionAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.PrimaryVersionAction; + + /** + * Creates a plain object from a PrimaryVersionAction message. Also converts values to other types if specified. + * @param message PrimaryVersionAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.PrimaryVersionAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PrimaryVersionAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PushNameSetting. */ + interface IPushNameSetting { + + /** PushNameSetting name */ + name?: (string|null); + } + + /** Represents a PushNameSetting. */ + class PushNameSetting implements IPushNameSetting { + + /** + * Constructs a new PushNameSetting. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IPushNameSetting); + + /** PushNameSetting name. */ + public name: string; + + /** + * Creates a new PushNameSetting instance using the specified properties. + * @param [properties] Properties to set + * @returns PushNameSetting instance + */ + public static create(properties?: proto.SyncActionValue.IPushNameSetting): proto.SyncActionValue.PushNameSetting; + + /** + * Encodes the specified PushNameSetting message. Does not implicitly {@link proto.SyncActionValue.PushNameSetting.verify|verify} messages. + * @param message PushNameSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IPushNameSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PushNameSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.PushNameSetting.verify|verify} messages. + * @param message PushNameSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IPushNameSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PushNameSetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PushNameSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.PushNameSetting; + + /** + * Decodes a PushNameSetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PushNameSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.PushNameSetting; + + /** + * Verifies a PushNameSetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PushNameSetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PushNameSetting + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.PushNameSetting; + + /** + * Creates a plain object from a PushNameSetting message. Also converts values to other types if specified. + * @param message PushNameSetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.PushNameSetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PushNameSetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a QuickReplyAction. */ + interface IQuickReplyAction { + + /** QuickReplyAction shortcut */ + shortcut?: (string|null); + + /** QuickReplyAction message */ + message?: (string|null); + + /** QuickReplyAction keywords */ + keywords?: (string[]|null); + + /** QuickReplyAction count */ + count?: (number|null); + + /** QuickReplyAction deleted */ + deleted?: (boolean|null); + } + + /** Represents a QuickReplyAction. */ + class QuickReplyAction implements IQuickReplyAction { + + /** + * Constructs a new QuickReplyAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IQuickReplyAction); + + /** QuickReplyAction shortcut. */ + public shortcut: string; + + /** QuickReplyAction message. */ + public message: string; + + /** QuickReplyAction keywords. */ + public keywords: string[]; + + /** QuickReplyAction count. */ + public count: number; + + /** QuickReplyAction deleted. */ + public deleted: boolean; + + /** + * Creates a new QuickReplyAction instance using the specified properties. + * @param [properties] Properties to set + * @returns QuickReplyAction instance + */ + public static create(properties?: proto.SyncActionValue.IQuickReplyAction): proto.SyncActionValue.QuickReplyAction; + + /** + * Encodes the specified QuickReplyAction message. Does not implicitly {@link proto.SyncActionValue.QuickReplyAction.verify|verify} messages. + * @param message QuickReplyAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IQuickReplyAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuickReplyAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.QuickReplyAction.verify|verify} messages. + * @param message QuickReplyAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IQuickReplyAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuickReplyAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuickReplyAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.QuickReplyAction; + + /** + * Decodes a QuickReplyAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuickReplyAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.QuickReplyAction; + + /** + * Verifies a QuickReplyAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QuickReplyAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuickReplyAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.QuickReplyAction; + + /** + * Creates a plain object from a QuickReplyAction message. Also converts values to other types if specified. + * @param message QuickReplyAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.QuickReplyAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuickReplyAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RecentEmojiWeightsAction. */ + interface IRecentEmojiWeightsAction { + + /** RecentEmojiWeightsAction weights */ + weights?: (proto.IRecentEmojiWeight[]|null); + } + + /** Represents a RecentEmojiWeightsAction. */ + class RecentEmojiWeightsAction implements IRecentEmojiWeightsAction { + + /** + * Constructs a new RecentEmojiWeightsAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IRecentEmojiWeightsAction); + + /** RecentEmojiWeightsAction weights. */ + public weights: proto.IRecentEmojiWeight[]; + + /** + * Creates a new RecentEmojiWeightsAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RecentEmojiWeightsAction instance + */ + public static create(properties?: proto.SyncActionValue.IRecentEmojiWeightsAction): proto.SyncActionValue.RecentEmojiWeightsAction; + + /** + * Encodes the specified RecentEmojiWeightsAction message. Does not implicitly {@link proto.SyncActionValue.RecentEmojiWeightsAction.verify|verify} messages. + * @param message RecentEmojiWeightsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IRecentEmojiWeightsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RecentEmojiWeightsAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.RecentEmojiWeightsAction.verify|verify} messages. + * @param message RecentEmojiWeightsAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IRecentEmojiWeightsAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RecentEmojiWeightsAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RecentEmojiWeightsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.RecentEmojiWeightsAction; + + /** + * Decodes a RecentEmojiWeightsAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RecentEmojiWeightsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.RecentEmojiWeightsAction; + + /** + * Verifies a RecentEmojiWeightsAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RecentEmojiWeightsAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RecentEmojiWeightsAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.RecentEmojiWeightsAction; + + /** + * Creates a plain object from a RecentEmojiWeightsAction message. Also converts values to other types if specified. + * @param message RecentEmojiWeightsAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.RecentEmojiWeightsAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RecentEmojiWeightsAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a RemoveRecentStickerAction. */ + interface IRemoveRecentStickerAction { + + /** RemoveRecentStickerAction lastStickerSentTs */ + lastStickerSentTs?: (number|Long|null); + } + + /** Represents a RemoveRecentStickerAction. */ + class RemoveRecentStickerAction implements IRemoveRecentStickerAction { + + /** + * Constructs a new RemoveRecentStickerAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IRemoveRecentStickerAction); + + /** RemoveRecentStickerAction lastStickerSentTs. */ + public lastStickerSentTs: (number|Long); + + /** + * Creates a new RemoveRecentStickerAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RemoveRecentStickerAction instance + */ + public static create(properties?: proto.SyncActionValue.IRemoveRecentStickerAction): proto.SyncActionValue.RemoveRecentStickerAction; + + /** + * Encodes the specified RemoveRecentStickerAction message. Does not implicitly {@link proto.SyncActionValue.RemoveRecentStickerAction.verify|verify} messages. + * @param message RemoveRecentStickerAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IRemoveRecentStickerAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RemoveRecentStickerAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.RemoveRecentStickerAction.verify|verify} messages. + * @param message RemoveRecentStickerAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IRemoveRecentStickerAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RemoveRecentStickerAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RemoveRecentStickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.RemoveRecentStickerAction; + + /** + * Decodes a RemoveRecentStickerAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RemoveRecentStickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.RemoveRecentStickerAction; + + /** + * Verifies a RemoveRecentStickerAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RemoveRecentStickerAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RemoveRecentStickerAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.RemoveRecentStickerAction; + + /** + * Creates a plain object from a RemoveRecentStickerAction message. Also converts values to other types if specified. + * @param message RemoveRecentStickerAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.RemoveRecentStickerAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RemoveRecentStickerAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SecurityNotificationSetting. */ + interface ISecurityNotificationSetting { + + /** SecurityNotificationSetting showNotification */ + showNotification?: (boolean|null); + } + + /** Represents a SecurityNotificationSetting. */ + class SecurityNotificationSetting implements ISecurityNotificationSetting { + + /** + * Constructs a new SecurityNotificationSetting. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ISecurityNotificationSetting); + + /** SecurityNotificationSetting showNotification. */ + public showNotification: boolean; + + /** + * Creates a new SecurityNotificationSetting instance using the specified properties. + * @param [properties] Properties to set + * @returns SecurityNotificationSetting instance + */ + public static create(properties?: proto.SyncActionValue.ISecurityNotificationSetting): proto.SyncActionValue.SecurityNotificationSetting; + + /** + * Encodes the specified SecurityNotificationSetting message. Does not implicitly {@link proto.SyncActionValue.SecurityNotificationSetting.verify|verify} messages. + * @param message SecurityNotificationSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ISecurityNotificationSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SecurityNotificationSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.SecurityNotificationSetting.verify|verify} messages. + * @param message SecurityNotificationSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ISecurityNotificationSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SecurityNotificationSetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SecurityNotificationSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.SecurityNotificationSetting; + + /** + * Decodes a SecurityNotificationSetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SecurityNotificationSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.SecurityNotificationSetting; + + /** + * Verifies a SecurityNotificationSetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SecurityNotificationSetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SecurityNotificationSetting + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.SecurityNotificationSetting; + + /** + * Creates a plain object from a SecurityNotificationSetting message. Also converts values to other types if specified. + * @param message SecurityNotificationSetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.SecurityNotificationSetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SecurityNotificationSetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StarAction. */ + interface IStarAction { + + /** StarAction starred */ + starred?: (boolean|null); + } + + /** Represents a StarAction. */ + class StarAction implements IStarAction { + + /** + * Constructs a new StarAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IStarAction); + + /** StarAction starred. */ + public starred: boolean; + + /** + * Creates a new StarAction instance using the specified properties. + * @param [properties] Properties to set + * @returns StarAction instance + */ + public static create(properties?: proto.SyncActionValue.IStarAction): proto.SyncActionValue.StarAction; + + /** + * Encodes the specified StarAction message. Does not implicitly {@link proto.SyncActionValue.StarAction.verify|verify} messages. + * @param message StarAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IStarAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StarAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.StarAction.verify|verify} messages. + * @param message StarAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IStarAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StarAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StarAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.StarAction; + + /** + * Decodes a StarAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StarAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.StarAction; + + /** + * Verifies a StarAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StarAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StarAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.StarAction; + + /** + * Creates a plain object from a StarAction message. Also converts values to other types if specified. + * @param message StarAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.StarAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StarAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a StickerAction. */ + interface IStickerAction { + + /** StickerAction url */ + url?: (string|null); + + /** StickerAction fileEncSha256 */ + fileEncSha256?: (Uint8Array|null); + + /** StickerAction mediaKey */ + mediaKey?: (Uint8Array|null); + + /** StickerAction mimetype */ + mimetype?: (string|null); + + /** StickerAction height */ + height?: (number|null); + + /** StickerAction width */ + width?: (number|null); + + /** StickerAction directPath */ + directPath?: (string|null); + + /** StickerAction fileLength */ + fileLength?: (number|Long|null); + + /** StickerAction isFavorite */ + isFavorite?: (boolean|null); + + /** StickerAction deviceIdHint */ + deviceIdHint?: (number|null); + } + + /** Represents a StickerAction. */ + class StickerAction implements IStickerAction { + + /** + * Constructs a new StickerAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IStickerAction); + + /** StickerAction url. */ + public url: string; + + /** StickerAction fileEncSha256. */ + public fileEncSha256: Uint8Array; + + /** StickerAction mediaKey. */ + public mediaKey: Uint8Array; + + /** StickerAction mimetype. */ + public mimetype: string; + + /** StickerAction height. */ + public height: number; + + /** StickerAction width. */ + public width: number; + + /** StickerAction directPath. */ + public directPath: string; + + /** StickerAction fileLength. */ + public fileLength: (number|Long); + + /** StickerAction isFavorite. */ + public isFavorite: boolean; + + /** StickerAction deviceIdHint. */ + public deviceIdHint: number; + + /** + * Creates a new StickerAction instance using the specified properties. + * @param [properties] Properties to set + * @returns StickerAction instance + */ + public static create(properties?: proto.SyncActionValue.IStickerAction): proto.SyncActionValue.StickerAction; + + /** + * Encodes the specified StickerAction message. Does not implicitly {@link proto.SyncActionValue.StickerAction.verify|verify} messages. + * @param message StickerAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IStickerAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StickerAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.StickerAction.verify|verify} messages. + * @param message StickerAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IStickerAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StickerAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.StickerAction; + + /** + * Decodes a StickerAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.StickerAction; + + /** + * Verifies a StickerAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StickerAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StickerAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.StickerAction; + + /** + * Creates a plain object from a StickerAction message. Also converts values to other types if specified. + * @param message StickerAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.StickerAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StickerAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SubscriptionAction. */ + interface ISubscriptionAction { + + /** SubscriptionAction isDeactivated */ + isDeactivated?: (boolean|null); + + /** SubscriptionAction isAutoRenewing */ + isAutoRenewing?: (boolean|null); + + /** SubscriptionAction expirationDate */ + expirationDate?: (number|Long|null); + } + + /** Represents a SubscriptionAction. */ + class SubscriptionAction implements ISubscriptionAction { + + /** + * Constructs a new SubscriptionAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ISubscriptionAction); + + /** SubscriptionAction isDeactivated. */ + public isDeactivated: boolean; + + /** SubscriptionAction isAutoRenewing. */ + public isAutoRenewing: boolean; + + /** SubscriptionAction expirationDate. */ + public expirationDate: (number|Long); + + /** + * Creates a new SubscriptionAction instance using the specified properties. + * @param [properties] Properties to set + * @returns SubscriptionAction instance + */ + public static create(properties?: proto.SyncActionValue.ISubscriptionAction): proto.SyncActionValue.SubscriptionAction; + + /** + * Encodes the specified SubscriptionAction message. Does not implicitly {@link proto.SyncActionValue.SubscriptionAction.verify|verify} messages. + * @param message SubscriptionAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ISubscriptionAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SubscriptionAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.SubscriptionAction.verify|verify} messages. + * @param message SubscriptionAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ISubscriptionAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SubscriptionAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SubscriptionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.SubscriptionAction; + + /** + * Decodes a SubscriptionAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SubscriptionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.SubscriptionAction; + + /** + * Verifies a SubscriptionAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SubscriptionAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SubscriptionAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.SubscriptionAction; + + /** + * Creates a plain object from a SubscriptionAction message. Also converts values to other types if specified. + * @param message SubscriptionAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.SubscriptionAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SubscriptionAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncActionMessage. */ + interface ISyncActionMessage { + + /** SyncActionMessage key */ + key?: (proto.IMessageKey|null); + + /** SyncActionMessage timestamp */ + timestamp?: (number|Long|null); + } + + /** Represents a SyncActionMessage. */ + class SyncActionMessage implements ISyncActionMessage { + + /** + * Constructs a new SyncActionMessage. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ISyncActionMessage); + + /** SyncActionMessage key. */ + public key?: (proto.IMessageKey|null); + + /** SyncActionMessage timestamp. */ + public timestamp: (number|Long); + + /** + * Creates a new SyncActionMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncActionMessage instance + */ + public static create(properties?: proto.SyncActionValue.ISyncActionMessage): proto.SyncActionValue.SyncActionMessage; + + /** + * Encodes the specified SyncActionMessage message. Does not implicitly {@link proto.SyncActionValue.SyncActionMessage.verify|verify} messages. + * @param message SyncActionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ISyncActionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncActionMessage message, length delimited. Does not implicitly {@link proto.SyncActionValue.SyncActionMessage.verify|verify} messages. + * @param message SyncActionMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ISyncActionMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncActionMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncActionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.SyncActionMessage; + + /** + * Decodes a SyncActionMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncActionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.SyncActionMessage; + + /** + * Verifies a SyncActionMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncActionMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncActionMessage + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.SyncActionMessage; + + /** + * Creates a plain object from a SyncActionMessage message. Also converts values to other types if specified. + * @param message SyncActionMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.SyncActionMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncActionMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncActionMessageRange. */ + interface ISyncActionMessageRange { + + /** SyncActionMessageRange lastMessageTimestamp */ + lastMessageTimestamp?: (number|Long|null); + + /** SyncActionMessageRange lastSystemMessageTimestamp */ + lastSystemMessageTimestamp?: (number|Long|null); + + /** SyncActionMessageRange messages */ + messages?: (proto.SyncActionValue.ISyncActionMessage[]|null); + } + + /** Represents a SyncActionMessageRange. */ + class SyncActionMessageRange implements ISyncActionMessageRange { + + /** + * Constructs a new SyncActionMessageRange. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ISyncActionMessageRange); + + /** SyncActionMessageRange lastMessageTimestamp. */ + public lastMessageTimestamp: (number|Long); + + /** SyncActionMessageRange lastSystemMessageTimestamp. */ + public lastSystemMessageTimestamp: (number|Long); + + /** SyncActionMessageRange messages. */ + public messages: proto.SyncActionValue.ISyncActionMessage[]; + + /** + * Creates a new SyncActionMessageRange instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncActionMessageRange instance + */ + public static create(properties?: proto.SyncActionValue.ISyncActionMessageRange): proto.SyncActionValue.SyncActionMessageRange; + + /** + * Encodes the specified SyncActionMessageRange message. Does not implicitly {@link proto.SyncActionValue.SyncActionMessageRange.verify|verify} messages. + * @param message SyncActionMessageRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ISyncActionMessageRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncActionMessageRange message, length delimited. Does not implicitly {@link proto.SyncActionValue.SyncActionMessageRange.verify|verify} messages. + * @param message SyncActionMessageRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ISyncActionMessageRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncActionMessageRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncActionMessageRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.SyncActionMessageRange; + + /** + * Decodes a SyncActionMessageRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncActionMessageRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.SyncActionMessageRange; + + /** + * Verifies a SyncActionMessageRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncActionMessageRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncActionMessageRange + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.SyncActionMessageRange; + + /** + * Creates a plain object from a SyncActionMessageRange message. Also converts values to other types if specified. + * @param message SyncActionMessageRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.SyncActionMessageRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncActionMessageRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TimeFormatAction. */ + interface ITimeFormatAction { + + /** TimeFormatAction isTwentyFourHourFormatEnabled */ + isTwentyFourHourFormatEnabled?: (boolean|null); + } + + /** Represents a TimeFormatAction. */ + class TimeFormatAction implements ITimeFormatAction { + + /** + * Constructs a new TimeFormatAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.ITimeFormatAction); + + /** TimeFormatAction isTwentyFourHourFormatEnabled. */ + public isTwentyFourHourFormatEnabled: boolean; + + /** + * Creates a new TimeFormatAction instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeFormatAction instance + */ + public static create(properties?: proto.SyncActionValue.ITimeFormatAction): proto.SyncActionValue.TimeFormatAction; + + /** + * Encodes the specified TimeFormatAction message. Does not implicitly {@link proto.SyncActionValue.TimeFormatAction.verify|verify} messages. + * @param message TimeFormatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.ITimeFormatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeFormatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.TimeFormatAction.verify|verify} messages. + * @param message TimeFormatAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.ITimeFormatAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeFormatAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeFormatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.TimeFormatAction; + + /** + * Decodes a TimeFormatAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeFormatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.TimeFormatAction; + + /** + * Verifies a TimeFormatAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeFormatAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeFormatAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.TimeFormatAction; + + /** + * Creates a plain object from a TimeFormatAction message. Also converts values to other types if specified. + * @param message TimeFormatAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.TimeFormatAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeFormatAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UnarchiveChatsSetting. */ + interface IUnarchiveChatsSetting { + + /** UnarchiveChatsSetting unarchiveChats */ + unarchiveChats?: (boolean|null); + } + + /** Represents an UnarchiveChatsSetting. */ + class UnarchiveChatsSetting implements IUnarchiveChatsSetting { + + /** + * Constructs a new UnarchiveChatsSetting. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IUnarchiveChatsSetting); + + /** UnarchiveChatsSetting unarchiveChats. */ + public unarchiveChats: boolean; + + /** + * Creates a new UnarchiveChatsSetting instance using the specified properties. + * @param [properties] Properties to set + * @returns UnarchiveChatsSetting instance + */ + public static create(properties?: proto.SyncActionValue.IUnarchiveChatsSetting): proto.SyncActionValue.UnarchiveChatsSetting; + + /** + * Encodes the specified UnarchiveChatsSetting message. Does not implicitly {@link proto.SyncActionValue.UnarchiveChatsSetting.verify|verify} messages. + * @param message UnarchiveChatsSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IUnarchiveChatsSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UnarchiveChatsSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.UnarchiveChatsSetting.verify|verify} messages. + * @param message UnarchiveChatsSetting message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IUnarchiveChatsSetting, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UnarchiveChatsSetting message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UnarchiveChatsSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.UnarchiveChatsSetting; + + /** + * Decodes an UnarchiveChatsSetting message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UnarchiveChatsSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.UnarchiveChatsSetting; + + /** + * Verifies an UnarchiveChatsSetting message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UnarchiveChatsSetting message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UnarchiveChatsSetting + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.UnarchiveChatsSetting; + + /** + * Creates a plain object from an UnarchiveChatsSetting message. Also converts values to other types if specified. + * @param message UnarchiveChatsSetting + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.UnarchiveChatsSetting, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UnarchiveChatsSetting to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a UserStatusMuteAction. */ + interface IUserStatusMuteAction { + + /** UserStatusMuteAction muted */ + muted?: (boolean|null); + } + + /** Represents a UserStatusMuteAction. */ + class UserStatusMuteAction implements IUserStatusMuteAction { + + /** + * Constructs a new UserStatusMuteAction. + * @param [properties] Properties to set + */ + constructor(properties?: proto.SyncActionValue.IUserStatusMuteAction); + + /** UserStatusMuteAction muted. */ + public muted: boolean; + + /** + * Creates a new UserStatusMuteAction instance using the specified properties. + * @param [properties] Properties to set + * @returns UserStatusMuteAction instance + */ + public static create(properties?: proto.SyncActionValue.IUserStatusMuteAction): proto.SyncActionValue.UserStatusMuteAction; + + /** + * Encodes the specified UserStatusMuteAction message. Does not implicitly {@link proto.SyncActionValue.UserStatusMuteAction.verify|verify} messages. + * @param message UserStatusMuteAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.SyncActionValue.IUserStatusMuteAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserStatusMuteAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.UserStatusMuteAction.verify|verify} messages. + * @param message UserStatusMuteAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.SyncActionValue.IUserStatusMuteAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserStatusMuteAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserStatusMuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncActionValue.UserStatusMuteAction; + + /** + * Decodes a UserStatusMuteAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserStatusMuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncActionValue.UserStatusMuteAction; + + /** + * Verifies a UserStatusMuteAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserStatusMuteAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserStatusMuteAction + */ + public static fromObject(object: { [k: string]: any }): proto.SyncActionValue.UserStatusMuteAction; + + /** + * Creates a plain object from a UserStatusMuteAction message. Also converts values to other types if specified. + * @param message UserStatusMuteAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncActionValue.UserStatusMuteAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserStatusMuteAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SyncdIndex. */ + interface ISyncdIndex { + + /** SyncdIndex blob */ + blob?: (Uint8Array|null); + } + + /** Represents a SyncdIndex. */ + class SyncdIndex implements ISyncdIndex { + + /** + * Constructs a new SyncdIndex. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdIndex); + + /** SyncdIndex blob. */ + public blob: Uint8Array; + + /** + * Creates a new SyncdIndex instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdIndex instance + */ + public static create(properties?: proto.ISyncdIndex): proto.SyncdIndex; + + /** + * Encodes the specified SyncdIndex message. Does not implicitly {@link proto.SyncdIndex.verify|verify} messages. + * @param message SyncdIndex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdIndex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdIndex message, length delimited. Does not implicitly {@link proto.SyncdIndex.verify|verify} messages. + * @param message SyncdIndex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdIndex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdIndex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdIndex; + + /** + * Decodes a SyncdIndex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdIndex; + + /** + * Verifies a SyncdIndex message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdIndex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdIndex + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdIndex; + + /** + * Creates a plain object from a SyncdIndex message. Also converts values to other types if specified. + * @param message SyncdIndex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdIndex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdIndex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncdMutation. */ + interface ISyncdMutation { + + /** SyncdMutation operation */ + operation?: (proto.SyncdMutation.SyncdOperation|null); + + /** SyncdMutation record */ + record?: (proto.ISyncdRecord|null); + } + + /** Represents a SyncdMutation. */ + class SyncdMutation implements ISyncdMutation { + + /** + * Constructs a new SyncdMutation. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdMutation); + + /** SyncdMutation operation. */ + public operation: proto.SyncdMutation.SyncdOperation; + + /** SyncdMutation record. */ + public record?: (proto.ISyncdRecord|null); + + /** + * Creates a new SyncdMutation instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdMutation instance + */ + public static create(properties?: proto.ISyncdMutation): proto.SyncdMutation; + + /** + * Encodes the specified SyncdMutation message. Does not implicitly {@link proto.SyncdMutation.verify|verify} messages. + * @param message SyncdMutation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdMutation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdMutation message, length delimited. Does not implicitly {@link proto.SyncdMutation.verify|verify} messages. + * @param message SyncdMutation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdMutation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdMutation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdMutation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdMutation; + + /** + * Decodes a SyncdMutation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdMutation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdMutation; + + /** + * Verifies a SyncdMutation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdMutation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdMutation + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdMutation; + + /** + * Creates a plain object from a SyncdMutation message. Also converts values to other types if specified. + * @param message SyncdMutation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdMutation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdMutation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SyncdMutation { + + /** SyncdOperation enum. */ + enum SyncdOperation { + SET = 0, + REMOVE = 1 + } + } + + /** Properties of a SyncdMutations. */ + interface ISyncdMutations { + + /** SyncdMutations mutations */ + mutations?: (proto.ISyncdMutation[]|null); + } + + /** Represents a SyncdMutations. */ + class SyncdMutations implements ISyncdMutations { + + /** + * Constructs a new SyncdMutations. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdMutations); + + /** SyncdMutations mutations. */ + public mutations: proto.ISyncdMutation[]; + + /** + * Creates a new SyncdMutations instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdMutations instance + */ + public static create(properties?: proto.ISyncdMutations): proto.SyncdMutations; + + /** + * Encodes the specified SyncdMutations message. Does not implicitly {@link proto.SyncdMutations.verify|verify} messages. + * @param message SyncdMutations message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdMutations, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdMutations message, length delimited. Does not implicitly {@link proto.SyncdMutations.verify|verify} messages. + * @param message SyncdMutations message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdMutations, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdMutations message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdMutations + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdMutations; + + /** + * Decodes a SyncdMutations message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdMutations + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdMutations; + + /** + * Verifies a SyncdMutations message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdMutations message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdMutations + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdMutations; + + /** + * Creates a plain object from a SyncdMutations message. Also converts values to other types if specified. + * @param message SyncdMutations + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdMutations, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdMutations to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncdPatch. */ + interface ISyncdPatch { + + /** SyncdPatch version */ + version?: (proto.ISyncdVersion|null); + + /** SyncdPatch mutations */ + mutations?: (proto.ISyncdMutation[]|null); + + /** SyncdPatch externalMutations */ + externalMutations?: (proto.IExternalBlobReference|null); + + /** SyncdPatch snapshotMac */ + snapshotMac?: (Uint8Array|null); + + /** SyncdPatch patchMac */ + patchMac?: (Uint8Array|null); + + /** SyncdPatch keyId */ + keyId?: (proto.IKeyId|null); + + /** SyncdPatch exitCode */ + exitCode?: (proto.IExitCode|null); + + /** SyncdPatch deviceIndex */ + deviceIndex?: (number|null); + } + + /** Represents a SyncdPatch. */ + class SyncdPatch implements ISyncdPatch { + + /** + * Constructs a new SyncdPatch. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdPatch); + + /** SyncdPatch version. */ + public version?: (proto.ISyncdVersion|null); + + /** SyncdPatch mutations. */ + public mutations: proto.ISyncdMutation[]; + + /** SyncdPatch externalMutations. */ + public externalMutations?: (proto.IExternalBlobReference|null); + + /** SyncdPatch snapshotMac. */ + public snapshotMac: Uint8Array; + + /** SyncdPatch patchMac. */ + public patchMac: Uint8Array; + + /** SyncdPatch keyId. */ + public keyId?: (proto.IKeyId|null); + + /** SyncdPatch exitCode. */ + public exitCode?: (proto.IExitCode|null); + + /** SyncdPatch deviceIndex. */ + public deviceIndex: number; + + /** + * Creates a new SyncdPatch instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdPatch instance + */ + public static create(properties?: proto.ISyncdPatch): proto.SyncdPatch; + + /** + * Encodes the specified SyncdPatch message. Does not implicitly {@link proto.SyncdPatch.verify|verify} messages. + * @param message SyncdPatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdPatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdPatch message, length delimited. Does not implicitly {@link proto.SyncdPatch.verify|verify} messages. + * @param message SyncdPatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdPatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdPatch message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdPatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdPatch; + + /** + * Decodes a SyncdPatch message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdPatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdPatch; + + /** + * Verifies a SyncdPatch message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdPatch message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdPatch + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdPatch; + + /** + * Creates a plain object from a SyncdPatch message. Also converts values to other types if specified. + * @param message SyncdPatch + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdPatch, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdPatch to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncdRecord. */ + interface ISyncdRecord { + + /** SyncdRecord index */ + index?: (proto.ISyncdIndex|null); + + /** SyncdRecord value */ + value?: (proto.ISyncdValue|null); + + /** SyncdRecord keyId */ + keyId?: (proto.IKeyId|null); + } + + /** Represents a SyncdRecord. */ + class SyncdRecord implements ISyncdRecord { + + /** + * Constructs a new SyncdRecord. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdRecord); + + /** SyncdRecord index. */ + public index?: (proto.ISyncdIndex|null); + + /** SyncdRecord value. */ + public value?: (proto.ISyncdValue|null); + + /** SyncdRecord keyId. */ + public keyId?: (proto.IKeyId|null); + + /** + * Creates a new SyncdRecord instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdRecord instance + */ + public static create(properties?: proto.ISyncdRecord): proto.SyncdRecord; + + /** + * Encodes the specified SyncdRecord message. Does not implicitly {@link proto.SyncdRecord.verify|verify} messages. + * @param message SyncdRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdRecord message, length delimited. Does not implicitly {@link proto.SyncdRecord.verify|verify} messages. + * @param message SyncdRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdRecord message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdRecord; + + /** + * Decodes a SyncdRecord message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdRecord; + + /** + * Verifies a SyncdRecord message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdRecord message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdRecord + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdRecord; + + /** + * Creates a plain object from a SyncdRecord message. Also converts values to other types if specified. + * @param message SyncdRecord + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdRecord to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncdSnapshot. */ + interface ISyncdSnapshot { + + /** SyncdSnapshot version */ + version?: (proto.ISyncdVersion|null); + + /** SyncdSnapshot records */ + records?: (proto.ISyncdRecord[]|null); + + /** SyncdSnapshot mac */ + mac?: (Uint8Array|null); + + /** SyncdSnapshot keyId */ + keyId?: (proto.IKeyId|null); + } + + /** Represents a SyncdSnapshot. */ + class SyncdSnapshot implements ISyncdSnapshot { + + /** + * Constructs a new SyncdSnapshot. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdSnapshot); + + /** SyncdSnapshot version. */ + public version?: (proto.ISyncdVersion|null); + + /** SyncdSnapshot records. */ + public records: proto.ISyncdRecord[]; + + /** SyncdSnapshot mac. */ + public mac: Uint8Array; + + /** SyncdSnapshot keyId. */ + public keyId?: (proto.IKeyId|null); + + /** + * Creates a new SyncdSnapshot instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdSnapshot instance + */ + public static create(properties?: proto.ISyncdSnapshot): proto.SyncdSnapshot; + + /** + * Encodes the specified SyncdSnapshot message. Does not implicitly {@link proto.SyncdSnapshot.verify|verify} messages. + * @param message SyncdSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdSnapshot message, length delimited. Does not implicitly {@link proto.SyncdSnapshot.verify|verify} messages. + * @param message SyncdSnapshot message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdSnapshot, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdSnapshot message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdSnapshot; + + /** + * Decodes a SyncdSnapshot message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdSnapshot; + + /** + * Verifies a SyncdSnapshot message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdSnapshot message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdSnapshot + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdSnapshot; + + /** + * Creates a plain object from a SyncdSnapshot message. Also converts values to other types if specified. + * @param message SyncdSnapshot + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdSnapshot, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdSnapshot to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncdValue. */ + interface ISyncdValue { + + /** SyncdValue blob */ + blob?: (Uint8Array|null); + } + + /** Represents a SyncdValue. */ + class SyncdValue implements ISyncdValue { + + /** + * Constructs a new SyncdValue. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdValue); + + /** SyncdValue blob. */ + public blob: Uint8Array; + + /** + * Creates a new SyncdValue instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdValue instance + */ + public static create(properties?: proto.ISyncdValue): proto.SyncdValue; + + /** + * Encodes the specified SyncdValue message. Does not implicitly {@link proto.SyncdValue.verify|verify} messages. + * @param message SyncdValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdValue message, length delimited. Does not implicitly {@link proto.SyncdValue.verify|verify} messages. + * @param message SyncdValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdValue; + + /** + * Decodes a SyncdValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdValue; + + /** + * Verifies a SyncdValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdValue + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdValue; + + /** + * Creates a plain object from a SyncdValue message. Also converts values to other types if specified. + * @param message SyncdValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SyncdVersion. */ + interface ISyncdVersion { + + /** SyncdVersion version */ + version?: (number|Long|null); + } + + /** Represents a SyncdVersion. */ + class SyncdVersion implements ISyncdVersion { + + /** + * Constructs a new SyncdVersion. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ISyncdVersion); + + /** SyncdVersion version. */ + public version: (number|Long); + + /** + * Creates a new SyncdVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncdVersion instance + */ + public static create(properties?: proto.ISyncdVersion): proto.SyncdVersion; + + /** + * Encodes the specified SyncdVersion message. Does not implicitly {@link proto.SyncdVersion.verify|verify} messages. + * @param message SyncdVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ISyncdVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncdVersion message, length delimited. Does not implicitly {@link proto.SyncdVersion.verify|verify} messages. + * @param message SyncdVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ISyncdVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncdVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncdVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.SyncdVersion; + + /** + * Decodes a SyncdVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncdVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.SyncdVersion; + + /** + * Verifies a SyncdVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncdVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncdVersion + */ + public static fromObject(object: { [k: string]: any }): proto.SyncdVersion; + + /** + * Creates a plain object from a SyncdVersion message. Also converts values to other types if specified. + * @param message SyncdVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.SyncdVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncdVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TemplateButton. */ + interface ITemplateButton { + + /** TemplateButton index */ + index?: (number|null); + + /** TemplateButton quickReplyButton */ + quickReplyButton?: (proto.TemplateButton.IQuickReplyButton|null); + + /** TemplateButton urlButton */ + urlButton?: (proto.TemplateButton.IURLButton|null); + + /** TemplateButton callButton */ + callButton?: (proto.TemplateButton.ICallButton|null); + } + + /** Represents a TemplateButton. */ + class TemplateButton implements ITemplateButton { + + /** + * Constructs a new TemplateButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.ITemplateButton); + + /** TemplateButton index. */ + public index: number; + + /** TemplateButton quickReplyButton. */ + public quickReplyButton?: (proto.TemplateButton.IQuickReplyButton|null); + + /** TemplateButton urlButton. */ + public urlButton?: (proto.TemplateButton.IURLButton|null); + + /** TemplateButton callButton. */ + public callButton?: (proto.TemplateButton.ICallButton|null); + + /** TemplateButton button. */ + public button?: ("quickReplyButton"|"urlButton"|"callButton"); + + /** + * Creates a new TemplateButton instance using the specified properties. + * @param [properties] Properties to set + * @returns TemplateButton instance + */ + public static create(properties?: proto.ITemplateButton): proto.TemplateButton; + + /** + * Encodes the specified TemplateButton message. Does not implicitly {@link proto.TemplateButton.verify|verify} messages. + * @param message TemplateButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.ITemplateButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TemplateButton message, length delimited. Does not implicitly {@link proto.TemplateButton.verify|verify} messages. + * @param message TemplateButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.ITemplateButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TemplateButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.TemplateButton; + + /** + * Decodes a TemplateButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.TemplateButton; + + /** + * Verifies a TemplateButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TemplateButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TemplateButton + */ + public static fromObject(object: { [k: string]: any }): proto.TemplateButton; + + /** + * Creates a plain object from a TemplateButton message. Also converts values to other types if specified. + * @param message TemplateButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.TemplateButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TemplateButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace TemplateButton { + + /** Properties of a CallButton. */ + interface ICallButton { + + /** CallButton displayText */ + displayText?: (proto.Message.IHighlyStructuredMessage|null); + + /** CallButton phoneNumber */ + phoneNumber?: (proto.Message.IHighlyStructuredMessage|null); + } + + /** Represents a CallButton. */ + class CallButton implements ICallButton { + + /** + * Constructs a new CallButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.TemplateButton.ICallButton); + + /** CallButton displayText. */ + public displayText?: (proto.Message.IHighlyStructuredMessage|null); + + /** CallButton phoneNumber. */ + public phoneNumber?: (proto.Message.IHighlyStructuredMessage|null); + + /** + * Creates a new CallButton instance using the specified properties. + * @param [properties] Properties to set + * @returns CallButton instance + */ + public static create(properties?: proto.TemplateButton.ICallButton): proto.TemplateButton.CallButton; + + /** + * Encodes the specified CallButton message. Does not implicitly {@link proto.TemplateButton.CallButton.verify|verify} messages. + * @param message CallButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.TemplateButton.ICallButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CallButton message, length delimited. Does not implicitly {@link proto.TemplateButton.CallButton.verify|verify} messages. + * @param message CallButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.TemplateButton.ICallButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CallButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.TemplateButton.CallButton; + + /** + * Decodes a CallButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.TemplateButton.CallButton; + + /** + * Verifies a CallButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CallButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CallButton + */ + public static fromObject(object: { [k: string]: any }): proto.TemplateButton.CallButton; + + /** + * Creates a plain object from a CallButton message. Also converts values to other types if specified. + * @param message CallButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.TemplateButton.CallButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CallButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a QuickReplyButton. */ + interface IQuickReplyButton { + + /** QuickReplyButton displayText */ + displayText?: (proto.Message.IHighlyStructuredMessage|null); + + /** QuickReplyButton id */ + id?: (string|null); + } + + /** Represents a QuickReplyButton. */ + class QuickReplyButton implements IQuickReplyButton { + + /** + * Constructs a new QuickReplyButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.TemplateButton.IQuickReplyButton); + + /** QuickReplyButton displayText. */ + public displayText?: (proto.Message.IHighlyStructuredMessage|null); + + /** QuickReplyButton id. */ + public id: string; + + /** + * Creates a new QuickReplyButton instance using the specified properties. + * @param [properties] Properties to set + * @returns QuickReplyButton instance + */ + public static create(properties?: proto.TemplateButton.IQuickReplyButton): proto.TemplateButton.QuickReplyButton; + + /** + * Encodes the specified QuickReplyButton message. Does not implicitly {@link proto.TemplateButton.QuickReplyButton.verify|verify} messages. + * @param message QuickReplyButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.TemplateButton.IQuickReplyButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuickReplyButton message, length delimited. Does not implicitly {@link proto.TemplateButton.QuickReplyButton.verify|verify} messages. + * @param message QuickReplyButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.TemplateButton.IQuickReplyButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuickReplyButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.TemplateButton.QuickReplyButton; + + /** + * Decodes a QuickReplyButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.TemplateButton.QuickReplyButton; + + /** + * Verifies a QuickReplyButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QuickReplyButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuickReplyButton + */ + public static fromObject(object: { [k: string]: any }): proto.TemplateButton.QuickReplyButton; + + /** + * Creates a plain object from a QuickReplyButton message. Also converts values to other types if specified. + * @param message QuickReplyButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.TemplateButton.QuickReplyButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuickReplyButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a URLButton. */ + interface IURLButton { + + /** URLButton displayText */ + displayText?: (proto.Message.IHighlyStructuredMessage|null); + + /** URLButton url */ + url?: (proto.Message.IHighlyStructuredMessage|null); + } + + /** Represents a URLButton. */ + class URLButton implements IURLButton { + + /** + * Constructs a new URLButton. + * @param [properties] Properties to set + */ + constructor(properties?: proto.TemplateButton.IURLButton); + + /** URLButton displayText. */ + public displayText?: (proto.Message.IHighlyStructuredMessage|null); + + /** URLButton url. */ + public url?: (proto.Message.IHighlyStructuredMessage|null); + + /** + * Creates a new URLButton instance using the specified properties. + * @param [properties] Properties to set + * @returns URLButton instance + */ + public static create(properties?: proto.TemplateButton.IURLButton): proto.TemplateButton.URLButton; + + /** + * Encodes the specified URLButton message. Does not implicitly {@link proto.TemplateButton.URLButton.verify|verify} messages. + * @param message URLButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.TemplateButton.IURLButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified URLButton message, length delimited. Does not implicitly {@link proto.TemplateButton.URLButton.verify|verify} messages. + * @param message URLButton message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.TemplateButton.IURLButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a URLButton message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns URLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.TemplateButton.URLButton; + + /** + * Decodes a URLButton message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns URLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.TemplateButton.URLButton; + + /** + * Verifies a URLButton message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a URLButton message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns URLButton + */ + public static fromObject(object: { [k: string]: any }): proto.TemplateButton.URLButton; + + /** + * Creates a plain object from a URLButton message. Also converts values to other types if specified. + * @param message URLButton + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.TemplateButton.URLButton, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this URLButton to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a UserReceipt. */ + interface IUserReceipt { + + /** UserReceipt userJid */ + userJid: string; + + /** UserReceipt receiptTimestamp */ + receiptTimestamp?: (number|Long|null); + + /** UserReceipt readTimestamp */ + readTimestamp?: (number|Long|null); + + /** UserReceipt playedTimestamp */ + playedTimestamp?: (number|Long|null); + + /** UserReceipt pendingDeviceJid */ + pendingDeviceJid?: (string[]|null); + + /** UserReceipt deliveredDeviceJid */ + deliveredDeviceJid?: (string[]|null); + } + + /** Represents a UserReceipt. */ + class UserReceipt implements IUserReceipt { + + /** + * Constructs a new UserReceipt. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IUserReceipt); + + /** UserReceipt userJid. */ + public userJid: string; + + /** UserReceipt receiptTimestamp. */ + public receiptTimestamp: (number|Long); + + /** UserReceipt readTimestamp. */ + public readTimestamp: (number|Long); + + /** UserReceipt playedTimestamp. */ + public playedTimestamp: (number|Long); + + /** UserReceipt pendingDeviceJid. */ + public pendingDeviceJid: string[]; + + /** UserReceipt deliveredDeviceJid. */ + public deliveredDeviceJid: string[]; + + /** + * Creates a new UserReceipt instance using the specified properties. + * @param [properties] Properties to set + * @returns UserReceipt instance + */ + public static create(properties?: proto.IUserReceipt): proto.UserReceipt; + + /** + * Encodes the specified UserReceipt message. Does not implicitly {@link proto.UserReceipt.verify|verify} messages. + * @param message UserReceipt message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IUserReceipt, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserReceipt message, length delimited. Does not implicitly {@link proto.UserReceipt.verify|verify} messages. + * @param message UserReceipt message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IUserReceipt, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserReceipt message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.UserReceipt; + + /** + * Decodes a UserReceipt message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.UserReceipt; + + /** + * Verifies a UserReceipt message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserReceipt message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserReceipt + */ + public static fromObject(object: { [k: string]: any }): proto.UserReceipt; + + /** + * Creates a plain object from a UserReceipt message. Also converts values to other types if specified. + * @param message UserReceipt + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.UserReceipt, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserReceipt to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a VerifiedNameCertificate. */ + interface IVerifiedNameCertificate { + + /** VerifiedNameCertificate details */ + details?: (Uint8Array|null); + + /** VerifiedNameCertificate signature */ + signature?: (Uint8Array|null); + + /** VerifiedNameCertificate serverSignature */ + serverSignature?: (Uint8Array|null); + } + + /** Represents a VerifiedNameCertificate. */ + class VerifiedNameCertificate implements IVerifiedNameCertificate { + + /** + * Constructs a new VerifiedNameCertificate. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IVerifiedNameCertificate); + + /** VerifiedNameCertificate details. */ + public details: Uint8Array; + + /** VerifiedNameCertificate signature. */ + public signature: Uint8Array; + + /** VerifiedNameCertificate serverSignature. */ + public serverSignature: Uint8Array; + + /** + * Creates a new VerifiedNameCertificate instance using the specified properties. + * @param [properties] Properties to set + * @returns VerifiedNameCertificate instance + */ + public static create(properties?: proto.IVerifiedNameCertificate): proto.VerifiedNameCertificate; + + /** + * Encodes the specified VerifiedNameCertificate message. Does not implicitly {@link proto.VerifiedNameCertificate.verify|verify} messages. + * @param message VerifiedNameCertificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IVerifiedNameCertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VerifiedNameCertificate message, length delimited. Does not implicitly {@link proto.VerifiedNameCertificate.verify|verify} messages. + * @param message VerifiedNameCertificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IVerifiedNameCertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VerifiedNameCertificate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VerifiedNameCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.VerifiedNameCertificate; + + /** + * Decodes a VerifiedNameCertificate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VerifiedNameCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.VerifiedNameCertificate; + + /** + * Verifies a VerifiedNameCertificate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VerifiedNameCertificate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VerifiedNameCertificate + */ + public static fromObject(object: { [k: string]: any }): proto.VerifiedNameCertificate; + + /** + * Creates a plain object from a VerifiedNameCertificate message. Also converts values to other types if specified. + * @param message VerifiedNameCertificate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.VerifiedNameCertificate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VerifiedNameCertificate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace VerifiedNameCertificate { + + /** Properties of a Details. */ + interface IDetails { + + /** Details serial */ + serial?: (number|Long|null); + + /** Details issuer */ + issuer?: (string|null); + + /** Details verifiedName */ + verifiedName?: (string|null); + + /** Details localizedNames */ + localizedNames?: (proto.ILocalizedName[]|null); + + /** Details issueTime */ + issueTime?: (number|Long|null); + } + + /** Represents a Details. */ + class Details implements IDetails { + + /** + * Constructs a new Details. + * @param [properties] Properties to set + */ + constructor(properties?: proto.VerifiedNameCertificate.IDetails); + + /** Details serial. */ + public serial: (number|Long); + + /** Details issuer. */ + public issuer: string; + + /** Details verifiedName. */ + public verifiedName: string; + + /** Details localizedNames. */ + public localizedNames: proto.ILocalizedName[]; + + /** Details issueTime. */ + public issueTime: (number|Long); + + /** + * Creates a new Details instance using the specified properties. + * @param [properties] Properties to set + * @returns Details instance + */ + public static create(properties?: proto.VerifiedNameCertificate.IDetails): proto.VerifiedNameCertificate.Details; + + /** + * Encodes the specified Details message. Does not implicitly {@link proto.VerifiedNameCertificate.Details.verify|verify} messages. + * @param message Details message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.VerifiedNameCertificate.IDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Details message, length delimited. Does not implicitly {@link proto.VerifiedNameCertificate.Details.verify|verify} messages. + * @param message Details message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.VerifiedNameCertificate.IDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Details message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.VerifiedNameCertificate.Details; + + /** + * Decodes a Details message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.VerifiedNameCertificate.Details; + + /** + * Verifies a Details message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Details message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Details + */ + public static fromObject(object: { [k: string]: any }): proto.VerifiedNameCertificate.Details; + + /** + * Creates a plain object from a Details message. Also converts values to other types if specified. + * @param message Details + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.VerifiedNameCertificate.Details, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Details to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a WallpaperSettings. */ + interface IWallpaperSettings { + + /** WallpaperSettings filename */ + filename?: (string|null); + + /** WallpaperSettings opacity */ + opacity?: (number|null); + } + + /** Represents a WallpaperSettings. */ + class WallpaperSettings implements IWallpaperSettings { + + /** + * Constructs a new WallpaperSettings. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IWallpaperSettings); + + /** WallpaperSettings filename. */ + public filename: string; + + /** WallpaperSettings opacity. */ + public opacity: number; + + /** + * Creates a new WallpaperSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns WallpaperSettings instance + */ + public static create(properties?: proto.IWallpaperSettings): proto.WallpaperSettings; + + /** + * Encodes the specified WallpaperSettings message. Does not implicitly {@link proto.WallpaperSettings.verify|verify} messages. + * @param message WallpaperSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IWallpaperSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WallpaperSettings message, length delimited. Does not implicitly {@link proto.WallpaperSettings.verify|verify} messages. + * @param message WallpaperSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IWallpaperSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WallpaperSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WallpaperSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.WallpaperSettings; + + /** + * Decodes a WallpaperSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WallpaperSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.WallpaperSettings; + + /** + * Verifies a WallpaperSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WallpaperSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WallpaperSettings + */ + public static fromObject(object: { [k: string]: any }): proto.WallpaperSettings; + + /** + * Creates a plain object from a WallpaperSettings message. Also converts values to other types if specified. + * @param message WallpaperSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.WallpaperSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WallpaperSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a WebFeatures. */ + interface IWebFeatures { + + /** WebFeatures labelsDisplay */ + labelsDisplay?: (proto.WebFeatures.Flag|null); + + /** WebFeatures voipIndividualOutgoing */ + voipIndividualOutgoing?: (proto.WebFeatures.Flag|null); + + /** WebFeatures groupsV3 */ + groupsV3?: (proto.WebFeatures.Flag|null); + + /** WebFeatures groupsV3Create */ + groupsV3Create?: (proto.WebFeatures.Flag|null); + + /** WebFeatures changeNumberV2 */ + changeNumberV2?: (proto.WebFeatures.Flag|null); + + /** WebFeatures queryStatusV3Thumbnail */ + queryStatusV3Thumbnail?: (proto.WebFeatures.Flag|null); + + /** WebFeatures liveLocations */ + liveLocations?: (proto.WebFeatures.Flag|null); + + /** WebFeatures queryVname */ + queryVname?: (proto.WebFeatures.Flag|null); + + /** WebFeatures voipIndividualIncoming */ + voipIndividualIncoming?: (proto.WebFeatures.Flag|null); + + /** WebFeatures quickRepliesQuery */ + quickRepliesQuery?: (proto.WebFeatures.Flag|null); + + /** WebFeatures payments */ + payments?: (proto.WebFeatures.Flag|null); + + /** WebFeatures stickerPackQuery */ + stickerPackQuery?: (proto.WebFeatures.Flag|null); + + /** WebFeatures liveLocationsFinal */ + liveLocationsFinal?: (proto.WebFeatures.Flag|null); + + /** WebFeatures labelsEdit */ + labelsEdit?: (proto.WebFeatures.Flag|null); + + /** WebFeatures mediaUpload */ + mediaUpload?: (proto.WebFeatures.Flag|null); + + /** WebFeatures mediaUploadRichQuickReplies */ + mediaUploadRichQuickReplies?: (proto.WebFeatures.Flag|null); + + /** WebFeatures vnameV2 */ + vnameV2?: (proto.WebFeatures.Flag|null); + + /** WebFeatures videoPlaybackUrl */ + videoPlaybackUrl?: (proto.WebFeatures.Flag|null); + + /** WebFeatures statusRanking */ + statusRanking?: (proto.WebFeatures.Flag|null); + + /** WebFeatures voipIndividualVideo */ + voipIndividualVideo?: (proto.WebFeatures.Flag|null); + + /** WebFeatures thirdPartyStickers */ + thirdPartyStickers?: (proto.WebFeatures.Flag|null); + + /** WebFeatures frequentlyForwardedSetting */ + frequentlyForwardedSetting?: (proto.WebFeatures.Flag|null); + + /** WebFeatures groupsV4JoinPermission */ + groupsV4JoinPermission?: (proto.WebFeatures.Flag|null); + + /** WebFeatures recentStickers */ + recentStickers?: (proto.WebFeatures.Flag|null); + + /** WebFeatures catalog */ + catalog?: (proto.WebFeatures.Flag|null); + + /** WebFeatures starredStickers */ + starredStickers?: (proto.WebFeatures.Flag|null); + + /** WebFeatures voipGroupCall */ + voipGroupCall?: (proto.WebFeatures.Flag|null); + + /** WebFeatures templateMessage */ + templateMessage?: (proto.WebFeatures.Flag|null); + + /** WebFeatures templateMessageInteractivity */ + templateMessageInteractivity?: (proto.WebFeatures.Flag|null); + + /** WebFeatures ephemeralMessages */ + ephemeralMessages?: (proto.WebFeatures.Flag|null); + + /** WebFeatures e2ENotificationSync */ + e2ENotificationSync?: (proto.WebFeatures.Flag|null); + + /** WebFeatures recentStickersV2 */ + recentStickersV2?: (proto.WebFeatures.Flag|null); + + /** WebFeatures recentStickersV3 */ + recentStickersV3?: (proto.WebFeatures.Flag|null); + + /** WebFeatures userNotice */ + userNotice?: (proto.WebFeatures.Flag|null); + + /** WebFeatures support */ + support?: (proto.WebFeatures.Flag|null); + + /** WebFeatures groupUiiCleanup */ + groupUiiCleanup?: (proto.WebFeatures.Flag|null); + + /** WebFeatures groupDogfoodingInternalOnly */ + groupDogfoodingInternalOnly?: (proto.WebFeatures.Flag|null); + + /** WebFeatures settingsSync */ + settingsSync?: (proto.WebFeatures.Flag|null); + + /** WebFeatures archiveV2 */ + archiveV2?: (proto.WebFeatures.Flag|null); + + /** WebFeatures ephemeralAllowGroupMembers */ + ephemeralAllowGroupMembers?: (proto.WebFeatures.Flag|null); + + /** WebFeatures ephemeral24HDuration */ + ephemeral24HDuration?: (proto.WebFeatures.Flag|null); + + /** WebFeatures mdForceUpgrade */ + mdForceUpgrade?: (proto.WebFeatures.Flag|null); + + /** WebFeatures disappearingMode */ + disappearingMode?: (proto.WebFeatures.Flag|null); + + /** WebFeatures externalMdOptInAvailable */ + externalMdOptInAvailable?: (proto.WebFeatures.Flag|null); + + /** WebFeatures noDeleteMessageTimeLimit */ + noDeleteMessageTimeLimit?: (proto.WebFeatures.Flag|null); + } + + /** Represents a WebFeatures. */ + class WebFeatures implements IWebFeatures { + + /** + * Constructs a new WebFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IWebFeatures); + + /** WebFeatures labelsDisplay. */ + public labelsDisplay: proto.WebFeatures.Flag; + + /** WebFeatures voipIndividualOutgoing. */ + public voipIndividualOutgoing: proto.WebFeatures.Flag; + + /** WebFeatures groupsV3. */ + public groupsV3: proto.WebFeatures.Flag; + + /** WebFeatures groupsV3Create. */ + public groupsV3Create: proto.WebFeatures.Flag; + + /** WebFeatures changeNumberV2. */ + public changeNumberV2: proto.WebFeatures.Flag; + + /** WebFeatures queryStatusV3Thumbnail. */ + public queryStatusV3Thumbnail: proto.WebFeatures.Flag; + + /** WebFeatures liveLocations. */ + public liveLocations: proto.WebFeatures.Flag; + + /** WebFeatures queryVname. */ + public queryVname: proto.WebFeatures.Flag; + + /** WebFeatures voipIndividualIncoming. */ + public voipIndividualIncoming: proto.WebFeatures.Flag; + + /** WebFeatures quickRepliesQuery. */ + public quickRepliesQuery: proto.WebFeatures.Flag; + + /** WebFeatures payments. */ + public payments: proto.WebFeatures.Flag; + + /** WebFeatures stickerPackQuery. */ + public stickerPackQuery: proto.WebFeatures.Flag; + + /** WebFeatures liveLocationsFinal. */ + public liveLocationsFinal: proto.WebFeatures.Flag; + + /** WebFeatures labelsEdit. */ + public labelsEdit: proto.WebFeatures.Flag; + + /** WebFeatures mediaUpload. */ + public mediaUpload: proto.WebFeatures.Flag; + + /** WebFeatures mediaUploadRichQuickReplies. */ + public mediaUploadRichQuickReplies: proto.WebFeatures.Flag; + + /** WebFeatures vnameV2. */ + public vnameV2: proto.WebFeatures.Flag; + + /** WebFeatures videoPlaybackUrl. */ + public videoPlaybackUrl: proto.WebFeatures.Flag; + + /** WebFeatures statusRanking. */ + public statusRanking: proto.WebFeatures.Flag; + + /** WebFeatures voipIndividualVideo. */ + public voipIndividualVideo: proto.WebFeatures.Flag; + + /** WebFeatures thirdPartyStickers. */ + public thirdPartyStickers: proto.WebFeatures.Flag; + + /** WebFeatures frequentlyForwardedSetting. */ + public frequentlyForwardedSetting: proto.WebFeatures.Flag; + + /** WebFeatures groupsV4JoinPermission. */ + public groupsV4JoinPermission: proto.WebFeatures.Flag; + + /** WebFeatures recentStickers. */ + public recentStickers: proto.WebFeatures.Flag; + + /** WebFeatures catalog. */ + public catalog: proto.WebFeatures.Flag; + + /** WebFeatures starredStickers. */ + public starredStickers: proto.WebFeatures.Flag; + + /** WebFeatures voipGroupCall. */ + public voipGroupCall: proto.WebFeatures.Flag; + + /** WebFeatures templateMessage. */ + public templateMessage: proto.WebFeatures.Flag; + + /** WebFeatures templateMessageInteractivity. */ + public templateMessageInteractivity: proto.WebFeatures.Flag; + + /** WebFeatures ephemeralMessages. */ + public ephemeralMessages: proto.WebFeatures.Flag; + + /** WebFeatures e2ENotificationSync. */ + public e2ENotificationSync: proto.WebFeatures.Flag; + + /** WebFeatures recentStickersV2. */ + public recentStickersV2: proto.WebFeatures.Flag; + + /** WebFeatures recentStickersV3. */ + public recentStickersV3: proto.WebFeatures.Flag; + + /** WebFeatures userNotice. */ + public userNotice: proto.WebFeatures.Flag; + + /** WebFeatures support. */ + public support: proto.WebFeatures.Flag; + + /** WebFeatures groupUiiCleanup. */ + public groupUiiCleanup: proto.WebFeatures.Flag; + + /** WebFeatures groupDogfoodingInternalOnly. */ + public groupDogfoodingInternalOnly: proto.WebFeatures.Flag; + + /** WebFeatures settingsSync. */ + public settingsSync: proto.WebFeatures.Flag; + + /** WebFeatures archiveV2. */ + public archiveV2: proto.WebFeatures.Flag; + + /** WebFeatures ephemeralAllowGroupMembers. */ + public ephemeralAllowGroupMembers: proto.WebFeatures.Flag; + + /** WebFeatures ephemeral24HDuration. */ + public ephemeral24HDuration: proto.WebFeatures.Flag; + + /** WebFeatures mdForceUpgrade. */ + public mdForceUpgrade: proto.WebFeatures.Flag; + + /** WebFeatures disappearingMode. */ + public disappearingMode: proto.WebFeatures.Flag; + + /** WebFeatures externalMdOptInAvailable. */ + public externalMdOptInAvailable: proto.WebFeatures.Flag; + + /** WebFeatures noDeleteMessageTimeLimit. */ + public noDeleteMessageTimeLimit: proto.WebFeatures.Flag; + + /** + * Creates a new WebFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns WebFeatures instance + */ + public static create(properties?: proto.IWebFeatures): proto.WebFeatures; + + /** + * Encodes the specified WebFeatures message. Does not implicitly {@link proto.WebFeatures.verify|verify} messages. + * @param message WebFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IWebFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebFeatures message, length delimited. Does not implicitly {@link proto.WebFeatures.verify|verify} messages. + * @param message WebFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IWebFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.WebFeatures; + + /** + * Decodes a WebFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.WebFeatures; + + /** + * Verifies a WebFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebFeatures + */ + public static fromObject(object: { [k: string]: any }): proto.WebFeatures; + + /** + * Creates a plain object from a WebFeatures message. Also converts values to other types if specified. + * @param message WebFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.WebFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WebFeatures { + + /** Flag enum. */ + enum Flag { + NOT_STARTED = 0, + FORCE_UPGRADE = 1, + DEVELOPMENT = 2, + PRODUCTION = 3 + } + } + + /** Properties of a WebMessageInfo. */ + interface IWebMessageInfo { + + /** WebMessageInfo key */ + key: proto.IMessageKey; + + /** WebMessageInfo message */ + message?: (proto.IMessage|null); + + /** WebMessageInfo messageTimestamp */ + messageTimestamp?: (number|Long|null); + + /** WebMessageInfo status */ + status?: (proto.WebMessageInfo.Status|null); + + /** WebMessageInfo participant */ + participant?: (string|null); + + /** WebMessageInfo messageC2STimestamp */ + messageC2STimestamp?: (number|Long|null); + + /** WebMessageInfo ignore */ + ignore?: (boolean|null); + + /** WebMessageInfo starred */ + starred?: (boolean|null); + + /** WebMessageInfo broadcast */ + broadcast?: (boolean|null); + + /** WebMessageInfo pushName */ + pushName?: (string|null); + + /** WebMessageInfo mediaCiphertextSha256 */ + mediaCiphertextSha256?: (Uint8Array|null); + + /** WebMessageInfo multicast */ + multicast?: (boolean|null); + + /** WebMessageInfo urlText */ + urlText?: (boolean|null); + + /** WebMessageInfo urlNumber */ + urlNumber?: (boolean|null); + + /** WebMessageInfo messageStubType */ + messageStubType?: (proto.WebMessageInfo.StubType|null); + + /** WebMessageInfo clearMedia */ + clearMedia?: (boolean|null); + + /** WebMessageInfo messageStubParameters */ + messageStubParameters?: (string[]|null); + + /** WebMessageInfo duration */ + duration?: (number|null); + + /** WebMessageInfo labels */ + labels?: (string[]|null); + + /** WebMessageInfo paymentInfo */ + paymentInfo?: (proto.IPaymentInfo|null); + + /** WebMessageInfo finalLiveLocation */ + finalLiveLocation?: (proto.Message.ILiveLocationMessage|null); + + /** WebMessageInfo quotedPaymentInfo */ + quotedPaymentInfo?: (proto.IPaymentInfo|null); + + /** WebMessageInfo ephemeralStartTimestamp */ + ephemeralStartTimestamp?: (number|Long|null); + + /** WebMessageInfo ephemeralDuration */ + ephemeralDuration?: (number|null); + + /** WebMessageInfo ephemeralOffToOn */ + ephemeralOffToOn?: (boolean|null); + + /** WebMessageInfo ephemeralOutOfSync */ + ephemeralOutOfSync?: (boolean|null); + + /** WebMessageInfo bizPrivacyStatus */ + bizPrivacyStatus?: (proto.WebMessageInfo.BizPrivacyStatus|null); + + /** WebMessageInfo verifiedBizName */ + verifiedBizName?: (string|null); + + /** WebMessageInfo mediaData */ + mediaData?: (proto.IMediaData|null); + + /** WebMessageInfo photoChange */ + photoChange?: (proto.IPhotoChange|null); + + /** WebMessageInfo userReceipt */ + userReceipt?: (proto.IUserReceipt[]|null); + + /** WebMessageInfo reactions */ + reactions?: (proto.IReaction[]|null); + + /** WebMessageInfo quotedStickerData */ + quotedStickerData?: (proto.IMediaData|null); + + /** WebMessageInfo futureproofData */ + futureproofData?: (Uint8Array|null); + + /** WebMessageInfo statusPsa */ + statusPsa?: (proto.IStatusPSA|null); + + /** WebMessageInfo pollUpdates */ + pollUpdates?: (proto.IPollUpdate[]|null); + + /** WebMessageInfo pollAdditionalMetadata */ + pollAdditionalMetadata?: (proto.IPollAdditionalMetadata|null); + + /** WebMessageInfo agentId */ + agentId?: (string|null); + + /** WebMessageInfo statusAlreadyViewed */ + statusAlreadyViewed?: (boolean|null); + + /** WebMessageInfo messageSecret */ + messageSecret?: (Uint8Array|null); + + /** WebMessageInfo keepInChat */ + keepInChat?: (proto.IKeepInChat|null); + + /** WebMessageInfo originalSelfAuthorUserJidString */ + originalSelfAuthorUserJidString?: (string|null); + + /** WebMessageInfo revokeMessageTimestamp */ + revokeMessageTimestamp?: (number|Long|null); + } + + /** Represents a WebMessageInfo. */ + class WebMessageInfo implements IWebMessageInfo { + + /** + * Constructs a new WebMessageInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IWebMessageInfo); + + /** WebMessageInfo key. */ + public key: proto.IMessageKey; + + /** WebMessageInfo message. */ + public message?: (proto.IMessage|null); + + /** WebMessageInfo messageTimestamp. */ + public messageTimestamp: (number|Long); + + /** WebMessageInfo status. */ + public status: proto.WebMessageInfo.Status; + + /** WebMessageInfo participant. */ + public participant: string; + + /** WebMessageInfo messageC2STimestamp. */ + public messageC2STimestamp: (number|Long); + + /** WebMessageInfo ignore. */ + public ignore: boolean; + + /** WebMessageInfo starred. */ + public starred: boolean; + + /** WebMessageInfo broadcast. */ + public broadcast: boolean; + + /** WebMessageInfo pushName. */ + public pushName: string; + + /** WebMessageInfo mediaCiphertextSha256. */ + public mediaCiphertextSha256: Uint8Array; + + /** WebMessageInfo multicast. */ + public multicast: boolean; + + /** WebMessageInfo urlText. */ + public urlText: boolean; + + /** WebMessageInfo urlNumber. */ + public urlNumber: boolean; + + /** WebMessageInfo messageStubType. */ + public messageStubType: proto.WebMessageInfo.StubType; + + /** WebMessageInfo clearMedia. */ + public clearMedia: boolean; + + /** WebMessageInfo messageStubParameters. */ + public messageStubParameters: string[]; + + /** WebMessageInfo duration. */ + public duration: number; + + /** WebMessageInfo labels. */ + public labels: string[]; + + /** WebMessageInfo paymentInfo. */ + public paymentInfo?: (proto.IPaymentInfo|null); + + /** WebMessageInfo finalLiveLocation. */ + public finalLiveLocation?: (proto.Message.ILiveLocationMessage|null); + + /** WebMessageInfo quotedPaymentInfo. */ + public quotedPaymentInfo?: (proto.IPaymentInfo|null); + + /** WebMessageInfo ephemeralStartTimestamp. */ + public ephemeralStartTimestamp: (number|Long); + + /** WebMessageInfo ephemeralDuration. */ + public ephemeralDuration: number; + + /** WebMessageInfo ephemeralOffToOn. */ + public ephemeralOffToOn: boolean; + + /** WebMessageInfo ephemeralOutOfSync. */ + public ephemeralOutOfSync: boolean; + + /** WebMessageInfo bizPrivacyStatus. */ + public bizPrivacyStatus: proto.WebMessageInfo.BizPrivacyStatus; + + /** WebMessageInfo verifiedBizName. */ + public verifiedBizName: string; + + /** WebMessageInfo mediaData. */ + public mediaData?: (proto.IMediaData|null); + + /** WebMessageInfo photoChange. */ + public photoChange?: (proto.IPhotoChange|null); + + /** WebMessageInfo userReceipt. */ + public userReceipt: proto.IUserReceipt[]; + + /** WebMessageInfo reactions. */ + public reactions: proto.IReaction[]; + + /** WebMessageInfo quotedStickerData. */ + public quotedStickerData?: (proto.IMediaData|null); + + /** WebMessageInfo futureproofData. */ + public futureproofData: Uint8Array; + + /** WebMessageInfo statusPsa. */ + public statusPsa?: (proto.IStatusPSA|null); + + /** WebMessageInfo pollUpdates. */ + public pollUpdates: proto.IPollUpdate[]; + + /** WebMessageInfo pollAdditionalMetadata. */ + public pollAdditionalMetadata?: (proto.IPollAdditionalMetadata|null); + + /** WebMessageInfo agentId. */ + public agentId: string; + + /** WebMessageInfo statusAlreadyViewed. */ + public statusAlreadyViewed: boolean; + + /** WebMessageInfo messageSecret. */ + public messageSecret: Uint8Array; + + /** WebMessageInfo keepInChat. */ + public keepInChat?: (proto.IKeepInChat|null); + + /** WebMessageInfo originalSelfAuthorUserJidString. */ + public originalSelfAuthorUserJidString: string; + + /** WebMessageInfo revokeMessageTimestamp. */ + public revokeMessageTimestamp: (number|Long); + + /** + * Creates a new WebMessageInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns WebMessageInfo instance + */ + public static create(properties?: proto.IWebMessageInfo): proto.WebMessageInfo; + + /** + * Encodes the specified WebMessageInfo message. Does not implicitly {@link proto.WebMessageInfo.verify|verify} messages. + * @param message WebMessageInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IWebMessageInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebMessageInfo message, length delimited. Does not implicitly {@link proto.WebMessageInfo.verify|verify} messages. + * @param message WebMessageInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IWebMessageInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebMessageInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.WebMessageInfo; + + /** + * Decodes a WebMessageInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.WebMessageInfo; + + /** + * Verifies a WebMessageInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebMessageInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebMessageInfo + */ + public static fromObject(object: { [k: string]: any }): proto.WebMessageInfo; + + /** + * Creates a plain object from a WebMessageInfo message. Also converts values to other types if specified. + * @param message WebMessageInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.WebMessageInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebMessageInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace WebMessageInfo { + + /** BizPrivacyStatus enum. */ + enum BizPrivacyStatus { + E2EE = 0, + FB = 2, + BSP = 1, + BSP_AND_FB = 3 + } + + /** Status enum. */ + enum Status { + ERROR = 0, + PENDING = 1, + SERVER_ACK = 2, + DELIVERY_ACK = 3, + READ = 4, + PLAYED = 5 + } + + /** StubType enum. */ + enum StubType { + UNKNOWN = 0, + REVOKE = 1, + CIPHERTEXT = 2, + FUTUREPROOF = 3, + NON_VERIFIED_TRANSITION = 4, + UNVERIFIED_TRANSITION = 5, + VERIFIED_TRANSITION = 6, + VERIFIED_LOW_UNKNOWN = 7, + VERIFIED_HIGH = 8, + VERIFIED_INITIAL_UNKNOWN = 9, + VERIFIED_INITIAL_LOW = 10, + VERIFIED_INITIAL_HIGH = 11, + VERIFIED_TRANSITION_ANY_TO_NONE = 12, + VERIFIED_TRANSITION_ANY_TO_HIGH = 13, + VERIFIED_TRANSITION_HIGH_TO_LOW = 14, + VERIFIED_TRANSITION_HIGH_TO_UNKNOWN = 15, + VERIFIED_TRANSITION_UNKNOWN_TO_LOW = 16, + VERIFIED_TRANSITION_LOW_TO_UNKNOWN = 17, + VERIFIED_TRANSITION_NONE_TO_LOW = 18, + VERIFIED_TRANSITION_NONE_TO_UNKNOWN = 19, + GROUP_CREATE = 20, + GROUP_CHANGE_SUBJECT = 21, + GROUP_CHANGE_ICON = 22, + GROUP_CHANGE_INVITE_LINK = 23, + GROUP_CHANGE_DESCRIPTION = 24, + GROUP_CHANGE_RESTRICT = 25, + GROUP_CHANGE_ANNOUNCE = 26, + GROUP_PARTICIPANT_ADD = 27, + GROUP_PARTICIPANT_REMOVE = 28, + GROUP_PARTICIPANT_PROMOTE = 29, + GROUP_PARTICIPANT_DEMOTE = 30, + GROUP_PARTICIPANT_INVITE = 31, + GROUP_PARTICIPANT_LEAVE = 32, + GROUP_PARTICIPANT_CHANGE_NUMBER = 33, + BROADCAST_CREATE = 34, + BROADCAST_ADD = 35, + BROADCAST_REMOVE = 36, + GENERIC_NOTIFICATION = 37, + E2E_IDENTITY_CHANGED = 38, + E2E_ENCRYPTED = 39, + CALL_MISSED_VOICE = 40, + CALL_MISSED_VIDEO = 41, + INDIVIDUAL_CHANGE_NUMBER = 42, + GROUP_DELETE = 43, + GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE = 44, + CALL_MISSED_GROUP_VOICE = 45, + CALL_MISSED_GROUP_VIDEO = 46, + PAYMENT_CIPHERTEXT = 47, + PAYMENT_FUTUREPROOF = 48, + PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED = 49, + PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED = 50, + PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED = 51, + PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP = 52, + PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP = 53, + PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER = 54, + PAYMENT_ACTION_SEND_PAYMENT_REMINDER = 55, + PAYMENT_ACTION_SEND_PAYMENT_INVITATION = 56, + PAYMENT_ACTION_REQUEST_DECLINED = 57, + PAYMENT_ACTION_REQUEST_EXPIRED = 58, + PAYMENT_ACTION_REQUEST_CANCELLED = 59, + BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM = 60, + BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP = 61, + BIZ_INTRO_TOP = 62, + BIZ_INTRO_BOTTOM = 63, + BIZ_NAME_CHANGE = 64, + BIZ_MOVE_TO_CONSUMER_APP = 65, + BIZ_TWO_TIER_MIGRATION_TOP = 66, + BIZ_TWO_TIER_MIGRATION_BOTTOM = 67, + OVERSIZED = 68, + GROUP_CHANGE_NO_FREQUENTLY_FORWARDED = 69, + GROUP_V4_ADD_INVITE_SENT = 70, + GROUP_PARTICIPANT_ADD_REQUEST_JOIN = 71, + CHANGE_EPHEMERAL_SETTING = 72, + E2E_DEVICE_CHANGED = 73, + VIEWED_ONCE = 74, + E2E_ENCRYPTED_NOW = 75, + BLUE_MSG_BSP_FB_TO_BSP_PREMISE = 76, + BLUE_MSG_BSP_FB_TO_SELF_FB = 77, + BLUE_MSG_BSP_FB_TO_SELF_PREMISE = 78, + BLUE_MSG_BSP_FB_UNVERIFIED = 79, + BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 80, + BLUE_MSG_BSP_FB_VERIFIED = 81, + BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 82, + BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE = 83, + BLUE_MSG_BSP_PREMISE_UNVERIFIED = 84, + BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 85, + BLUE_MSG_BSP_PREMISE_VERIFIED = 86, + BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 87, + BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED = 88, + BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED = 89, + BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED = 90, + BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED = 91, + BLUE_MSG_SELF_FB_TO_BSP_PREMISE = 92, + BLUE_MSG_SELF_FB_TO_SELF_PREMISE = 93, + BLUE_MSG_SELF_FB_UNVERIFIED = 94, + BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 95, + BLUE_MSG_SELF_FB_VERIFIED = 96, + BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 97, + BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE = 98, + BLUE_MSG_SELF_PREMISE_UNVERIFIED = 99, + BLUE_MSG_SELF_PREMISE_VERIFIED = 100, + BLUE_MSG_TO_BSP_FB = 101, + BLUE_MSG_TO_CONSUMER = 102, + BLUE_MSG_TO_SELF_FB = 103, + BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED = 104, + BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 105, + BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED = 106, + BLUE_MSG_UNVERIFIED_TO_VERIFIED = 107, + BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED = 108, + BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 109, + BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED = 110, + BLUE_MSG_VERIFIED_TO_UNVERIFIED = 111, + BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 112, + BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED = 113, + BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 114, + BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED = 115, + BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 116, + BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 117, + E2E_IDENTITY_UNAVAILABLE = 118, + GROUP_CREATING = 119, + GROUP_CREATE_FAILED = 120, + GROUP_BOUNCED = 121, + BLOCK_CONTACT = 122, + EPHEMERAL_SETTING_NOT_APPLIED = 123, + SYNC_FAILED = 124, + SYNCING = 125, + BIZ_PRIVACY_MODE_INIT_FB = 126, + BIZ_PRIVACY_MODE_INIT_BSP = 127, + BIZ_PRIVACY_MODE_TO_FB = 128, + BIZ_PRIVACY_MODE_TO_BSP = 129, + DISAPPEARING_MODE = 130, + E2E_DEVICE_FETCH_FAILED = 131, + ADMIN_REVOKE = 132, + GROUP_INVITE_LINK_GROWTH_LOCKED = 133, + COMMUNITY_LINK_PARENT_GROUP = 134, + COMMUNITY_LINK_SIBLING_GROUP = 135, + COMMUNITY_LINK_SUB_GROUP = 136, + COMMUNITY_UNLINK_PARENT_GROUP = 137, + COMMUNITY_UNLINK_SIBLING_GROUP = 138, + COMMUNITY_UNLINK_SUB_GROUP = 139, + GROUP_PARTICIPANT_ACCEPT = 140, + GROUP_PARTICIPANT_LINKED_GROUP_JOIN = 141, + COMMUNITY_CREATE = 142, + EPHEMERAL_KEEP_IN_CHAT = 143, + GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST = 144, + GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE = 145, + INTEGRITY_UNLINK_PARENT_GROUP = 146, + COMMUNITY_PARTICIPANT_PROMOTE = 147, + COMMUNITY_PARTICIPANT_DEMOTE = 148, + COMMUNITY_PARENT_GROUP_DELETED = 149, + COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL = 150, + GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP = 151, + MASKED_THREAD_CREATED = 152, + MASKED_THREAD_UNMASKED = 153, + BIZ_CHAT_ASSIGNMENT = 154, + CHAT_PSA = 155, + CHAT_POLL_CREATION_MESSAGE = 156, + CAG_MASKED_THREAD_CREATED = 157, + COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED = 158, + CAG_INVITE_AUTO_ADD = 159, + BIZ_CHAT_ASSIGNMENT_UNASSIGN = 160, + CAG_INVITE_AUTO_JOINED = 161 + } + } + + /** Properties of a WebNotificationsInfo. */ + interface IWebNotificationsInfo { + + /** WebNotificationsInfo timestamp */ + timestamp?: (number|Long|null); + + /** WebNotificationsInfo unreadChats */ + unreadChats?: (number|null); + + /** WebNotificationsInfo notifyMessageCount */ + notifyMessageCount?: (number|null); + + /** WebNotificationsInfo notifyMessages */ + notifyMessages?: (proto.IWebMessageInfo[]|null); + } + + /** Represents a WebNotificationsInfo. */ + class WebNotificationsInfo implements IWebNotificationsInfo { + + /** + * Constructs a new WebNotificationsInfo. + * @param [properties] Properties to set + */ + constructor(properties?: proto.IWebNotificationsInfo); + + /** WebNotificationsInfo timestamp. */ + public timestamp: (number|Long); + + /** WebNotificationsInfo unreadChats. */ + public unreadChats: number; + + /** WebNotificationsInfo notifyMessageCount. */ + public notifyMessageCount: number; + + /** WebNotificationsInfo notifyMessages. */ + public notifyMessages: proto.IWebMessageInfo[]; + + /** + * Creates a new WebNotificationsInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns WebNotificationsInfo instance + */ + public static create(properties?: proto.IWebNotificationsInfo): proto.WebNotificationsInfo; + + /** + * Encodes the specified WebNotificationsInfo message. Does not implicitly {@link proto.WebNotificationsInfo.verify|verify} messages. + * @param message WebNotificationsInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: proto.IWebNotificationsInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebNotificationsInfo message, length delimited. Does not implicitly {@link proto.WebNotificationsInfo.verify|verify} messages. + * @param message WebNotificationsInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: proto.IWebNotificationsInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebNotificationsInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebNotificationsInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): proto.WebNotificationsInfo; + + /** + * Decodes a WebNotificationsInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebNotificationsInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): proto.WebNotificationsInfo; + + /** + * Verifies a WebNotificationsInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebNotificationsInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebNotificationsInfo + */ + public static fromObject(object: { [k: string]: any }): proto.WebNotificationsInfo; + + /** + * Creates a plain object from a WebNotificationsInfo message. Also converts values to other types if specified. + * @param message WebNotificationsInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: proto.WebNotificationsInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebNotificationsInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } +} diff --git a/WAProto/index.js b/WAProto/index.js new file mode 100644 index 00000000000..17d396d9590 --- /dev/null +++ b/WAProto/index.js @@ -0,0 +1,78186 @@ +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.proto = (function() { + + /** + * Namespace proto. + * @exports proto + * @namespace + */ + var proto = {}; + + proto.ADVDeviceIdentity = (function() { + + /** + * Properties of a ADVDeviceIdentity. + * @memberof proto + * @interface IADVDeviceIdentity + * @property {number|null} [rawId] ADVDeviceIdentity rawId + * @property {number|Long|null} [timestamp] ADVDeviceIdentity timestamp + * @property {number|null} [keyIndex] ADVDeviceIdentity keyIndex + */ + + /** + * Constructs a new ADVDeviceIdentity. + * @memberof proto + * @classdesc Represents a ADVDeviceIdentity. + * @implements IADVDeviceIdentity + * @constructor + * @param {proto.IADVDeviceIdentity=} [properties] Properties to set + */ + function ADVDeviceIdentity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ADVDeviceIdentity rawId. + * @member {number} rawId + * @memberof proto.ADVDeviceIdentity + * @instance + */ + ADVDeviceIdentity.prototype.rawId = 0; + + /** + * ADVDeviceIdentity timestamp. + * @member {number|Long} timestamp + * @memberof proto.ADVDeviceIdentity + * @instance + */ + ADVDeviceIdentity.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ADVDeviceIdentity keyIndex. + * @member {number} keyIndex + * @memberof proto.ADVDeviceIdentity + * @instance + */ + ADVDeviceIdentity.prototype.keyIndex = 0; + + /** + * Creates a new ADVDeviceIdentity instance using the specified properties. + * @function create + * @memberof proto.ADVDeviceIdentity + * @static + * @param {proto.IADVDeviceIdentity=} [properties] Properties to set + * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity instance + */ + ADVDeviceIdentity.create = function create(properties) { + return new ADVDeviceIdentity(properties); + }; + + /** + * Encodes the specified ADVDeviceIdentity message. Does not implicitly {@link proto.ADVDeviceIdentity.verify|verify} messages. + * @function encode + * @memberof proto.ADVDeviceIdentity + * @static + * @param {proto.IADVDeviceIdentity} message ADVDeviceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVDeviceIdentity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.rawId); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); + if (message.keyIndex != null && Object.hasOwnProperty.call(message, "keyIndex")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.keyIndex); + return writer; + }; + + /** + * Encodes the specified ADVDeviceIdentity message, length delimited. Does not implicitly {@link proto.ADVDeviceIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ADVDeviceIdentity + * @static + * @param {proto.IADVDeviceIdentity} message ADVDeviceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVDeviceIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ADVDeviceIdentity message from the specified reader or buffer. + * @function decode + * @memberof proto.ADVDeviceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVDeviceIdentity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVDeviceIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rawId = reader.uint32(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.keyIndex = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ADVDeviceIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ADVDeviceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVDeviceIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ADVDeviceIdentity message. + * @function verify + * @memberof proto.ADVDeviceIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ADVDeviceIdentity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rawId != null && message.hasOwnProperty("rawId")) + if (!$util.isInteger(message.rawId)) + return "rawId: integer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.keyIndex != null && message.hasOwnProperty("keyIndex")) + if (!$util.isInteger(message.keyIndex)) + return "keyIndex: integer expected"; + return null; + }; + + /** + * Creates a ADVDeviceIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ADVDeviceIdentity + * @static + * @param {Object.} object Plain object + * @returns {proto.ADVDeviceIdentity} ADVDeviceIdentity + */ + ADVDeviceIdentity.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ADVDeviceIdentity) + return object; + var message = new $root.proto.ADVDeviceIdentity(); + if (object.rawId != null) + message.rawId = object.rawId >>> 0; + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + if (object.keyIndex != null) + message.keyIndex = object.keyIndex >>> 0; + return message; + }; + + /** + * Creates a plain object from a ADVDeviceIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ADVDeviceIdentity + * @static + * @param {proto.ADVDeviceIdentity} message ADVDeviceIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ADVDeviceIdentity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.rawId = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + object.keyIndex = 0; + } + if (message.rawId != null && message.hasOwnProperty("rawId")) + object.rawId = message.rawId; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + if (message.keyIndex != null && message.hasOwnProperty("keyIndex")) + object.keyIndex = message.keyIndex; + return object; + }; + + /** + * Converts this ADVDeviceIdentity to JSON. + * @function toJSON + * @memberof proto.ADVDeviceIdentity + * @instance + * @returns {Object.} JSON object + */ + ADVDeviceIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ADVDeviceIdentity; + })(); + + proto.ADVKeyIndexList = (function() { + + /** + * Properties of a ADVKeyIndexList. + * @memberof proto + * @interface IADVKeyIndexList + * @property {number|null} [rawId] ADVKeyIndexList rawId + * @property {number|Long|null} [timestamp] ADVKeyIndexList timestamp + * @property {number|null} [currentIndex] ADVKeyIndexList currentIndex + * @property {Array.|null} [validIndexes] ADVKeyIndexList validIndexes + */ + + /** + * Constructs a new ADVKeyIndexList. + * @memberof proto + * @classdesc Represents a ADVKeyIndexList. + * @implements IADVKeyIndexList + * @constructor + * @param {proto.IADVKeyIndexList=} [properties] Properties to set + */ + function ADVKeyIndexList(properties) { + this.validIndexes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ADVKeyIndexList rawId. + * @member {number} rawId + * @memberof proto.ADVKeyIndexList + * @instance + */ + ADVKeyIndexList.prototype.rawId = 0; + + /** + * ADVKeyIndexList timestamp. + * @member {number|Long} timestamp + * @memberof proto.ADVKeyIndexList + * @instance + */ + ADVKeyIndexList.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ADVKeyIndexList currentIndex. + * @member {number} currentIndex + * @memberof proto.ADVKeyIndexList + * @instance + */ + ADVKeyIndexList.prototype.currentIndex = 0; + + /** + * ADVKeyIndexList validIndexes. + * @member {Array.} validIndexes + * @memberof proto.ADVKeyIndexList + * @instance + */ + ADVKeyIndexList.prototype.validIndexes = $util.emptyArray; + + /** + * Creates a new ADVKeyIndexList instance using the specified properties. + * @function create + * @memberof proto.ADVKeyIndexList + * @static + * @param {proto.IADVKeyIndexList=} [properties] Properties to set + * @returns {proto.ADVKeyIndexList} ADVKeyIndexList instance + */ + ADVKeyIndexList.create = function create(properties) { + return new ADVKeyIndexList(properties); + }; + + /** + * Encodes the specified ADVKeyIndexList message. Does not implicitly {@link proto.ADVKeyIndexList.verify|verify} messages. + * @function encode + * @memberof proto.ADVKeyIndexList + * @static + * @param {proto.IADVKeyIndexList} message ADVKeyIndexList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVKeyIndexList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.rawId); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); + if (message.currentIndex != null && Object.hasOwnProperty.call(message, "currentIndex")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.currentIndex); + if (message.validIndexes != null && message.validIndexes.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.validIndexes.length; ++i) + writer.uint32(message.validIndexes[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ADVKeyIndexList message, length delimited. Does not implicitly {@link proto.ADVKeyIndexList.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ADVKeyIndexList + * @static + * @param {proto.IADVKeyIndexList} message ADVKeyIndexList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVKeyIndexList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ADVKeyIndexList message from the specified reader or buffer. + * @function decode + * @memberof proto.ADVKeyIndexList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ADVKeyIndexList} ADVKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVKeyIndexList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVKeyIndexList(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rawId = reader.uint32(); + break; + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.currentIndex = reader.uint32(); + break; + case 4: + if (!(message.validIndexes && message.validIndexes.length)) + message.validIndexes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.validIndexes.push(reader.uint32()); + } else + message.validIndexes.push(reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ADVKeyIndexList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ADVKeyIndexList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ADVKeyIndexList} ADVKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVKeyIndexList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ADVKeyIndexList message. + * @function verify + * @memberof proto.ADVKeyIndexList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ADVKeyIndexList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rawId != null && message.hasOwnProperty("rawId")) + if (!$util.isInteger(message.rawId)) + return "rawId: integer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) + if (!$util.isInteger(message.currentIndex)) + return "currentIndex: integer expected"; + if (message.validIndexes != null && message.hasOwnProperty("validIndexes")) { + if (!Array.isArray(message.validIndexes)) + return "validIndexes: array expected"; + for (var i = 0; i < message.validIndexes.length; ++i) + if (!$util.isInteger(message.validIndexes[i])) + return "validIndexes: integer[] expected"; + } + return null; + }; + + /** + * Creates a ADVKeyIndexList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ADVKeyIndexList + * @static + * @param {Object.} object Plain object + * @returns {proto.ADVKeyIndexList} ADVKeyIndexList + */ + ADVKeyIndexList.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ADVKeyIndexList) + return object; + var message = new $root.proto.ADVKeyIndexList(); + if (object.rawId != null) + message.rawId = object.rawId >>> 0; + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + if (object.currentIndex != null) + message.currentIndex = object.currentIndex >>> 0; + if (object.validIndexes) { + if (!Array.isArray(object.validIndexes)) + throw TypeError(".proto.ADVKeyIndexList.validIndexes: array expected"); + message.validIndexes = []; + for (var i = 0; i < object.validIndexes.length; ++i) + message.validIndexes[i] = object.validIndexes[i] >>> 0; + } + return message; + }; + + /** + * Creates a plain object from a ADVKeyIndexList message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ADVKeyIndexList + * @static + * @param {proto.ADVKeyIndexList} message ADVKeyIndexList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ADVKeyIndexList.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.validIndexes = []; + if (options.defaults) { + object.rawId = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + object.currentIndex = 0; + } + if (message.rawId != null && message.hasOwnProperty("rawId")) + object.rawId = message.rawId; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) + object.currentIndex = message.currentIndex; + if (message.validIndexes && message.validIndexes.length) { + object.validIndexes = []; + for (var j = 0; j < message.validIndexes.length; ++j) + object.validIndexes[j] = message.validIndexes[j]; + } + return object; + }; + + /** + * Converts this ADVKeyIndexList to JSON. + * @function toJSON + * @memberof proto.ADVKeyIndexList + * @instance + * @returns {Object.} JSON object + */ + ADVKeyIndexList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ADVKeyIndexList; + })(); + + proto.ADVSignedDeviceIdentity = (function() { + + /** + * Properties of a ADVSignedDeviceIdentity. + * @memberof proto + * @interface IADVSignedDeviceIdentity + * @property {Uint8Array|null} [details] ADVSignedDeviceIdentity details + * @property {Uint8Array|null} [accountSignatureKey] ADVSignedDeviceIdentity accountSignatureKey + * @property {Uint8Array|null} [accountSignature] ADVSignedDeviceIdentity accountSignature + * @property {Uint8Array|null} [deviceSignature] ADVSignedDeviceIdentity deviceSignature + */ + + /** + * Constructs a new ADVSignedDeviceIdentity. + * @memberof proto + * @classdesc Represents a ADVSignedDeviceIdentity. + * @implements IADVSignedDeviceIdentity + * @constructor + * @param {proto.IADVSignedDeviceIdentity=} [properties] Properties to set + */ + function ADVSignedDeviceIdentity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ADVSignedDeviceIdentity details. + * @member {Uint8Array} details + * @memberof proto.ADVSignedDeviceIdentity + * @instance + */ + ADVSignedDeviceIdentity.prototype.details = $util.newBuffer([]); + + /** + * ADVSignedDeviceIdentity accountSignatureKey. + * @member {Uint8Array} accountSignatureKey + * @memberof proto.ADVSignedDeviceIdentity + * @instance + */ + ADVSignedDeviceIdentity.prototype.accountSignatureKey = $util.newBuffer([]); + + /** + * ADVSignedDeviceIdentity accountSignature. + * @member {Uint8Array} accountSignature + * @memberof proto.ADVSignedDeviceIdentity + * @instance + */ + ADVSignedDeviceIdentity.prototype.accountSignature = $util.newBuffer([]); + + /** + * ADVSignedDeviceIdentity deviceSignature. + * @member {Uint8Array} deviceSignature + * @memberof proto.ADVSignedDeviceIdentity + * @instance + */ + ADVSignedDeviceIdentity.prototype.deviceSignature = $util.newBuffer([]); + + /** + * Creates a new ADVSignedDeviceIdentity instance using the specified properties. + * @function create + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {proto.IADVSignedDeviceIdentity=} [properties] Properties to set + * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity instance + */ + ADVSignedDeviceIdentity.create = function create(properties) { + return new ADVSignedDeviceIdentity(properties); + }; + + /** + * Encodes the specified ADVSignedDeviceIdentity message. Does not implicitly {@link proto.ADVSignedDeviceIdentity.verify|verify} messages. + * @function encode + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {proto.IADVSignedDeviceIdentity} message ADVSignedDeviceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVSignedDeviceIdentity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); + if (message.accountSignatureKey != null && Object.hasOwnProperty.call(message, "accountSignatureKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.accountSignatureKey); + if (message.accountSignature != null && Object.hasOwnProperty.call(message, "accountSignature")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.accountSignature); + if (message.deviceSignature != null && Object.hasOwnProperty.call(message, "deviceSignature")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.deviceSignature); + return writer; + }; + + /** + * Encodes the specified ADVSignedDeviceIdentity message, length delimited. Does not implicitly {@link proto.ADVSignedDeviceIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {proto.IADVSignedDeviceIdentity} message ADVSignedDeviceIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVSignedDeviceIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ADVSignedDeviceIdentity message from the specified reader or buffer. + * @function decode + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVSignedDeviceIdentity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVSignedDeviceIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.details = reader.bytes(); + break; + case 2: + message.accountSignatureKey = reader.bytes(); + break; + case 3: + message.accountSignature = reader.bytes(); + break; + case 4: + message.deviceSignature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ADVSignedDeviceIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVSignedDeviceIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ADVSignedDeviceIdentity message. + * @function verify + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ADVSignedDeviceIdentity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) + return "details: buffer expected"; + if (message.accountSignatureKey != null && message.hasOwnProperty("accountSignatureKey")) + if (!(message.accountSignatureKey && typeof message.accountSignatureKey.length === "number" || $util.isString(message.accountSignatureKey))) + return "accountSignatureKey: buffer expected"; + if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) + if (!(message.accountSignature && typeof message.accountSignature.length === "number" || $util.isString(message.accountSignature))) + return "accountSignature: buffer expected"; + if (message.deviceSignature != null && message.hasOwnProperty("deviceSignature")) + if (!(message.deviceSignature && typeof message.deviceSignature.length === "number" || $util.isString(message.deviceSignature))) + return "deviceSignature: buffer expected"; + return null; + }; + + /** + * Creates a ADVSignedDeviceIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {Object.} object Plain object + * @returns {proto.ADVSignedDeviceIdentity} ADVSignedDeviceIdentity + */ + ADVSignedDeviceIdentity.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ADVSignedDeviceIdentity) + return object; + var message = new $root.proto.ADVSignedDeviceIdentity(); + if (object.details != null) + if (typeof object.details === "string") + $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); + else if (object.details.length) + message.details = object.details; + if (object.accountSignatureKey != null) + if (typeof object.accountSignatureKey === "string") + $util.base64.decode(object.accountSignatureKey, message.accountSignatureKey = $util.newBuffer($util.base64.length(object.accountSignatureKey)), 0); + else if (object.accountSignatureKey.length) + message.accountSignatureKey = object.accountSignatureKey; + if (object.accountSignature != null) + if (typeof object.accountSignature === "string") + $util.base64.decode(object.accountSignature, message.accountSignature = $util.newBuffer($util.base64.length(object.accountSignature)), 0); + else if (object.accountSignature.length) + message.accountSignature = object.accountSignature; + if (object.deviceSignature != null) + if (typeof object.deviceSignature === "string") + $util.base64.decode(object.deviceSignature, message.deviceSignature = $util.newBuffer($util.base64.length(object.deviceSignature)), 0); + else if (object.deviceSignature.length) + message.deviceSignature = object.deviceSignature; + return message; + }; + + /** + * Creates a plain object from a ADVSignedDeviceIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ADVSignedDeviceIdentity + * @static + * @param {proto.ADVSignedDeviceIdentity} message ADVSignedDeviceIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ADVSignedDeviceIdentity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.details = ""; + else { + object.details = []; + if (options.bytes !== Array) + object.details = $util.newBuffer(object.details); + } + if (options.bytes === String) + object.accountSignatureKey = ""; + else { + object.accountSignatureKey = []; + if (options.bytes !== Array) + object.accountSignatureKey = $util.newBuffer(object.accountSignatureKey); + } + if (options.bytes === String) + object.accountSignature = ""; + else { + object.accountSignature = []; + if (options.bytes !== Array) + object.accountSignature = $util.newBuffer(object.accountSignature); + } + if (options.bytes === String) + object.deviceSignature = ""; + else { + object.deviceSignature = []; + if (options.bytes !== Array) + object.deviceSignature = $util.newBuffer(object.deviceSignature); + } + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; + if (message.accountSignatureKey != null && message.hasOwnProperty("accountSignatureKey")) + object.accountSignatureKey = options.bytes === String ? $util.base64.encode(message.accountSignatureKey, 0, message.accountSignatureKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.accountSignatureKey) : message.accountSignatureKey; + if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) + object.accountSignature = options.bytes === String ? $util.base64.encode(message.accountSignature, 0, message.accountSignature.length) : options.bytes === Array ? Array.prototype.slice.call(message.accountSignature) : message.accountSignature; + if (message.deviceSignature != null && message.hasOwnProperty("deviceSignature")) + object.deviceSignature = options.bytes === String ? $util.base64.encode(message.deviceSignature, 0, message.deviceSignature.length) : options.bytes === Array ? Array.prototype.slice.call(message.deviceSignature) : message.deviceSignature; + return object; + }; + + /** + * Converts this ADVSignedDeviceIdentity to JSON. + * @function toJSON + * @memberof proto.ADVSignedDeviceIdentity + * @instance + * @returns {Object.} JSON object + */ + ADVSignedDeviceIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ADVSignedDeviceIdentity; + })(); + + proto.ADVSignedDeviceIdentityHMAC = (function() { + + /** + * Properties of a ADVSignedDeviceIdentityHMAC. + * @memberof proto + * @interface IADVSignedDeviceIdentityHMAC + * @property {Uint8Array|null} [details] ADVSignedDeviceIdentityHMAC details + * @property {Uint8Array|null} [hmac] ADVSignedDeviceIdentityHMAC hmac + */ + + /** + * Constructs a new ADVSignedDeviceIdentityHMAC. + * @memberof proto + * @classdesc Represents a ADVSignedDeviceIdentityHMAC. + * @implements IADVSignedDeviceIdentityHMAC + * @constructor + * @param {proto.IADVSignedDeviceIdentityHMAC=} [properties] Properties to set + */ + function ADVSignedDeviceIdentityHMAC(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ADVSignedDeviceIdentityHMAC details. + * @member {Uint8Array} details + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @instance + */ + ADVSignedDeviceIdentityHMAC.prototype.details = $util.newBuffer([]); + + /** + * ADVSignedDeviceIdentityHMAC hmac. + * @member {Uint8Array} hmac + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @instance + */ + ADVSignedDeviceIdentityHMAC.prototype.hmac = $util.newBuffer([]); + + /** + * Creates a new ADVSignedDeviceIdentityHMAC instance using the specified properties. + * @function create + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {proto.IADVSignedDeviceIdentityHMAC=} [properties] Properties to set + * @returns {proto.ADVSignedDeviceIdentityHMAC} ADVSignedDeviceIdentityHMAC instance + */ + ADVSignedDeviceIdentityHMAC.create = function create(properties) { + return new ADVSignedDeviceIdentityHMAC(properties); + }; + + /** + * Encodes the specified ADVSignedDeviceIdentityHMAC message. Does not implicitly {@link proto.ADVSignedDeviceIdentityHMAC.verify|verify} messages. + * @function encode + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {proto.IADVSignedDeviceIdentityHMAC} message ADVSignedDeviceIdentityHMAC message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVSignedDeviceIdentityHMAC.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); + if (message.hmac != null && Object.hasOwnProperty.call(message, "hmac")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.hmac); + return writer; + }; + + /** + * Encodes the specified ADVSignedDeviceIdentityHMAC message, length delimited. Does not implicitly {@link proto.ADVSignedDeviceIdentityHMAC.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {proto.IADVSignedDeviceIdentityHMAC} message ADVSignedDeviceIdentityHMAC message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVSignedDeviceIdentityHMAC.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ADVSignedDeviceIdentityHMAC message from the specified reader or buffer. + * @function decode + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ADVSignedDeviceIdentityHMAC} ADVSignedDeviceIdentityHMAC + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVSignedDeviceIdentityHMAC.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVSignedDeviceIdentityHMAC(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.details = reader.bytes(); + break; + case 2: + message.hmac = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ADVSignedDeviceIdentityHMAC message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ADVSignedDeviceIdentityHMAC} ADVSignedDeviceIdentityHMAC + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVSignedDeviceIdentityHMAC.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ADVSignedDeviceIdentityHMAC message. + * @function verify + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ADVSignedDeviceIdentityHMAC.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) + return "details: buffer expected"; + if (message.hmac != null && message.hasOwnProperty("hmac")) + if (!(message.hmac && typeof message.hmac.length === "number" || $util.isString(message.hmac))) + return "hmac: buffer expected"; + return null; + }; + + /** + * Creates a ADVSignedDeviceIdentityHMAC message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {Object.} object Plain object + * @returns {proto.ADVSignedDeviceIdentityHMAC} ADVSignedDeviceIdentityHMAC + */ + ADVSignedDeviceIdentityHMAC.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ADVSignedDeviceIdentityHMAC) + return object; + var message = new $root.proto.ADVSignedDeviceIdentityHMAC(); + if (object.details != null) + if (typeof object.details === "string") + $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); + else if (object.details.length) + message.details = object.details; + if (object.hmac != null) + if (typeof object.hmac === "string") + $util.base64.decode(object.hmac, message.hmac = $util.newBuffer($util.base64.length(object.hmac)), 0); + else if (object.hmac.length) + message.hmac = object.hmac; + return message; + }; + + /** + * Creates a plain object from a ADVSignedDeviceIdentityHMAC message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @static + * @param {proto.ADVSignedDeviceIdentityHMAC} message ADVSignedDeviceIdentityHMAC + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ADVSignedDeviceIdentityHMAC.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.details = ""; + else { + object.details = []; + if (options.bytes !== Array) + object.details = $util.newBuffer(object.details); + } + if (options.bytes === String) + object.hmac = ""; + else { + object.hmac = []; + if (options.bytes !== Array) + object.hmac = $util.newBuffer(object.hmac); + } + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; + if (message.hmac != null && message.hasOwnProperty("hmac")) + object.hmac = options.bytes === String ? $util.base64.encode(message.hmac, 0, message.hmac.length) : options.bytes === Array ? Array.prototype.slice.call(message.hmac) : message.hmac; + return object; + }; + + /** + * Converts this ADVSignedDeviceIdentityHMAC to JSON. + * @function toJSON + * @memberof proto.ADVSignedDeviceIdentityHMAC + * @instance + * @returns {Object.} JSON object + */ + ADVSignedDeviceIdentityHMAC.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ADVSignedDeviceIdentityHMAC; + })(); + + proto.ADVSignedKeyIndexList = (function() { + + /** + * Properties of a ADVSignedKeyIndexList. + * @memberof proto + * @interface IADVSignedKeyIndexList + * @property {Uint8Array|null} [details] ADVSignedKeyIndexList details + * @property {Uint8Array|null} [accountSignature] ADVSignedKeyIndexList accountSignature + */ + + /** + * Constructs a new ADVSignedKeyIndexList. + * @memberof proto + * @classdesc Represents a ADVSignedKeyIndexList. + * @implements IADVSignedKeyIndexList + * @constructor + * @param {proto.IADVSignedKeyIndexList=} [properties] Properties to set + */ + function ADVSignedKeyIndexList(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ADVSignedKeyIndexList details. + * @member {Uint8Array} details + * @memberof proto.ADVSignedKeyIndexList + * @instance + */ + ADVSignedKeyIndexList.prototype.details = $util.newBuffer([]); + + /** + * ADVSignedKeyIndexList accountSignature. + * @member {Uint8Array} accountSignature + * @memberof proto.ADVSignedKeyIndexList + * @instance + */ + ADVSignedKeyIndexList.prototype.accountSignature = $util.newBuffer([]); + + /** + * Creates a new ADVSignedKeyIndexList instance using the specified properties. + * @function create + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {proto.IADVSignedKeyIndexList=} [properties] Properties to set + * @returns {proto.ADVSignedKeyIndexList} ADVSignedKeyIndexList instance + */ + ADVSignedKeyIndexList.create = function create(properties) { + return new ADVSignedKeyIndexList(properties); + }; + + /** + * Encodes the specified ADVSignedKeyIndexList message. Does not implicitly {@link proto.ADVSignedKeyIndexList.verify|verify} messages. + * @function encode + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {proto.IADVSignedKeyIndexList} message ADVSignedKeyIndexList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVSignedKeyIndexList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); + if (message.accountSignature != null && Object.hasOwnProperty.call(message, "accountSignature")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.accountSignature); + return writer; + }; + + /** + * Encodes the specified ADVSignedKeyIndexList message, length delimited. Does not implicitly {@link proto.ADVSignedKeyIndexList.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {proto.IADVSignedKeyIndexList} message ADVSignedKeyIndexList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ADVSignedKeyIndexList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ADVSignedKeyIndexList message from the specified reader or buffer. + * @function decode + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ADVSignedKeyIndexList} ADVSignedKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVSignedKeyIndexList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ADVSignedKeyIndexList(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.details = reader.bytes(); + break; + case 2: + message.accountSignature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ADVSignedKeyIndexList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ADVSignedKeyIndexList} ADVSignedKeyIndexList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ADVSignedKeyIndexList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ADVSignedKeyIndexList message. + * @function verify + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ADVSignedKeyIndexList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) + return "details: buffer expected"; + if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) + if (!(message.accountSignature && typeof message.accountSignature.length === "number" || $util.isString(message.accountSignature))) + return "accountSignature: buffer expected"; + return null; + }; + + /** + * Creates a ADVSignedKeyIndexList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {Object.} object Plain object + * @returns {proto.ADVSignedKeyIndexList} ADVSignedKeyIndexList + */ + ADVSignedKeyIndexList.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ADVSignedKeyIndexList) + return object; + var message = new $root.proto.ADVSignedKeyIndexList(); + if (object.details != null) + if (typeof object.details === "string") + $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); + else if (object.details.length) + message.details = object.details; + if (object.accountSignature != null) + if (typeof object.accountSignature === "string") + $util.base64.decode(object.accountSignature, message.accountSignature = $util.newBuffer($util.base64.length(object.accountSignature)), 0); + else if (object.accountSignature.length) + message.accountSignature = object.accountSignature; + return message; + }; + + /** + * Creates a plain object from a ADVSignedKeyIndexList message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ADVSignedKeyIndexList + * @static + * @param {proto.ADVSignedKeyIndexList} message ADVSignedKeyIndexList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ADVSignedKeyIndexList.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.details = ""; + else { + object.details = []; + if (options.bytes !== Array) + object.details = $util.newBuffer(object.details); + } + if (options.bytes === String) + object.accountSignature = ""; + else { + object.accountSignature = []; + if (options.bytes !== Array) + object.accountSignature = $util.newBuffer(object.accountSignature); + } + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; + if (message.accountSignature != null && message.hasOwnProperty("accountSignature")) + object.accountSignature = options.bytes === String ? $util.base64.encode(message.accountSignature, 0, message.accountSignature.length) : options.bytes === Array ? Array.prototype.slice.call(message.accountSignature) : message.accountSignature; + return object; + }; + + /** + * Converts this ADVSignedKeyIndexList to JSON. + * @function toJSON + * @memberof proto.ADVSignedKeyIndexList + * @instance + * @returns {Object.} JSON object + */ + ADVSignedKeyIndexList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ADVSignedKeyIndexList; + })(); + + proto.ActionLink = (function() { + + /** + * Properties of an ActionLink. + * @memberof proto + * @interface IActionLink + * @property {string|null} [url] ActionLink url + * @property {string|null} [buttonTitle] ActionLink buttonTitle + */ + + /** + * Constructs a new ActionLink. + * @memberof proto + * @classdesc Represents an ActionLink. + * @implements IActionLink + * @constructor + * @param {proto.IActionLink=} [properties] Properties to set + */ + function ActionLink(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ActionLink url. + * @member {string} url + * @memberof proto.ActionLink + * @instance + */ + ActionLink.prototype.url = ""; + + /** + * ActionLink buttonTitle. + * @member {string} buttonTitle + * @memberof proto.ActionLink + * @instance + */ + ActionLink.prototype.buttonTitle = ""; + + /** + * Creates a new ActionLink instance using the specified properties. + * @function create + * @memberof proto.ActionLink + * @static + * @param {proto.IActionLink=} [properties] Properties to set + * @returns {proto.ActionLink} ActionLink instance + */ + ActionLink.create = function create(properties) { + return new ActionLink(properties); + }; + + /** + * Encodes the specified ActionLink message. Does not implicitly {@link proto.ActionLink.verify|verify} messages. + * @function encode + * @memberof proto.ActionLink + * @static + * @param {proto.IActionLink} message ActionLink message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ActionLink.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.buttonTitle != null && Object.hasOwnProperty.call(message, "buttonTitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.buttonTitle); + return writer; + }; + + /** + * Encodes the specified ActionLink message, length delimited. Does not implicitly {@link proto.ActionLink.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ActionLink + * @static + * @param {proto.IActionLink} message ActionLink message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ActionLink.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ActionLink message from the specified reader or buffer. + * @function decode + * @memberof proto.ActionLink + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ActionLink} ActionLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ActionLink.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ActionLink(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.buttonTitle = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ActionLink message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ActionLink + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ActionLink} ActionLink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ActionLink.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ActionLink message. + * @function verify + * @memberof proto.ActionLink + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ActionLink.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.buttonTitle != null && message.hasOwnProperty("buttonTitle")) + if (!$util.isString(message.buttonTitle)) + return "buttonTitle: string expected"; + return null; + }; + + /** + * Creates an ActionLink message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ActionLink + * @static + * @param {Object.} object Plain object + * @returns {proto.ActionLink} ActionLink + */ + ActionLink.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ActionLink) + return object; + var message = new $root.proto.ActionLink(); + if (object.url != null) + message.url = String(object.url); + if (object.buttonTitle != null) + message.buttonTitle = String(object.buttonTitle); + return message; + }; + + /** + * Creates a plain object from an ActionLink message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ActionLink + * @static + * @param {proto.ActionLink} message ActionLink + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ActionLink.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.buttonTitle = ""; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.buttonTitle != null && message.hasOwnProperty("buttonTitle")) + object.buttonTitle = message.buttonTitle; + return object; + }; + + /** + * Converts this ActionLink to JSON. + * @function toJSON + * @memberof proto.ActionLink + * @instance + * @returns {Object.} JSON object + */ + ActionLink.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ActionLink; + })(); + + proto.AutoDownloadSettings = (function() { + + /** + * Properties of an AutoDownloadSettings. + * @memberof proto + * @interface IAutoDownloadSettings + * @property {boolean|null} [downloadImages] AutoDownloadSettings downloadImages + * @property {boolean|null} [downloadAudio] AutoDownloadSettings downloadAudio + * @property {boolean|null} [downloadVideo] AutoDownloadSettings downloadVideo + * @property {boolean|null} [downloadDocuments] AutoDownloadSettings downloadDocuments + */ + + /** + * Constructs a new AutoDownloadSettings. + * @memberof proto + * @classdesc Represents an AutoDownloadSettings. + * @implements IAutoDownloadSettings + * @constructor + * @param {proto.IAutoDownloadSettings=} [properties] Properties to set + */ + function AutoDownloadSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AutoDownloadSettings downloadImages. + * @member {boolean} downloadImages + * @memberof proto.AutoDownloadSettings + * @instance + */ + AutoDownloadSettings.prototype.downloadImages = false; + + /** + * AutoDownloadSettings downloadAudio. + * @member {boolean} downloadAudio + * @memberof proto.AutoDownloadSettings + * @instance + */ + AutoDownloadSettings.prototype.downloadAudio = false; + + /** + * AutoDownloadSettings downloadVideo. + * @member {boolean} downloadVideo + * @memberof proto.AutoDownloadSettings + * @instance + */ + AutoDownloadSettings.prototype.downloadVideo = false; + + /** + * AutoDownloadSettings downloadDocuments. + * @member {boolean} downloadDocuments + * @memberof proto.AutoDownloadSettings + * @instance + */ + AutoDownloadSettings.prototype.downloadDocuments = false; + + /** + * Creates a new AutoDownloadSettings instance using the specified properties. + * @function create + * @memberof proto.AutoDownloadSettings + * @static + * @param {proto.IAutoDownloadSettings=} [properties] Properties to set + * @returns {proto.AutoDownloadSettings} AutoDownloadSettings instance + */ + AutoDownloadSettings.create = function create(properties) { + return new AutoDownloadSettings(properties); + }; + + /** + * Encodes the specified AutoDownloadSettings message. Does not implicitly {@link proto.AutoDownloadSettings.verify|verify} messages. + * @function encode + * @memberof proto.AutoDownloadSettings + * @static + * @param {proto.IAutoDownloadSettings} message AutoDownloadSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoDownloadSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.downloadImages != null && Object.hasOwnProperty.call(message, "downloadImages")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.downloadImages); + if (message.downloadAudio != null && Object.hasOwnProperty.call(message, "downloadAudio")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.downloadAudio); + if (message.downloadVideo != null && Object.hasOwnProperty.call(message, "downloadVideo")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.downloadVideo); + if (message.downloadDocuments != null && Object.hasOwnProperty.call(message, "downloadDocuments")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.downloadDocuments); + return writer; + }; + + /** + * Encodes the specified AutoDownloadSettings message, length delimited. Does not implicitly {@link proto.AutoDownloadSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.AutoDownloadSettings + * @static + * @param {proto.IAutoDownloadSettings} message AutoDownloadSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutoDownloadSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutoDownloadSettings message from the specified reader or buffer. + * @function decode + * @memberof proto.AutoDownloadSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.AutoDownloadSettings} AutoDownloadSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoDownloadSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.AutoDownloadSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.downloadImages = reader.bool(); + break; + case 2: + message.downloadAudio = reader.bool(); + break; + case 3: + message.downloadVideo = reader.bool(); + break; + case 4: + message.downloadDocuments = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutoDownloadSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.AutoDownloadSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.AutoDownloadSettings} AutoDownloadSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutoDownloadSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutoDownloadSettings message. + * @function verify + * @memberof proto.AutoDownloadSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutoDownloadSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.downloadImages != null && message.hasOwnProperty("downloadImages")) + if (typeof message.downloadImages !== "boolean") + return "downloadImages: boolean expected"; + if (message.downloadAudio != null && message.hasOwnProperty("downloadAudio")) + if (typeof message.downloadAudio !== "boolean") + return "downloadAudio: boolean expected"; + if (message.downloadVideo != null && message.hasOwnProperty("downloadVideo")) + if (typeof message.downloadVideo !== "boolean") + return "downloadVideo: boolean expected"; + if (message.downloadDocuments != null && message.hasOwnProperty("downloadDocuments")) + if (typeof message.downloadDocuments !== "boolean") + return "downloadDocuments: boolean expected"; + return null; + }; + + /** + * Creates an AutoDownloadSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.AutoDownloadSettings + * @static + * @param {Object.} object Plain object + * @returns {proto.AutoDownloadSettings} AutoDownloadSettings + */ + AutoDownloadSettings.fromObject = function fromObject(object) { + if (object instanceof $root.proto.AutoDownloadSettings) + return object; + var message = new $root.proto.AutoDownloadSettings(); + if (object.downloadImages != null) + message.downloadImages = Boolean(object.downloadImages); + if (object.downloadAudio != null) + message.downloadAudio = Boolean(object.downloadAudio); + if (object.downloadVideo != null) + message.downloadVideo = Boolean(object.downloadVideo); + if (object.downloadDocuments != null) + message.downloadDocuments = Boolean(object.downloadDocuments); + return message; + }; + + /** + * Creates a plain object from an AutoDownloadSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.AutoDownloadSettings + * @static + * @param {proto.AutoDownloadSettings} message AutoDownloadSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutoDownloadSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.downloadImages = false; + object.downloadAudio = false; + object.downloadVideo = false; + object.downloadDocuments = false; + } + if (message.downloadImages != null && message.hasOwnProperty("downloadImages")) + object.downloadImages = message.downloadImages; + if (message.downloadAudio != null && message.hasOwnProperty("downloadAudio")) + object.downloadAudio = message.downloadAudio; + if (message.downloadVideo != null && message.hasOwnProperty("downloadVideo")) + object.downloadVideo = message.downloadVideo; + if (message.downloadDocuments != null && message.hasOwnProperty("downloadDocuments")) + object.downloadDocuments = message.downloadDocuments; + return object; + }; + + /** + * Converts this AutoDownloadSettings to JSON. + * @function toJSON + * @memberof proto.AutoDownloadSettings + * @instance + * @returns {Object.} JSON object + */ + AutoDownloadSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AutoDownloadSettings; + })(); + + proto.AvatarUserSettings = (function() { + + /** + * Properties of an AvatarUserSettings. + * @memberof proto + * @interface IAvatarUserSettings + * @property {string|null} [fbid] AvatarUserSettings fbid + * @property {string|null} [password] AvatarUserSettings password + */ + + /** + * Constructs a new AvatarUserSettings. + * @memberof proto + * @classdesc Represents an AvatarUserSettings. + * @implements IAvatarUserSettings + * @constructor + * @param {proto.IAvatarUserSettings=} [properties] Properties to set + */ + function AvatarUserSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AvatarUserSettings fbid. + * @member {string} fbid + * @memberof proto.AvatarUserSettings + * @instance + */ + AvatarUserSettings.prototype.fbid = ""; + + /** + * AvatarUserSettings password. + * @member {string} password + * @memberof proto.AvatarUserSettings + * @instance + */ + AvatarUserSettings.prototype.password = ""; + + /** + * Creates a new AvatarUserSettings instance using the specified properties. + * @function create + * @memberof proto.AvatarUserSettings + * @static + * @param {proto.IAvatarUserSettings=} [properties] Properties to set + * @returns {proto.AvatarUserSettings} AvatarUserSettings instance + */ + AvatarUserSettings.create = function create(properties) { + return new AvatarUserSettings(properties); + }; + + /** + * Encodes the specified AvatarUserSettings message. Does not implicitly {@link proto.AvatarUserSettings.verify|verify} messages. + * @function encode + * @memberof proto.AvatarUserSettings + * @static + * @param {proto.IAvatarUserSettings} message AvatarUserSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvatarUserSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fbid != null && Object.hasOwnProperty.call(message, "fbid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fbid); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.password); + return writer; + }; + + /** + * Encodes the specified AvatarUserSettings message, length delimited. Does not implicitly {@link proto.AvatarUserSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.AvatarUserSettings + * @static + * @param {proto.IAvatarUserSettings} message AvatarUserSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvatarUserSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AvatarUserSettings message from the specified reader or buffer. + * @function decode + * @memberof proto.AvatarUserSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.AvatarUserSettings} AvatarUserSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvatarUserSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.AvatarUserSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fbid = reader.string(); + break; + case 2: + message.password = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AvatarUserSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.AvatarUserSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.AvatarUserSettings} AvatarUserSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvatarUserSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AvatarUserSettings message. + * @function verify + * @memberof proto.AvatarUserSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AvatarUserSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fbid != null && message.hasOwnProperty("fbid")) + if (!$util.isString(message.fbid)) + return "fbid: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + return null; + }; + + /** + * Creates an AvatarUserSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.AvatarUserSettings + * @static + * @param {Object.} object Plain object + * @returns {proto.AvatarUserSettings} AvatarUserSettings + */ + AvatarUserSettings.fromObject = function fromObject(object) { + if (object instanceof $root.proto.AvatarUserSettings) + return object; + var message = new $root.proto.AvatarUserSettings(); + if (object.fbid != null) + message.fbid = String(object.fbid); + if (object.password != null) + message.password = String(object.password); + return message; + }; + + /** + * Creates a plain object from an AvatarUserSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.AvatarUserSettings + * @static + * @param {proto.AvatarUserSettings} message AvatarUserSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AvatarUserSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fbid = ""; + object.password = ""; + } + if (message.fbid != null && message.hasOwnProperty("fbid")) + object.fbid = message.fbid; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + return object; + }; + + /** + * Converts this AvatarUserSettings to JSON. + * @function toJSON + * @memberof proto.AvatarUserSettings + * @instance + * @returns {Object.} JSON object + */ + AvatarUserSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AvatarUserSettings; + })(); + + proto.BizAccountLinkInfo = (function() { + + /** + * Properties of a BizAccountLinkInfo. + * @memberof proto + * @interface IBizAccountLinkInfo + * @property {number|Long|null} [whatsappBizAcctFbid] BizAccountLinkInfo whatsappBizAcctFbid + * @property {string|null} [whatsappAcctNumber] BizAccountLinkInfo whatsappAcctNumber + * @property {number|Long|null} [issueTime] BizAccountLinkInfo issueTime + * @property {proto.BizAccountLinkInfo.HostStorageType|null} [hostStorage] BizAccountLinkInfo hostStorage + * @property {proto.BizAccountLinkInfo.AccountType|null} [accountType] BizAccountLinkInfo accountType + */ + + /** + * Constructs a new BizAccountLinkInfo. + * @memberof proto + * @classdesc Represents a BizAccountLinkInfo. + * @implements IBizAccountLinkInfo + * @constructor + * @param {proto.IBizAccountLinkInfo=} [properties] Properties to set + */ + function BizAccountLinkInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BizAccountLinkInfo whatsappBizAcctFbid. + * @member {number|Long} whatsappBizAcctFbid + * @memberof proto.BizAccountLinkInfo + * @instance + */ + BizAccountLinkInfo.prototype.whatsappBizAcctFbid = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * BizAccountLinkInfo whatsappAcctNumber. + * @member {string} whatsappAcctNumber + * @memberof proto.BizAccountLinkInfo + * @instance + */ + BizAccountLinkInfo.prototype.whatsappAcctNumber = ""; + + /** + * BizAccountLinkInfo issueTime. + * @member {number|Long} issueTime + * @memberof proto.BizAccountLinkInfo + * @instance + */ + BizAccountLinkInfo.prototype.issueTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * BizAccountLinkInfo hostStorage. + * @member {proto.BizAccountLinkInfo.HostStorageType} hostStorage + * @memberof proto.BizAccountLinkInfo + * @instance + */ + BizAccountLinkInfo.prototype.hostStorage = 0; + + /** + * BizAccountLinkInfo accountType. + * @member {proto.BizAccountLinkInfo.AccountType} accountType + * @memberof proto.BizAccountLinkInfo + * @instance + */ + BizAccountLinkInfo.prototype.accountType = 0; + + /** + * Creates a new BizAccountLinkInfo instance using the specified properties. + * @function create + * @memberof proto.BizAccountLinkInfo + * @static + * @param {proto.IBizAccountLinkInfo=} [properties] Properties to set + * @returns {proto.BizAccountLinkInfo} BizAccountLinkInfo instance + */ + BizAccountLinkInfo.create = function create(properties) { + return new BizAccountLinkInfo(properties); + }; + + /** + * Encodes the specified BizAccountLinkInfo message. Does not implicitly {@link proto.BizAccountLinkInfo.verify|verify} messages. + * @function encode + * @memberof proto.BizAccountLinkInfo + * @static + * @param {proto.IBizAccountLinkInfo} message BizAccountLinkInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BizAccountLinkInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.whatsappBizAcctFbid != null && Object.hasOwnProperty.call(message, "whatsappBizAcctFbid")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.whatsappBizAcctFbid); + if (message.whatsappAcctNumber != null && Object.hasOwnProperty.call(message, "whatsappAcctNumber")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.whatsappAcctNumber); + if (message.issueTime != null && Object.hasOwnProperty.call(message, "issueTime")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.issueTime); + if (message.hostStorage != null && Object.hasOwnProperty.call(message, "hostStorage")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.hostStorage); + if (message.accountType != null && Object.hasOwnProperty.call(message, "accountType")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.accountType); + return writer; + }; + + /** + * Encodes the specified BizAccountLinkInfo message, length delimited. Does not implicitly {@link proto.BizAccountLinkInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.BizAccountLinkInfo + * @static + * @param {proto.IBizAccountLinkInfo} message BizAccountLinkInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BizAccountLinkInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BizAccountLinkInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.BizAccountLinkInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.BizAccountLinkInfo} BizAccountLinkInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BizAccountLinkInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.BizAccountLinkInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.whatsappBizAcctFbid = reader.uint64(); + break; + case 2: + message.whatsappAcctNumber = reader.string(); + break; + case 3: + message.issueTime = reader.uint64(); + break; + case 4: + message.hostStorage = reader.int32(); + break; + case 5: + message.accountType = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BizAccountLinkInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.BizAccountLinkInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.BizAccountLinkInfo} BizAccountLinkInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BizAccountLinkInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BizAccountLinkInfo message. + * @function verify + * @memberof proto.BizAccountLinkInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BizAccountLinkInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.whatsappBizAcctFbid != null && message.hasOwnProperty("whatsappBizAcctFbid")) + if (!$util.isInteger(message.whatsappBizAcctFbid) && !(message.whatsappBizAcctFbid && $util.isInteger(message.whatsappBizAcctFbid.low) && $util.isInteger(message.whatsappBizAcctFbid.high))) + return "whatsappBizAcctFbid: integer|Long expected"; + if (message.whatsappAcctNumber != null && message.hasOwnProperty("whatsappAcctNumber")) + if (!$util.isString(message.whatsappAcctNumber)) + return "whatsappAcctNumber: string expected"; + if (message.issueTime != null && message.hasOwnProperty("issueTime")) + if (!$util.isInteger(message.issueTime) && !(message.issueTime && $util.isInteger(message.issueTime.low) && $util.isInteger(message.issueTime.high))) + return "issueTime: integer|Long expected"; + if (message.hostStorage != null && message.hasOwnProperty("hostStorage")) + switch (message.hostStorage) { + default: + return "hostStorage: enum value expected"; + case 0: + case 1: + break; + } + if (message.accountType != null && message.hasOwnProperty("accountType")) + switch (message.accountType) { + default: + return "accountType: enum value expected"; + case 0: + break; + } + return null; + }; + + /** + * Creates a BizAccountLinkInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.BizAccountLinkInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.BizAccountLinkInfo} BizAccountLinkInfo + */ + BizAccountLinkInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.BizAccountLinkInfo) + return object; + var message = new $root.proto.BizAccountLinkInfo(); + if (object.whatsappBizAcctFbid != null) + if ($util.Long) + (message.whatsappBizAcctFbid = $util.Long.fromValue(object.whatsappBizAcctFbid)).unsigned = true; + else if (typeof object.whatsappBizAcctFbid === "string") + message.whatsappBizAcctFbid = parseInt(object.whatsappBizAcctFbid, 10); + else if (typeof object.whatsappBizAcctFbid === "number") + message.whatsappBizAcctFbid = object.whatsappBizAcctFbid; + else if (typeof object.whatsappBizAcctFbid === "object") + message.whatsappBizAcctFbid = new $util.LongBits(object.whatsappBizAcctFbid.low >>> 0, object.whatsappBizAcctFbid.high >>> 0).toNumber(true); + if (object.whatsappAcctNumber != null) + message.whatsappAcctNumber = String(object.whatsappAcctNumber); + if (object.issueTime != null) + if ($util.Long) + (message.issueTime = $util.Long.fromValue(object.issueTime)).unsigned = true; + else if (typeof object.issueTime === "string") + message.issueTime = parseInt(object.issueTime, 10); + else if (typeof object.issueTime === "number") + message.issueTime = object.issueTime; + else if (typeof object.issueTime === "object") + message.issueTime = new $util.LongBits(object.issueTime.low >>> 0, object.issueTime.high >>> 0).toNumber(true); + switch (object.hostStorage) { + case "ON_PREMISE": + case 0: + message.hostStorage = 0; + break; + case "FACEBOOK": + case 1: + message.hostStorage = 1; + break; + } + switch (object.accountType) { + case "ENTERPRISE": + case 0: + message.accountType = 0; + break; + } + return message; + }; + + /** + * Creates a plain object from a BizAccountLinkInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.BizAccountLinkInfo + * @static + * @param {proto.BizAccountLinkInfo} message BizAccountLinkInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BizAccountLinkInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.whatsappBizAcctFbid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.whatsappBizAcctFbid = options.longs === String ? "0" : 0; + object.whatsappAcctNumber = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.issueTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.issueTime = options.longs === String ? "0" : 0; + object.hostStorage = options.enums === String ? "ON_PREMISE" : 0; + object.accountType = options.enums === String ? "ENTERPRISE" : 0; + } + if (message.whatsappBizAcctFbid != null && message.hasOwnProperty("whatsappBizAcctFbid")) + if (typeof message.whatsappBizAcctFbid === "number") + object.whatsappBizAcctFbid = options.longs === String ? String(message.whatsappBizAcctFbid) : message.whatsappBizAcctFbid; + else + object.whatsappBizAcctFbid = options.longs === String ? $util.Long.prototype.toString.call(message.whatsappBizAcctFbid) : options.longs === Number ? new $util.LongBits(message.whatsappBizAcctFbid.low >>> 0, message.whatsappBizAcctFbid.high >>> 0).toNumber(true) : message.whatsappBizAcctFbid; + if (message.whatsappAcctNumber != null && message.hasOwnProperty("whatsappAcctNumber")) + object.whatsappAcctNumber = message.whatsappAcctNumber; + if (message.issueTime != null && message.hasOwnProperty("issueTime")) + if (typeof message.issueTime === "number") + object.issueTime = options.longs === String ? String(message.issueTime) : message.issueTime; + else + object.issueTime = options.longs === String ? $util.Long.prototype.toString.call(message.issueTime) : options.longs === Number ? new $util.LongBits(message.issueTime.low >>> 0, message.issueTime.high >>> 0).toNumber(true) : message.issueTime; + if (message.hostStorage != null && message.hasOwnProperty("hostStorage")) + object.hostStorage = options.enums === String ? $root.proto.BizAccountLinkInfo.HostStorageType[message.hostStorage] : message.hostStorage; + if (message.accountType != null && message.hasOwnProperty("accountType")) + object.accountType = options.enums === String ? $root.proto.BizAccountLinkInfo.AccountType[message.accountType] : message.accountType; + return object; + }; + + /** + * Converts this BizAccountLinkInfo to JSON. + * @function toJSON + * @memberof proto.BizAccountLinkInfo + * @instance + * @returns {Object.} JSON object + */ + BizAccountLinkInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * AccountType enum. + * @name proto.BizAccountLinkInfo.AccountType + * @enum {number} + * @property {number} ENTERPRISE=0 ENTERPRISE value + */ + BizAccountLinkInfo.AccountType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENTERPRISE"] = 0; + return values; + })(); + + /** + * HostStorageType enum. + * @name proto.BizAccountLinkInfo.HostStorageType + * @enum {number} + * @property {number} ON_PREMISE=0 ON_PREMISE value + * @property {number} FACEBOOK=1 FACEBOOK value + */ + BizAccountLinkInfo.HostStorageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ON_PREMISE"] = 0; + values[valuesById[1] = "FACEBOOK"] = 1; + return values; + })(); + + return BizAccountLinkInfo; + })(); + + proto.BizAccountPayload = (function() { + + /** + * Properties of a BizAccountPayload. + * @memberof proto + * @interface IBizAccountPayload + * @property {proto.IVerifiedNameCertificate|null} [vnameCert] BizAccountPayload vnameCert + * @property {Uint8Array|null} [bizAcctLinkInfo] BizAccountPayload bizAcctLinkInfo + */ + + /** + * Constructs a new BizAccountPayload. + * @memberof proto + * @classdesc Represents a BizAccountPayload. + * @implements IBizAccountPayload + * @constructor + * @param {proto.IBizAccountPayload=} [properties] Properties to set + */ + function BizAccountPayload(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BizAccountPayload vnameCert. + * @member {proto.IVerifiedNameCertificate|null|undefined} vnameCert + * @memberof proto.BizAccountPayload + * @instance + */ + BizAccountPayload.prototype.vnameCert = null; + + /** + * BizAccountPayload bizAcctLinkInfo. + * @member {Uint8Array} bizAcctLinkInfo + * @memberof proto.BizAccountPayload + * @instance + */ + BizAccountPayload.prototype.bizAcctLinkInfo = $util.newBuffer([]); + + /** + * Creates a new BizAccountPayload instance using the specified properties. + * @function create + * @memberof proto.BizAccountPayload + * @static + * @param {proto.IBizAccountPayload=} [properties] Properties to set + * @returns {proto.BizAccountPayload} BizAccountPayload instance + */ + BizAccountPayload.create = function create(properties) { + return new BizAccountPayload(properties); + }; + + /** + * Encodes the specified BizAccountPayload message. Does not implicitly {@link proto.BizAccountPayload.verify|verify} messages. + * @function encode + * @memberof proto.BizAccountPayload + * @static + * @param {proto.IBizAccountPayload} message BizAccountPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BizAccountPayload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vnameCert != null && Object.hasOwnProperty.call(message, "vnameCert")) + $root.proto.VerifiedNameCertificate.encode(message.vnameCert, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.bizAcctLinkInfo != null && Object.hasOwnProperty.call(message, "bizAcctLinkInfo")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.bizAcctLinkInfo); + return writer; + }; + + /** + * Encodes the specified BizAccountPayload message, length delimited. Does not implicitly {@link proto.BizAccountPayload.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.BizAccountPayload + * @static + * @param {proto.IBizAccountPayload} message BizAccountPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BizAccountPayload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BizAccountPayload message from the specified reader or buffer. + * @function decode + * @memberof proto.BizAccountPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.BizAccountPayload} BizAccountPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BizAccountPayload.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.BizAccountPayload(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vnameCert = $root.proto.VerifiedNameCertificate.decode(reader, reader.uint32()); + break; + case 2: + message.bizAcctLinkInfo = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BizAccountPayload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.BizAccountPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.BizAccountPayload} BizAccountPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BizAccountPayload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BizAccountPayload message. + * @function verify + * @memberof proto.BizAccountPayload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BizAccountPayload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vnameCert != null && message.hasOwnProperty("vnameCert")) { + var error = $root.proto.VerifiedNameCertificate.verify(message.vnameCert); + if (error) + return "vnameCert." + error; + } + if (message.bizAcctLinkInfo != null && message.hasOwnProperty("bizAcctLinkInfo")) + if (!(message.bizAcctLinkInfo && typeof message.bizAcctLinkInfo.length === "number" || $util.isString(message.bizAcctLinkInfo))) + return "bizAcctLinkInfo: buffer expected"; + return null; + }; + + /** + * Creates a BizAccountPayload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.BizAccountPayload + * @static + * @param {Object.} object Plain object + * @returns {proto.BizAccountPayload} BizAccountPayload + */ + BizAccountPayload.fromObject = function fromObject(object) { + if (object instanceof $root.proto.BizAccountPayload) + return object; + var message = new $root.proto.BizAccountPayload(); + if (object.vnameCert != null) { + if (typeof object.vnameCert !== "object") + throw TypeError(".proto.BizAccountPayload.vnameCert: object expected"); + message.vnameCert = $root.proto.VerifiedNameCertificate.fromObject(object.vnameCert); + } + if (object.bizAcctLinkInfo != null) + if (typeof object.bizAcctLinkInfo === "string") + $util.base64.decode(object.bizAcctLinkInfo, message.bizAcctLinkInfo = $util.newBuffer($util.base64.length(object.bizAcctLinkInfo)), 0); + else if (object.bizAcctLinkInfo.length) + message.bizAcctLinkInfo = object.bizAcctLinkInfo; + return message; + }; + + /** + * Creates a plain object from a BizAccountPayload message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.BizAccountPayload + * @static + * @param {proto.BizAccountPayload} message BizAccountPayload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BizAccountPayload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.vnameCert = null; + if (options.bytes === String) + object.bizAcctLinkInfo = ""; + else { + object.bizAcctLinkInfo = []; + if (options.bytes !== Array) + object.bizAcctLinkInfo = $util.newBuffer(object.bizAcctLinkInfo); + } + } + if (message.vnameCert != null && message.hasOwnProperty("vnameCert")) + object.vnameCert = $root.proto.VerifiedNameCertificate.toObject(message.vnameCert, options); + if (message.bizAcctLinkInfo != null && message.hasOwnProperty("bizAcctLinkInfo")) + object.bizAcctLinkInfo = options.bytes === String ? $util.base64.encode(message.bizAcctLinkInfo, 0, message.bizAcctLinkInfo.length) : options.bytes === Array ? Array.prototype.slice.call(message.bizAcctLinkInfo) : message.bizAcctLinkInfo; + return object; + }; + + /** + * Converts this BizAccountPayload to JSON. + * @function toJSON + * @memberof proto.BizAccountPayload + * @instance + * @returns {Object.} JSON object + */ + BizAccountPayload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BizAccountPayload; + })(); + + proto.BizIdentityInfo = (function() { + + /** + * Properties of a BizIdentityInfo. + * @memberof proto + * @interface IBizIdentityInfo + * @property {proto.BizIdentityInfo.VerifiedLevelValue|null} [vlevel] BizIdentityInfo vlevel + * @property {proto.IVerifiedNameCertificate|null} [vnameCert] BizIdentityInfo vnameCert + * @property {boolean|null} [signed] BizIdentityInfo signed + * @property {boolean|null} [revoked] BizIdentityInfo revoked + * @property {proto.BizIdentityInfo.HostStorageType|null} [hostStorage] BizIdentityInfo hostStorage + * @property {proto.BizIdentityInfo.ActualActorsType|null} [actualActors] BizIdentityInfo actualActors + * @property {number|Long|null} [privacyModeTs] BizIdentityInfo privacyModeTs + * @property {number|Long|null} [featureControls] BizIdentityInfo featureControls + */ + + /** + * Constructs a new BizIdentityInfo. + * @memberof proto + * @classdesc Represents a BizIdentityInfo. + * @implements IBizIdentityInfo + * @constructor + * @param {proto.IBizIdentityInfo=} [properties] Properties to set + */ + function BizIdentityInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BizIdentityInfo vlevel. + * @member {proto.BizIdentityInfo.VerifiedLevelValue} vlevel + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.vlevel = 0; + + /** + * BizIdentityInfo vnameCert. + * @member {proto.IVerifiedNameCertificate|null|undefined} vnameCert + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.vnameCert = null; + + /** + * BizIdentityInfo signed. + * @member {boolean} signed + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.signed = false; + + /** + * BizIdentityInfo revoked. + * @member {boolean} revoked + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.revoked = false; + + /** + * BizIdentityInfo hostStorage. + * @member {proto.BizIdentityInfo.HostStorageType} hostStorage + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.hostStorage = 0; + + /** + * BizIdentityInfo actualActors. + * @member {proto.BizIdentityInfo.ActualActorsType} actualActors + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.actualActors = 0; + + /** + * BizIdentityInfo privacyModeTs. + * @member {number|Long} privacyModeTs + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.privacyModeTs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * BizIdentityInfo featureControls. + * @member {number|Long} featureControls + * @memberof proto.BizIdentityInfo + * @instance + */ + BizIdentityInfo.prototype.featureControls = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new BizIdentityInfo instance using the specified properties. + * @function create + * @memberof proto.BizIdentityInfo + * @static + * @param {proto.IBizIdentityInfo=} [properties] Properties to set + * @returns {proto.BizIdentityInfo} BizIdentityInfo instance + */ + BizIdentityInfo.create = function create(properties) { + return new BizIdentityInfo(properties); + }; + + /** + * Encodes the specified BizIdentityInfo message. Does not implicitly {@link proto.BizIdentityInfo.verify|verify} messages. + * @function encode + * @memberof proto.BizIdentityInfo + * @static + * @param {proto.IBizIdentityInfo} message BizIdentityInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BizIdentityInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.vlevel != null && Object.hasOwnProperty.call(message, "vlevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.vlevel); + if (message.vnameCert != null && Object.hasOwnProperty.call(message, "vnameCert")) + $root.proto.VerifiedNameCertificate.encode(message.vnameCert, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.signed != null && Object.hasOwnProperty.call(message, "signed")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.signed); + if (message.revoked != null && Object.hasOwnProperty.call(message, "revoked")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.revoked); + if (message.hostStorage != null && Object.hasOwnProperty.call(message, "hostStorage")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.hostStorage); + if (message.actualActors != null && Object.hasOwnProperty.call(message, "actualActors")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.actualActors); + if (message.privacyModeTs != null && Object.hasOwnProperty.call(message, "privacyModeTs")) + writer.uint32(/* id 7, wireType 0 =*/56).uint64(message.privacyModeTs); + if (message.featureControls != null && Object.hasOwnProperty.call(message, "featureControls")) + writer.uint32(/* id 8, wireType 0 =*/64).uint64(message.featureControls); + return writer; + }; + + /** + * Encodes the specified BizIdentityInfo message, length delimited. Does not implicitly {@link proto.BizIdentityInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.BizIdentityInfo + * @static + * @param {proto.IBizIdentityInfo} message BizIdentityInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BizIdentityInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BizIdentityInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.BizIdentityInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.BizIdentityInfo} BizIdentityInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BizIdentityInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.BizIdentityInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vlevel = reader.int32(); + break; + case 2: + message.vnameCert = $root.proto.VerifiedNameCertificate.decode(reader, reader.uint32()); + break; + case 3: + message.signed = reader.bool(); + break; + case 4: + message.revoked = reader.bool(); + break; + case 5: + message.hostStorage = reader.int32(); + break; + case 6: + message.actualActors = reader.int32(); + break; + case 7: + message.privacyModeTs = reader.uint64(); + break; + case 8: + message.featureControls = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BizIdentityInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.BizIdentityInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.BizIdentityInfo} BizIdentityInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BizIdentityInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BizIdentityInfo message. + * @function verify + * @memberof proto.BizIdentityInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BizIdentityInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.vlevel != null && message.hasOwnProperty("vlevel")) + switch (message.vlevel) { + default: + return "vlevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.vnameCert != null && message.hasOwnProperty("vnameCert")) { + var error = $root.proto.VerifiedNameCertificate.verify(message.vnameCert); + if (error) + return "vnameCert." + error; + } + if (message.signed != null && message.hasOwnProperty("signed")) + if (typeof message.signed !== "boolean") + return "signed: boolean expected"; + if (message.revoked != null && message.hasOwnProperty("revoked")) + if (typeof message.revoked !== "boolean") + return "revoked: boolean expected"; + if (message.hostStorage != null && message.hasOwnProperty("hostStorage")) + switch (message.hostStorage) { + default: + return "hostStorage: enum value expected"; + case 0: + case 1: + break; + } + if (message.actualActors != null && message.hasOwnProperty("actualActors")) + switch (message.actualActors) { + default: + return "actualActors: enum value expected"; + case 0: + case 1: + break; + } + if (message.privacyModeTs != null && message.hasOwnProperty("privacyModeTs")) + if (!$util.isInteger(message.privacyModeTs) && !(message.privacyModeTs && $util.isInteger(message.privacyModeTs.low) && $util.isInteger(message.privacyModeTs.high))) + return "privacyModeTs: integer|Long expected"; + if (message.featureControls != null && message.hasOwnProperty("featureControls")) + if (!$util.isInteger(message.featureControls) && !(message.featureControls && $util.isInteger(message.featureControls.low) && $util.isInteger(message.featureControls.high))) + return "featureControls: integer|Long expected"; + return null; + }; + + /** + * Creates a BizIdentityInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.BizIdentityInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.BizIdentityInfo} BizIdentityInfo + */ + BizIdentityInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.BizIdentityInfo) + return object; + var message = new $root.proto.BizIdentityInfo(); + switch (object.vlevel) { + case "UNKNOWN": + case 0: + message.vlevel = 0; + break; + case "LOW": + case 1: + message.vlevel = 1; + break; + case "HIGH": + case 2: + message.vlevel = 2; + break; + } + if (object.vnameCert != null) { + if (typeof object.vnameCert !== "object") + throw TypeError(".proto.BizIdentityInfo.vnameCert: object expected"); + message.vnameCert = $root.proto.VerifiedNameCertificate.fromObject(object.vnameCert); + } + if (object.signed != null) + message.signed = Boolean(object.signed); + if (object.revoked != null) + message.revoked = Boolean(object.revoked); + switch (object.hostStorage) { + case "ON_PREMISE": + case 0: + message.hostStorage = 0; + break; + case "FACEBOOK": + case 1: + message.hostStorage = 1; + break; + } + switch (object.actualActors) { + case "SELF": + case 0: + message.actualActors = 0; + break; + case "BSP": + case 1: + message.actualActors = 1; + break; + } + if (object.privacyModeTs != null) + if ($util.Long) + (message.privacyModeTs = $util.Long.fromValue(object.privacyModeTs)).unsigned = true; + else if (typeof object.privacyModeTs === "string") + message.privacyModeTs = parseInt(object.privacyModeTs, 10); + else if (typeof object.privacyModeTs === "number") + message.privacyModeTs = object.privacyModeTs; + else if (typeof object.privacyModeTs === "object") + message.privacyModeTs = new $util.LongBits(object.privacyModeTs.low >>> 0, object.privacyModeTs.high >>> 0).toNumber(true); + if (object.featureControls != null) + if ($util.Long) + (message.featureControls = $util.Long.fromValue(object.featureControls)).unsigned = true; + else if (typeof object.featureControls === "string") + message.featureControls = parseInt(object.featureControls, 10); + else if (typeof object.featureControls === "number") + message.featureControls = object.featureControls; + else if (typeof object.featureControls === "object") + message.featureControls = new $util.LongBits(object.featureControls.low >>> 0, object.featureControls.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a BizIdentityInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.BizIdentityInfo + * @static + * @param {proto.BizIdentityInfo} message BizIdentityInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BizIdentityInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.vlevel = options.enums === String ? "UNKNOWN" : 0; + object.vnameCert = null; + object.signed = false; + object.revoked = false; + object.hostStorage = options.enums === String ? "ON_PREMISE" : 0; + object.actualActors = options.enums === String ? "SELF" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.privacyModeTs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.privacyModeTs = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.featureControls = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.featureControls = options.longs === String ? "0" : 0; + } + if (message.vlevel != null && message.hasOwnProperty("vlevel")) + object.vlevel = options.enums === String ? $root.proto.BizIdentityInfo.VerifiedLevelValue[message.vlevel] : message.vlevel; + if (message.vnameCert != null && message.hasOwnProperty("vnameCert")) + object.vnameCert = $root.proto.VerifiedNameCertificate.toObject(message.vnameCert, options); + if (message.signed != null && message.hasOwnProperty("signed")) + object.signed = message.signed; + if (message.revoked != null && message.hasOwnProperty("revoked")) + object.revoked = message.revoked; + if (message.hostStorage != null && message.hasOwnProperty("hostStorage")) + object.hostStorage = options.enums === String ? $root.proto.BizIdentityInfo.HostStorageType[message.hostStorage] : message.hostStorage; + if (message.actualActors != null && message.hasOwnProperty("actualActors")) + object.actualActors = options.enums === String ? $root.proto.BizIdentityInfo.ActualActorsType[message.actualActors] : message.actualActors; + if (message.privacyModeTs != null && message.hasOwnProperty("privacyModeTs")) + if (typeof message.privacyModeTs === "number") + object.privacyModeTs = options.longs === String ? String(message.privacyModeTs) : message.privacyModeTs; + else + object.privacyModeTs = options.longs === String ? $util.Long.prototype.toString.call(message.privacyModeTs) : options.longs === Number ? new $util.LongBits(message.privacyModeTs.low >>> 0, message.privacyModeTs.high >>> 0).toNumber(true) : message.privacyModeTs; + if (message.featureControls != null && message.hasOwnProperty("featureControls")) + if (typeof message.featureControls === "number") + object.featureControls = options.longs === String ? String(message.featureControls) : message.featureControls; + else + object.featureControls = options.longs === String ? $util.Long.prototype.toString.call(message.featureControls) : options.longs === Number ? new $util.LongBits(message.featureControls.low >>> 0, message.featureControls.high >>> 0).toNumber(true) : message.featureControls; + return object; + }; + + /** + * Converts this BizIdentityInfo to JSON. + * @function toJSON + * @memberof proto.BizIdentityInfo + * @instance + * @returns {Object.} JSON object + */ + BizIdentityInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ActualActorsType enum. + * @name proto.BizIdentityInfo.ActualActorsType + * @enum {number} + * @property {number} SELF=0 SELF value + * @property {number} BSP=1 BSP value + */ + BizIdentityInfo.ActualActorsType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SELF"] = 0; + values[valuesById[1] = "BSP"] = 1; + return values; + })(); + + /** + * HostStorageType enum. + * @name proto.BizIdentityInfo.HostStorageType + * @enum {number} + * @property {number} ON_PREMISE=0 ON_PREMISE value + * @property {number} FACEBOOK=1 FACEBOOK value + */ + BizIdentityInfo.HostStorageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ON_PREMISE"] = 0; + values[valuesById[1] = "FACEBOOK"] = 1; + return values; + })(); + + /** + * VerifiedLevelValue enum. + * @name proto.BizIdentityInfo.VerifiedLevelValue + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} LOW=1 LOW value + * @property {number} HIGH=2 HIGH value + */ + BizIdentityInfo.VerifiedLevelValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "LOW"] = 1; + values[valuesById[2] = "HIGH"] = 2; + return values; + })(); + + return BizIdentityInfo; + })(); + + proto.CertChain = (function() { + + /** + * Properties of a CertChain. + * @memberof proto + * @interface ICertChain + * @property {proto.CertChain.INoiseCertificate|null} [leaf] CertChain leaf + * @property {proto.CertChain.INoiseCertificate|null} [intermediate] CertChain intermediate + */ + + /** + * Constructs a new CertChain. + * @memberof proto + * @classdesc Represents a CertChain. + * @implements ICertChain + * @constructor + * @param {proto.ICertChain=} [properties] Properties to set + */ + function CertChain(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CertChain leaf. + * @member {proto.CertChain.INoiseCertificate|null|undefined} leaf + * @memberof proto.CertChain + * @instance + */ + CertChain.prototype.leaf = null; + + /** + * CertChain intermediate. + * @member {proto.CertChain.INoiseCertificate|null|undefined} intermediate + * @memberof proto.CertChain + * @instance + */ + CertChain.prototype.intermediate = null; + + /** + * Creates a new CertChain instance using the specified properties. + * @function create + * @memberof proto.CertChain + * @static + * @param {proto.ICertChain=} [properties] Properties to set + * @returns {proto.CertChain} CertChain instance + */ + CertChain.create = function create(properties) { + return new CertChain(properties); + }; + + /** + * Encodes the specified CertChain message. Does not implicitly {@link proto.CertChain.verify|verify} messages. + * @function encode + * @memberof proto.CertChain + * @static + * @param {proto.ICertChain} message CertChain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertChain.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.leaf != null && Object.hasOwnProperty.call(message, "leaf")) + $root.proto.CertChain.NoiseCertificate.encode(message.leaf, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.intermediate != null && Object.hasOwnProperty.call(message, "intermediate")) + $root.proto.CertChain.NoiseCertificate.encode(message.intermediate, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CertChain message, length delimited. Does not implicitly {@link proto.CertChain.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.CertChain + * @static + * @param {proto.ICertChain} message CertChain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertChain.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CertChain message from the specified reader or buffer. + * @function decode + * @memberof proto.CertChain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.CertChain} CertChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertChain.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.CertChain(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leaf = $root.proto.CertChain.NoiseCertificate.decode(reader, reader.uint32()); + break; + case 2: + message.intermediate = $root.proto.CertChain.NoiseCertificate.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CertChain message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.CertChain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.CertChain} CertChain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertChain.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CertChain message. + * @function verify + * @memberof proto.CertChain + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CertChain.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.leaf != null && message.hasOwnProperty("leaf")) { + var error = $root.proto.CertChain.NoiseCertificate.verify(message.leaf); + if (error) + return "leaf." + error; + } + if (message.intermediate != null && message.hasOwnProperty("intermediate")) { + var error = $root.proto.CertChain.NoiseCertificate.verify(message.intermediate); + if (error) + return "intermediate." + error; + } + return null; + }; + + /** + * Creates a CertChain message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.CertChain + * @static + * @param {Object.} object Plain object + * @returns {proto.CertChain} CertChain + */ + CertChain.fromObject = function fromObject(object) { + if (object instanceof $root.proto.CertChain) + return object; + var message = new $root.proto.CertChain(); + if (object.leaf != null) { + if (typeof object.leaf !== "object") + throw TypeError(".proto.CertChain.leaf: object expected"); + message.leaf = $root.proto.CertChain.NoiseCertificate.fromObject(object.leaf); + } + if (object.intermediate != null) { + if (typeof object.intermediate !== "object") + throw TypeError(".proto.CertChain.intermediate: object expected"); + message.intermediate = $root.proto.CertChain.NoiseCertificate.fromObject(object.intermediate); + } + return message; + }; + + /** + * Creates a plain object from a CertChain message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.CertChain + * @static + * @param {proto.CertChain} message CertChain + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CertChain.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.leaf = null; + object.intermediate = null; + } + if (message.leaf != null && message.hasOwnProperty("leaf")) + object.leaf = $root.proto.CertChain.NoiseCertificate.toObject(message.leaf, options); + if (message.intermediate != null && message.hasOwnProperty("intermediate")) + object.intermediate = $root.proto.CertChain.NoiseCertificate.toObject(message.intermediate, options); + return object; + }; + + /** + * Converts this CertChain to JSON. + * @function toJSON + * @memberof proto.CertChain + * @instance + * @returns {Object.} JSON object + */ + CertChain.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + CertChain.NoiseCertificate = (function() { + + /** + * Properties of a NoiseCertificate. + * @memberof proto.CertChain + * @interface INoiseCertificate + * @property {Uint8Array|null} [details] NoiseCertificate details + * @property {Uint8Array|null} [signature] NoiseCertificate signature + */ + + /** + * Constructs a new NoiseCertificate. + * @memberof proto.CertChain + * @classdesc Represents a NoiseCertificate. + * @implements INoiseCertificate + * @constructor + * @param {proto.CertChain.INoiseCertificate=} [properties] Properties to set + */ + function NoiseCertificate(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NoiseCertificate details. + * @member {Uint8Array} details + * @memberof proto.CertChain.NoiseCertificate + * @instance + */ + NoiseCertificate.prototype.details = $util.newBuffer([]); + + /** + * NoiseCertificate signature. + * @member {Uint8Array} signature + * @memberof proto.CertChain.NoiseCertificate + * @instance + */ + NoiseCertificate.prototype.signature = $util.newBuffer([]); + + /** + * Creates a new NoiseCertificate instance using the specified properties. + * @function create + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {proto.CertChain.INoiseCertificate=} [properties] Properties to set + * @returns {proto.CertChain.NoiseCertificate} NoiseCertificate instance + */ + NoiseCertificate.create = function create(properties) { + return new NoiseCertificate(properties); + }; + + /** + * Encodes the specified NoiseCertificate message. Does not implicitly {@link proto.CertChain.NoiseCertificate.verify|verify} messages. + * @function encode + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {proto.CertChain.INoiseCertificate} message NoiseCertificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NoiseCertificate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature); + return writer; + }; + + /** + * Encodes the specified NoiseCertificate message, length delimited. Does not implicitly {@link proto.CertChain.NoiseCertificate.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {proto.CertChain.INoiseCertificate} message NoiseCertificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NoiseCertificate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer. + * @function decode + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.CertChain.NoiseCertificate} NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NoiseCertificate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.CertChain.NoiseCertificate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.details = reader.bytes(); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.CertChain.NoiseCertificate} NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NoiseCertificate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NoiseCertificate message. + * @function verify + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NoiseCertificate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) + return "details: buffer expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + return null; + }; + + /** + * Creates a NoiseCertificate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {Object.} object Plain object + * @returns {proto.CertChain.NoiseCertificate} NoiseCertificate + */ + NoiseCertificate.fromObject = function fromObject(object) { + if (object instanceof $root.proto.CertChain.NoiseCertificate) + return object; + var message = new $root.proto.CertChain.NoiseCertificate(); + if (object.details != null) + if (typeof object.details === "string") + $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); + else if (object.details.length) + message.details = object.details; + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + return message; + }; + + /** + * Creates a plain object from a NoiseCertificate message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.CertChain.NoiseCertificate + * @static + * @param {proto.CertChain.NoiseCertificate} message NoiseCertificate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NoiseCertificate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.details = ""; + else { + object.details = []; + if (options.bytes !== Array) + object.details = $util.newBuffer(object.details); + } + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + return object; + }; + + /** + * Converts this NoiseCertificate to JSON. + * @function toJSON + * @memberof proto.CertChain.NoiseCertificate + * @instance + * @returns {Object.} JSON object + */ + NoiseCertificate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + NoiseCertificate.Details = (function() { + + /** + * Properties of a Details. + * @memberof proto.CertChain.NoiseCertificate + * @interface IDetails + * @property {number|null} [serial] Details serial + * @property {number|null} [issuerSerial] Details issuerSerial + * @property {Uint8Array|null} [key] Details key + * @property {number|Long|null} [notBefore] Details notBefore + * @property {number|Long|null} [notAfter] Details notAfter + */ + + /** + * Constructs a new Details. + * @memberof proto.CertChain.NoiseCertificate + * @classdesc Represents a Details. + * @implements IDetails + * @constructor + * @param {proto.CertChain.NoiseCertificate.IDetails=} [properties] Properties to set + */ + function Details(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Details serial. + * @member {number} serial + * @memberof proto.CertChain.NoiseCertificate.Details + * @instance + */ + Details.prototype.serial = 0; + + /** + * Details issuerSerial. + * @member {number} issuerSerial + * @memberof proto.CertChain.NoiseCertificate.Details + * @instance + */ + Details.prototype.issuerSerial = 0; + + /** + * Details key. + * @member {Uint8Array} key + * @memberof proto.CertChain.NoiseCertificate.Details + * @instance + */ + Details.prototype.key = $util.newBuffer([]); + + /** + * Details notBefore. + * @member {number|Long} notBefore + * @memberof proto.CertChain.NoiseCertificate.Details + * @instance + */ + Details.prototype.notBefore = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Details notAfter. + * @member {number|Long} notAfter + * @memberof proto.CertChain.NoiseCertificate.Details + * @instance + */ + Details.prototype.notAfter = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new Details instance using the specified properties. + * @function create + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {proto.CertChain.NoiseCertificate.IDetails=} [properties] Properties to set + * @returns {proto.CertChain.NoiseCertificate.Details} Details instance + */ + Details.create = function create(properties) { + return new Details(properties); + }; + + /** + * Encodes the specified Details message. Does not implicitly {@link proto.CertChain.NoiseCertificate.Details.verify|verify} messages. + * @function encode + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {proto.CertChain.NoiseCertificate.IDetails} message Details message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Details.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serial != null && Object.hasOwnProperty.call(message, "serial")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.serial); + if (message.issuerSerial != null && Object.hasOwnProperty.call(message, "issuerSerial")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.issuerSerial); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.key); + if (message.notBefore != null && Object.hasOwnProperty.call(message, "notBefore")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.notBefore); + if (message.notAfter != null && Object.hasOwnProperty.call(message, "notAfter")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.notAfter); + return writer; + }; + + /** + * Encodes the specified Details message, length delimited. Does not implicitly {@link proto.CertChain.NoiseCertificate.Details.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {proto.CertChain.NoiseCertificate.IDetails} message Details message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Details.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Details message from the specified reader or buffer. + * @function decode + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.CertChain.NoiseCertificate.Details} Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Details.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.CertChain.NoiseCertificate.Details(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.serial = reader.uint32(); + break; + case 2: + message.issuerSerial = reader.uint32(); + break; + case 3: + message.key = reader.bytes(); + break; + case 4: + message.notBefore = reader.uint64(); + break; + case 5: + message.notAfter = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Details message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.CertChain.NoiseCertificate.Details} Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Details.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Details message. + * @function verify + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Details.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serial != null && message.hasOwnProperty("serial")) + if (!$util.isInteger(message.serial)) + return "serial: integer expected"; + if (message.issuerSerial != null && message.hasOwnProperty("issuerSerial")) + if (!$util.isInteger(message.issuerSerial)) + return "issuerSerial: integer expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + if (message.notBefore != null && message.hasOwnProperty("notBefore")) + if (!$util.isInteger(message.notBefore) && !(message.notBefore && $util.isInteger(message.notBefore.low) && $util.isInteger(message.notBefore.high))) + return "notBefore: integer|Long expected"; + if (message.notAfter != null && message.hasOwnProperty("notAfter")) + if (!$util.isInteger(message.notAfter) && !(message.notAfter && $util.isInteger(message.notAfter.low) && $util.isInteger(message.notAfter.high))) + return "notAfter: integer|Long expected"; + return null; + }; + + /** + * Creates a Details message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {Object.} object Plain object + * @returns {proto.CertChain.NoiseCertificate.Details} Details + */ + Details.fromObject = function fromObject(object) { + if (object instanceof $root.proto.CertChain.NoiseCertificate.Details) + return object; + var message = new $root.proto.CertChain.NoiseCertificate.Details(); + if (object.serial != null) + message.serial = object.serial >>> 0; + if (object.issuerSerial != null) + message.issuerSerial = object.issuerSerial >>> 0; + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + if (object.notBefore != null) + if ($util.Long) + (message.notBefore = $util.Long.fromValue(object.notBefore)).unsigned = true; + else if (typeof object.notBefore === "string") + message.notBefore = parseInt(object.notBefore, 10); + else if (typeof object.notBefore === "number") + message.notBefore = object.notBefore; + else if (typeof object.notBefore === "object") + message.notBefore = new $util.LongBits(object.notBefore.low >>> 0, object.notBefore.high >>> 0).toNumber(true); + if (object.notAfter != null) + if ($util.Long) + (message.notAfter = $util.Long.fromValue(object.notAfter)).unsigned = true; + else if (typeof object.notAfter === "string") + message.notAfter = parseInt(object.notAfter, 10); + else if (typeof object.notAfter === "number") + message.notAfter = object.notAfter; + else if (typeof object.notAfter === "object") + message.notAfter = new $util.LongBits(object.notAfter.low >>> 0, object.notAfter.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Details message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.CertChain.NoiseCertificate.Details + * @static + * @param {proto.CertChain.NoiseCertificate.Details} message Details + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Details.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.serial = 0; + object.issuerSerial = 0; + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.notBefore = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.notBefore = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.notAfter = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.notAfter = options.longs === String ? "0" : 0; + } + if (message.serial != null && message.hasOwnProperty("serial")) + object.serial = message.serial; + if (message.issuerSerial != null && message.hasOwnProperty("issuerSerial")) + object.issuerSerial = message.issuerSerial; + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + if (message.notBefore != null && message.hasOwnProperty("notBefore")) + if (typeof message.notBefore === "number") + object.notBefore = options.longs === String ? String(message.notBefore) : message.notBefore; + else + object.notBefore = options.longs === String ? $util.Long.prototype.toString.call(message.notBefore) : options.longs === Number ? new $util.LongBits(message.notBefore.low >>> 0, message.notBefore.high >>> 0).toNumber(true) : message.notBefore; + if (message.notAfter != null && message.hasOwnProperty("notAfter")) + if (typeof message.notAfter === "number") + object.notAfter = options.longs === String ? String(message.notAfter) : message.notAfter; + else + object.notAfter = options.longs === String ? $util.Long.prototype.toString.call(message.notAfter) : options.longs === Number ? new $util.LongBits(message.notAfter.low >>> 0, message.notAfter.high >>> 0).toNumber(true) : message.notAfter; + return object; + }; + + /** + * Converts this Details to JSON. + * @function toJSON + * @memberof proto.CertChain.NoiseCertificate.Details + * @instance + * @returns {Object.} JSON object + */ + Details.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Details; + })(); + + return NoiseCertificate; + })(); + + return CertChain; + })(); + + proto.ClientPayload = (function() { + + /** + * Properties of a ClientPayload. + * @memberof proto + * @interface IClientPayload + * @property {number|Long|null} [username] ClientPayload username + * @property {boolean|null} [passive] ClientPayload passive + * @property {proto.ClientPayload.IUserAgent|null} [userAgent] ClientPayload userAgent + * @property {proto.ClientPayload.IWebInfo|null} [webInfo] ClientPayload webInfo + * @property {string|null} [pushName] ClientPayload pushName + * @property {number|null} [sessionId] ClientPayload sessionId + * @property {boolean|null} [shortConnect] ClientPayload shortConnect + * @property {proto.ClientPayload.ConnectType|null} [connectType] ClientPayload connectType + * @property {proto.ClientPayload.ConnectReason|null} [connectReason] ClientPayload connectReason + * @property {Array.|null} [shards] ClientPayload shards + * @property {proto.ClientPayload.IDNSSource|null} [dnsSource] ClientPayload dnsSource + * @property {number|null} [connectAttemptCount] ClientPayload connectAttemptCount + * @property {number|null} [device] ClientPayload device + * @property {proto.ClientPayload.IDevicePairingRegistrationData|null} [devicePairingData] ClientPayload devicePairingData + * @property {proto.ClientPayload.Product|null} [product] ClientPayload product + * @property {Uint8Array|null} [fbCat] ClientPayload fbCat + * @property {Uint8Array|null} [fbUserAgent] ClientPayload fbUserAgent + * @property {boolean|null} [oc] ClientPayload oc + * @property {number|null} [lc] ClientPayload lc + * @property {proto.ClientPayload.IOSAppExtension|null} [iosAppExtension] ClientPayload iosAppExtension + * @property {number|Long|null} [fbAppId] ClientPayload fbAppId + * @property {Uint8Array|null} [fbDeviceId] ClientPayload fbDeviceId + * @property {boolean|null} [pull] ClientPayload pull + * @property {Uint8Array|null} [paddingBytes] ClientPayload paddingBytes + * @property {number|null} [yearClass] ClientPayload yearClass + * @property {number|null} [memClass] ClientPayload memClass + */ + + /** + * Constructs a new ClientPayload. + * @memberof proto + * @classdesc Represents a ClientPayload. + * @implements IClientPayload + * @constructor + * @param {proto.IClientPayload=} [properties] Properties to set + */ + function ClientPayload(properties) { + this.shards = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientPayload username. + * @member {number|Long} username + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.username = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ClientPayload passive. + * @member {boolean} passive + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.passive = false; + + /** + * ClientPayload userAgent. + * @member {proto.ClientPayload.IUserAgent|null|undefined} userAgent + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.userAgent = null; + + /** + * ClientPayload webInfo. + * @member {proto.ClientPayload.IWebInfo|null|undefined} webInfo + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.webInfo = null; + + /** + * ClientPayload pushName. + * @member {string} pushName + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.pushName = ""; + + /** + * ClientPayload sessionId. + * @member {number} sessionId + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.sessionId = 0; + + /** + * ClientPayload shortConnect. + * @member {boolean} shortConnect + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.shortConnect = false; + + /** + * ClientPayload connectType. + * @member {proto.ClientPayload.ConnectType} connectType + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.connectType = 0; + + /** + * ClientPayload connectReason. + * @member {proto.ClientPayload.ConnectReason} connectReason + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.connectReason = 0; + + /** + * ClientPayload shards. + * @member {Array.} shards + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.shards = $util.emptyArray; + + /** + * ClientPayload dnsSource. + * @member {proto.ClientPayload.IDNSSource|null|undefined} dnsSource + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.dnsSource = null; + + /** + * ClientPayload connectAttemptCount. + * @member {number} connectAttemptCount + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.connectAttemptCount = 0; + + /** + * ClientPayload device. + * @member {number} device + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.device = 0; + + /** + * ClientPayload devicePairingData. + * @member {proto.ClientPayload.IDevicePairingRegistrationData|null|undefined} devicePairingData + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.devicePairingData = null; + + /** + * ClientPayload product. + * @member {proto.ClientPayload.Product} product + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.product = 0; + + /** + * ClientPayload fbCat. + * @member {Uint8Array} fbCat + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.fbCat = $util.newBuffer([]); + + /** + * ClientPayload fbUserAgent. + * @member {Uint8Array} fbUserAgent + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.fbUserAgent = $util.newBuffer([]); + + /** + * ClientPayload oc. + * @member {boolean} oc + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.oc = false; + + /** + * ClientPayload lc. + * @member {number} lc + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.lc = 0; + + /** + * ClientPayload iosAppExtension. + * @member {proto.ClientPayload.IOSAppExtension} iosAppExtension + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.iosAppExtension = 0; + + /** + * ClientPayload fbAppId. + * @member {number|Long} fbAppId + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.fbAppId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ClientPayload fbDeviceId. + * @member {Uint8Array} fbDeviceId + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.fbDeviceId = $util.newBuffer([]); + + /** + * ClientPayload pull. + * @member {boolean} pull + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.pull = false; + + /** + * ClientPayload paddingBytes. + * @member {Uint8Array} paddingBytes + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.paddingBytes = $util.newBuffer([]); + + /** + * ClientPayload yearClass. + * @member {number} yearClass + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.yearClass = 0; + + /** + * ClientPayload memClass. + * @member {number} memClass + * @memberof proto.ClientPayload + * @instance + */ + ClientPayload.prototype.memClass = 0; + + /** + * Creates a new ClientPayload instance using the specified properties. + * @function create + * @memberof proto.ClientPayload + * @static + * @param {proto.IClientPayload=} [properties] Properties to set + * @returns {proto.ClientPayload} ClientPayload instance + */ + ClientPayload.create = function create(properties) { + return new ClientPayload(properties); + }; + + /** + * Encodes the specified ClientPayload message. Does not implicitly {@link proto.ClientPayload.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload + * @static + * @param {proto.IClientPayload} message ClientPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientPayload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.username); + if (message.passive != null && Object.hasOwnProperty.call(message, "passive")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.passive); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + $root.proto.ClientPayload.UserAgent.encode(message.userAgent, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.webInfo != null && Object.hasOwnProperty.call(message, "webInfo")) + $root.proto.ClientPayload.WebInfo.encode(message.webInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.pushName != null && Object.hasOwnProperty.call(message, "pushName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.pushName); + if (message.sessionId != null && Object.hasOwnProperty.call(message, "sessionId")) + writer.uint32(/* id 9, wireType 5 =*/77).sfixed32(message.sessionId); + if (message.shortConnect != null && Object.hasOwnProperty.call(message, "shortConnect")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.shortConnect); + if (message.connectType != null && Object.hasOwnProperty.call(message, "connectType")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.connectType); + if (message.connectReason != null && Object.hasOwnProperty.call(message, "connectReason")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.connectReason); + if (message.shards != null && message.shards.length) + for (var i = 0; i < message.shards.length; ++i) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.shards[i]); + if (message.dnsSource != null && Object.hasOwnProperty.call(message, "dnsSource")) + $root.proto.ClientPayload.DNSSource.encode(message.dnsSource, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.connectAttemptCount != null && Object.hasOwnProperty.call(message, "connectAttemptCount")) + writer.uint32(/* id 16, wireType 0 =*/128).uint32(message.connectAttemptCount); + if (message.device != null && Object.hasOwnProperty.call(message, "device")) + writer.uint32(/* id 18, wireType 0 =*/144).uint32(message.device); + if (message.devicePairingData != null && Object.hasOwnProperty.call(message, "devicePairingData")) + $root.proto.ClientPayload.DevicePairingRegistrationData.encode(message.devicePairingData, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.product); + if (message.fbCat != null && Object.hasOwnProperty.call(message, "fbCat")) + writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.fbCat); + if (message.fbUserAgent != null && Object.hasOwnProperty.call(message, "fbUserAgent")) + writer.uint32(/* id 22, wireType 2 =*/178).bytes(message.fbUserAgent); + if (message.oc != null && Object.hasOwnProperty.call(message, "oc")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.oc); + if (message.lc != null && Object.hasOwnProperty.call(message, "lc")) + writer.uint32(/* id 24, wireType 0 =*/192).int32(message.lc); + if (message.iosAppExtension != null && Object.hasOwnProperty.call(message, "iosAppExtension")) + writer.uint32(/* id 30, wireType 0 =*/240).int32(message.iosAppExtension); + if (message.fbAppId != null && Object.hasOwnProperty.call(message, "fbAppId")) + writer.uint32(/* id 31, wireType 0 =*/248).uint64(message.fbAppId); + if (message.fbDeviceId != null && Object.hasOwnProperty.call(message, "fbDeviceId")) + writer.uint32(/* id 32, wireType 2 =*/258).bytes(message.fbDeviceId); + if (message.pull != null && Object.hasOwnProperty.call(message, "pull")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.pull); + if (message.paddingBytes != null && Object.hasOwnProperty.call(message, "paddingBytes")) + writer.uint32(/* id 34, wireType 2 =*/274).bytes(message.paddingBytes); + if (message.yearClass != null && Object.hasOwnProperty.call(message, "yearClass")) + writer.uint32(/* id 36, wireType 0 =*/288).int32(message.yearClass); + if (message.memClass != null && Object.hasOwnProperty.call(message, "memClass")) + writer.uint32(/* id 37, wireType 0 =*/296).int32(message.memClass); + return writer; + }; + + /** + * Encodes the specified ClientPayload message, length delimited. Does not implicitly {@link proto.ClientPayload.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload + * @static + * @param {proto.IClientPayload} message ClientPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientPayload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientPayload message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload} ClientPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientPayload.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.username = reader.uint64(); + break; + case 3: + message.passive = reader.bool(); + break; + case 5: + message.userAgent = $root.proto.ClientPayload.UserAgent.decode(reader, reader.uint32()); + break; + case 6: + message.webInfo = $root.proto.ClientPayload.WebInfo.decode(reader, reader.uint32()); + break; + case 7: + message.pushName = reader.string(); + break; + case 9: + message.sessionId = reader.sfixed32(); + break; + case 10: + message.shortConnect = reader.bool(); + break; + case 12: + message.connectType = reader.int32(); + break; + case 13: + message.connectReason = reader.int32(); + break; + case 14: + if (!(message.shards && message.shards.length)) + message.shards = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.shards.push(reader.int32()); + } else + message.shards.push(reader.int32()); + break; + case 15: + message.dnsSource = $root.proto.ClientPayload.DNSSource.decode(reader, reader.uint32()); + break; + case 16: + message.connectAttemptCount = reader.uint32(); + break; + case 18: + message.device = reader.uint32(); + break; + case 19: + message.devicePairingData = $root.proto.ClientPayload.DevicePairingRegistrationData.decode(reader, reader.uint32()); + break; + case 20: + message.product = reader.int32(); + break; + case 21: + message.fbCat = reader.bytes(); + break; + case 22: + message.fbUserAgent = reader.bytes(); + break; + case 23: + message.oc = reader.bool(); + break; + case 24: + message.lc = reader.int32(); + break; + case 30: + message.iosAppExtension = reader.int32(); + break; + case 31: + message.fbAppId = reader.uint64(); + break; + case 32: + message.fbDeviceId = reader.bytes(); + break; + case 33: + message.pull = reader.bool(); + break; + case 34: + message.paddingBytes = reader.bytes(); + break; + case 36: + message.yearClass = reader.int32(); + break; + case 37: + message.memClass = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientPayload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload} ClientPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientPayload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientPayload message. + * @function verify + * @memberof proto.ClientPayload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientPayload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isInteger(message.username) && !(message.username && $util.isInteger(message.username.low) && $util.isInteger(message.username.high))) + return "username: integer|Long expected"; + if (message.passive != null && message.hasOwnProperty("passive")) + if (typeof message.passive !== "boolean") + return "passive: boolean expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) { + var error = $root.proto.ClientPayload.UserAgent.verify(message.userAgent); + if (error) + return "userAgent." + error; + } + if (message.webInfo != null && message.hasOwnProperty("webInfo")) { + var error = $root.proto.ClientPayload.WebInfo.verify(message.webInfo); + if (error) + return "webInfo." + error; + } + if (message.pushName != null && message.hasOwnProperty("pushName")) + if (!$util.isString(message.pushName)) + return "pushName: string expected"; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + if (!$util.isInteger(message.sessionId)) + return "sessionId: integer expected"; + if (message.shortConnect != null && message.hasOwnProperty("shortConnect")) + if (typeof message.shortConnect !== "boolean") + return "shortConnect: boolean expected"; + if (message.connectType != null && message.hasOwnProperty("connectType")) + switch (message.connectType) { + default: + return "connectType: enum value expected"; + case 0: + case 1: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + break; + } + if (message.connectReason != null && message.hasOwnProperty("connectReason")) + switch (message.connectReason) { + default: + return "connectReason: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.shards != null && message.hasOwnProperty("shards")) { + if (!Array.isArray(message.shards)) + return "shards: array expected"; + for (var i = 0; i < message.shards.length; ++i) + if (!$util.isInteger(message.shards[i])) + return "shards: integer[] expected"; + } + if (message.dnsSource != null && message.hasOwnProperty("dnsSource")) { + var error = $root.proto.ClientPayload.DNSSource.verify(message.dnsSource); + if (error) + return "dnsSource." + error; + } + if (message.connectAttemptCount != null && message.hasOwnProperty("connectAttemptCount")) + if (!$util.isInteger(message.connectAttemptCount)) + return "connectAttemptCount: integer expected"; + if (message.device != null && message.hasOwnProperty("device")) + if (!$util.isInteger(message.device)) + return "device: integer expected"; + if (message.devicePairingData != null && message.hasOwnProperty("devicePairingData")) { + var error = $root.proto.ClientPayload.DevicePairingRegistrationData.verify(message.devicePairingData); + if (error) + return "devicePairingData." + error; + } + if (message.product != null && message.hasOwnProperty("product")) + switch (message.product) { + default: + return "product: enum value expected"; + case 0: + case 1: + break; + } + if (message.fbCat != null && message.hasOwnProperty("fbCat")) + if (!(message.fbCat && typeof message.fbCat.length === "number" || $util.isString(message.fbCat))) + return "fbCat: buffer expected"; + if (message.fbUserAgent != null && message.hasOwnProperty("fbUserAgent")) + if (!(message.fbUserAgent && typeof message.fbUserAgent.length === "number" || $util.isString(message.fbUserAgent))) + return "fbUserAgent: buffer expected"; + if (message.oc != null && message.hasOwnProperty("oc")) + if (typeof message.oc !== "boolean") + return "oc: boolean expected"; + if (message.lc != null && message.hasOwnProperty("lc")) + if (!$util.isInteger(message.lc)) + return "lc: integer expected"; + if (message.iosAppExtension != null && message.hasOwnProperty("iosAppExtension")) + switch (message.iosAppExtension) { + default: + return "iosAppExtension: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.fbAppId != null && message.hasOwnProperty("fbAppId")) + if (!$util.isInteger(message.fbAppId) && !(message.fbAppId && $util.isInteger(message.fbAppId.low) && $util.isInteger(message.fbAppId.high))) + return "fbAppId: integer|Long expected"; + if (message.fbDeviceId != null && message.hasOwnProperty("fbDeviceId")) + if (!(message.fbDeviceId && typeof message.fbDeviceId.length === "number" || $util.isString(message.fbDeviceId))) + return "fbDeviceId: buffer expected"; + if (message.pull != null && message.hasOwnProperty("pull")) + if (typeof message.pull !== "boolean") + return "pull: boolean expected"; + if (message.paddingBytes != null && message.hasOwnProperty("paddingBytes")) + if (!(message.paddingBytes && typeof message.paddingBytes.length === "number" || $util.isString(message.paddingBytes))) + return "paddingBytes: buffer expected"; + if (message.yearClass != null && message.hasOwnProperty("yearClass")) + if (!$util.isInteger(message.yearClass)) + return "yearClass: integer expected"; + if (message.memClass != null && message.hasOwnProperty("memClass")) + if (!$util.isInteger(message.memClass)) + return "memClass: integer expected"; + return null; + }; + + /** + * Creates a ClientPayload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload} ClientPayload + */ + ClientPayload.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload) + return object; + var message = new $root.proto.ClientPayload(); + if (object.username != null) + if ($util.Long) + (message.username = $util.Long.fromValue(object.username)).unsigned = true; + else if (typeof object.username === "string") + message.username = parseInt(object.username, 10); + else if (typeof object.username === "number") + message.username = object.username; + else if (typeof object.username === "object") + message.username = new $util.LongBits(object.username.low >>> 0, object.username.high >>> 0).toNumber(true); + if (object.passive != null) + message.passive = Boolean(object.passive); + if (object.userAgent != null) { + if (typeof object.userAgent !== "object") + throw TypeError(".proto.ClientPayload.userAgent: object expected"); + message.userAgent = $root.proto.ClientPayload.UserAgent.fromObject(object.userAgent); + } + if (object.webInfo != null) { + if (typeof object.webInfo !== "object") + throw TypeError(".proto.ClientPayload.webInfo: object expected"); + message.webInfo = $root.proto.ClientPayload.WebInfo.fromObject(object.webInfo); + } + if (object.pushName != null) + message.pushName = String(object.pushName); + if (object.sessionId != null) + message.sessionId = object.sessionId | 0; + if (object.shortConnect != null) + message.shortConnect = Boolean(object.shortConnect); + switch (object.connectType) { + case "CELLULAR_UNKNOWN": + case 0: + message.connectType = 0; + break; + case "WIFI_UNKNOWN": + case 1: + message.connectType = 1; + break; + case "CELLULAR_EDGE": + case 100: + message.connectType = 100; + break; + case "CELLULAR_IDEN": + case 101: + message.connectType = 101; + break; + case "CELLULAR_UMTS": + case 102: + message.connectType = 102; + break; + case "CELLULAR_EVDO": + case 103: + message.connectType = 103; + break; + case "CELLULAR_GPRS": + case 104: + message.connectType = 104; + break; + case "CELLULAR_HSDPA": + case 105: + message.connectType = 105; + break; + case "CELLULAR_HSUPA": + case 106: + message.connectType = 106; + break; + case "CELLULAR_HSPA": + case 107: + message.connectType = 107; + break; + case "CELLULAR_CDMA": + case 108: + message.connectType = 108; + break; + case "CELLULAR_1XRTT": + case 109: + message.connectType = 109; + break; + case "CELLULAR_EHRPD": + case 110: + message.connectType = 110; + break; + case "CELLULAR_LTE": + case 111: + message.connectType = 111; + break; + case "CELLULAR_HSPAP": + case 112: + message.connectType = 112; + break; + } + switch (object.connectReason) { + case "PUSH": + case 0: + message.connectReason = 0; + break; + case "USER_ACTIVATED": + case 1: + message.connectReason = 1; + break; + case "SCHEDULED": + case 2: + message.connectReason = 2; + break; + case "ERROR_RECONNECT": + case 3: + message.connectReason = 3; + break; + case "NETWORK_SWITCH": + case 4: + message.connectReason = 4; + break; + case "PING_RECONNECT": + case 5: + message.connectReason = 5; + break; + } + if (object.shards) { + if (!Array.isArray(object.shards)) + throw TypeError(".proto.ClientPayload.shards: array expected"); + message.shards = []; + for (var i = 0; i < object.shards.length; ++i) + message.shards[i] = object.shards[i] | 0; + } + if (object.dnsSource != null) { + if (typeof object.dnsSource !== "object") + throw TypeError(".proto.ClientPayload.dnsSource: object expected"); + message.dnsSource = $root.proto.ClientPayload.DNSSource.fromObject(object.dnsSource); + } + if (object.connectAttemptCount != null) + message.connectAttemptCount = object.connectAttemptCount >>> 0; + if (object.device != null) + message.device = object.device >>> 0; + if (object.devicePairingData != null) { + if (typeof object.devicePairingData !== "object") + throw TypeError(".proto.ClientPayload.devicePairingData: object expected"); + message.devicePairingData = $root.proto.ClientPayload.DevicePairingRegistrationData.fromObject(object.devicePairingData); + } + switch (object.product) { + case "WHATSAPP": + case 0: + message.product = 0; + break; + case "MESSENGER": + case 1: + message.product = 1; + break; + } + if (object.fbCat != null) + if (typeof object.fbCat === "string") + $util.base64.decode(object.fbCat, message.fbCat = $util.newBuffer($util.base64.length(object.fbCat)), 0); + else if (object.fbCat.length) + message.fbCat = object.fbCat; + if (object.fbUserAgent != null) + if (typeof object.fbUserAgent === "string") + $util.base64.decode(object.fbUserAgent, message.fbUserAgent = $util.newBuffer($util.base64.length(object.fbUserAgent)), 0); + else if (object.fbUserAgent.length) + message.fbUserAgent = object.fbUserAgent; + if (object.oc != null) + message.oc = Boolean(object.oc); + if (object.lc != null) + message.lc = object.lc | 0; + switch (object.iosAppExtension) { + case "SHARE_EXTENSION": + case 0: + message.iosAppExtension = 0; + break; + case "SERVICE_EXTENSION": + case 1: + message.iosAppExtension = 1; + break; + case "INTENTS_EXTENSION": + case 2: + message.iosAppExtension = 2; + break; + } + if (object.fbAppId != null) + if ($util.Long) + (message.fbAppId = $util.Long.fromValue(object.fbAppId)).unsigned = true; + else if (typeof object.fbAppId === "string") + message.fbAppId = parseInt(object.fbAppId, 10); + else if (typeof object.fbAppId === "number") + message.fbAppId = object.fbAppId; + else if (typeof object.fbAppId === "object") + message.fbAppId = new $util.LongBits(object.fbAppId.low >>> 0, object.fbAppId.high >>> 0).toNumber(true); + if (object.fbDeviceId != null) + if (typeof object.fbDeviceId === "string") + $util.base64.decode(object.fbDeviceId, message.fbDeviceId = $util.newBuffer($util.base64.length(object.fbDeviceId)), 0); + else if (object.fbDeviceId.length) + message.fbDeviceId = object.fbDeviceId; + if (object.pull != null) + message.pull = Boolean(object.pull); + if (object.paddingBytes != null) + if (typeof object.paddingBytes === "string") + $util.base64.decode(object.paddingBytes, message.paddingBytes = $util.newBuffer($util.base64.length(object.paddingBytes)), 0); + else if (object.paddingBytes.length) + message.paddingBytes = object.paddingBytes; + if (object.yearClass != null) + message.yearClass = object.yearClass | 0; + if (object.memClass != null) + message.memClass = object.memClass | 0; + return message; + }; + + /** + * Creates a plain object from a ClientPayload message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload + * @static + * @param {proto.ClientPayload} message ClientPayload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientPayload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.shards = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.username = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.username = options.longs === String ? "0" : 0; + object.passive = false; + object.userAgent = null; + object.webInfo = null; + object.pushName = ""; + object.sessionId = 0; + object.shortConnect = false; + object.connectType = options.enums === String ? "CELLULAR_UNKNOWN" : 0; + object.connectReason = options.enums === String ? "PUSH" : 0; + object.dnsSource = null; + object.connectAttemptCount = 0; + object.device = 0; + object.devicePairingData = null; + object.product = options.enums === String ? "WHATSAPP" : 0; + if (options.bytes === String) + object.fbCat = ""; + else { + object.fbCat = []; + if (options.bytes !== Array) + object.fbCat = $util.newBuffer(object.fbCat); + } + if (options.bytes === String) + object.fbUserAgent = ""; + else { + object.fbUserAgent = []; + if (options.bytes !== Array) + object.fbUserAgent = $util.newBuffer(object.fbUserAgent); + } + object.oc = false; + object.lc = 0; + object.iosAppExtension = options.enums === String ? "SHARE_EXTENSION" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fbAppId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fbAppId = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.fbDeviceId = ""; + else { + object.fbDeviceId = []; + if (options.bytes !== Array) + object.fbDeviceId = $util.newBuffer(object.fbDeviceId); + } + object.pull = false; + if (options.bytes === String) + object.paddingBytes = ""; + else { + object.paddingBytes = []; + if (options.bytes !== Array) + object.paddingBytes = $util.newBuffer(object.paddingBytes); + } + object.yearClass = 0; + object.memClass = 0; + } + if (message.username != null && message.hasOwnProperty("username")) + if (typeof message.username === "number") + object.username = options.longs === String ? String(message.username) : message.username; + else + object.username = options.longs === String ? $util.Long.prototype.toString.call(message.username) : options.longs === Number ? new $util.LongBits(message.username.low >>> 0, message.username.high >>> 0).toNumber(true) : message.username; + if (message.passive != null && message.hasOwnProperty("passive")) + object.passive = message.passive; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = $root.proto.ClientPayload.UserAgent.toObject(message.userAgent, options); + if (message.webInfo != null && message.hasOwnProperty("webInfo")) + object.webInfo = $root.proto.ClientPayload.WebInfo.toObject(message.webInfo, options); + if (message.pushName != null && message.hasOwnProperty("pushName")) + object.pushName = message.pushName; + if (message.sessionId != null && message.hasOwnProperty("sessionId")) + object.sessionId = message.sessionId; + if (message.shortConnect != null && message.hasOwnProperty("shortConnect")) + object.shortConnect = message.shortConnect; + if (message.connectType != null && message.hasOwnProperty("connectType")) + object.connectType = options.enums === String ? $root.proto.ClientPayload.ConnectType[message.connectType] : message.connectType; + if (message.connectReason != null && message.hasOwnProperty("connectReason")) + object.connectReason = options.enums === String ? $root.proto.ClientPayload.ConnectReason[message.connectReason] : message.connectReason; + if (message.shards && message.shards.length) { + object.shards = []; + for (var j = 0; j < message.shards.length; ++j) + object.shards[j] = message.shards[j]; + } + if (message.dnsSource != null && message.hasOwnProperty("dnsSource")) + object.dnsSource = $root.proto.ClientPayload.DNSSource.toObject(message.dnsSource, options); + if (message.connectAttemptCount != null && message.hasOwnProperty("connectAttemptCount")) + object.connectAttemptCount = message.connectAttemptCount; + if (message.device != null && message.hasOwnProperty("device")) + object.device = message.device; + if (message.devicePairingData != null && message.hasOwnProperty("devicePairingData")) + object.devicePairingData = $root.proto.ClientPayload.DevicePairingRegistrationData.toObject(message.devicePairingData, options); + if (message.product != null && message.hasOwnProperty("product")) + object.product = options.enums === String ? $root.proto.ClientPayload.Product[message.product] : message.product; + if (message.fbCat != null && message.hasOwnProperty("fbCat")) + object.fbCat = options.bytes === String ? $util.base64.encode(message.fbCat, 0, message.fbCat.length) : options.bytes === Array ? Array.prototype.slice.call(message.fbCat) : message.fbCat; + if (message.fbUserAgent != null && message.hasOwnProperty("fbUserAgent")) + object.fbUserAgent = options.bytes === String ? $util.base64.encode(message.fbUserAgent, 0, message.fbUserAgent.length) : options.bytes === Array ? Array.prototype.slice.call(message.fbUserAgent) : message.fbUserAgent; + if (message.oc != null && message.hasOwnProperty("oc")) + object.oc = message.oc; + if (message.lc != null && message.hasOwnProperty("lc")) + object.lc = message.lc; + if (message.iosAppExtension != null && message.hasOwnProperty("iosAppExtension")) + object.iosAppExtension = options.enums === String ? $root.proto.ClientPayload.IOSAppExtension[message.iosAppExtension] : message.iosAppExtension; + if (message.fbAppId != null && message.hasOwnProperty("fbAppId")) + if (typeof message.fbAppId === "number") + object.fbAppId = options.longs === String ? String(message.fbAppId) : message.fbAppId; + else + object.fbAppId = options.longs === String ? $util.Long.prototype.toString.call(message.fbAppId) : options.longs === Number ? new $util.LongBits(message.fbAppId.low >>> 0, message.fbAppId.high >>> 0).toNumber(true) : message.fbAppId; + if (message.fbDeviceId != null && message.hasOwnProperty("fbDeviceId")) + object.fbDeviceId = options.bytes === String ? $util.base64.encode(message.fbDeviceId, 0, message.fbDeviceId.length) : options.bytes === Array ? Array.prototype.slice.call(message.fbDeviceId) : message.fbDeviceId; + if (message.pull != null && message.hasOwnProperty("pull")) + object.pull = message.pull; + if (message.paddingBytes != null && message.hasOwnProperty("paddingBytes")) + object.paddingBytes = options.bytes === String ? $util.base64.encode(message.paddingBytes, 0, message.paddingBytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.paddingBytes) : message.paddingBytes; + if (message.yearClass != null && message.hasOwnProperty("yearClass")) + object.yearClass = message.yearClass; + if (message.memClass != null && message.hasOwnProperty("memClass")) + object.memClass = message.memClass; + return object; + }; + + /** + * Converts this ClientPayload to JSON. + * @function toJSON + * @memberof proto.ClientPayload + * @instance + * @returns {Object.} JSON object + */ + ClientPayload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ConnectReason enum. + * @name proto.ClientPayload.ConnectReason + * @enum {number} + * @property {number} PUSH=0 PUSH value + * @property {number} USER_ACTIVATED=1 USER_ACTIVATED value + * @property {number} SCHEDULED=2 SCHEDULED value + * @property {number} ERROR_RECONNECT=3 ERROR_RECONNECT value + * @property {number} NETWORK_SWITCH=4 NETWORK_SWITCH value + * @property {number} PING_RECONNECT=5 PING_RECONNECT value + */ + ClientPayload.ConnectReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PUSH"] = 0; + values[valuesById[1] = "USER_ACTIVATED"] = 1; + values[valuesById[2] = "SCHEDULED"] = 2; + values[valuesById[3] = "ERROR_RECONNECT"] = 3; + values[valuesById[4] = "NETWORK_SWITCH"] = 4; + values[valuesById[5] = "PING_RECONNECT"] = 5; + return values; + })(); + + /** + * ConnectType enum. + * @name proto.ClientPayload.ConnectType + * @enum {number} + * @property {number} CELLULAR_UNKNOWN=0 CELLULAR_UNKNOWN value + * @property {number} WIFI_UNKNOWN=1 WIFI_UNKNOWN value + * @property {number} CELLULAR_EDGE=100 CELLULAR_EDGE value + * @property {number} CELLULAR_IDEN=101 CELLULAR_IDEN value + * @property {number} CELLULAR_UMTS=102 CELLULAR_UMTS value + * @property {number} CELLULAR_EVDO=103 CELLULAR_EVDO value + * @property {number} CELLULAR_GPRS=104 CELLULAR_GPRS value + * @property {number} CELLULAR_HSDPA=105 CELLULAR_HSDPA value + * @property {number} CELLULAR_HSUPA=106 CELLULAR_HSUPA value + * @property {number} CELLULAR_HSPA=107 CELLULAR_HSPA value + * @property {number} CELLULAR_CDMA=108 CELLULAR_CDMA value + * @property {number} CELLULAR_1XRTT=109 CELLULAR_1XRTT value + * @property {number} CELLULAR_EHRPD=110 CELLULAR_EHRPD value + * @property {number} CELLULAR_LTE=111 CELLULAR_LTE value + * @property {number} CELLULAR_HSPAP=112 CELLULAR_HSPAP value + */ + ClientPayload.ConnectType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CELLULAR_UNKNOWN"] = 0; + values[valuesById[1] = "WIFI_UNKNOWN"] = 1; + values[valuesById[100] = "CELLULAR_EDGE"] = 100; + values[valuesById[101] = "CELLULAR_IDEN"] = 101; + values[valuesById[102] = "CELLULAR_UMTS"] = 102; + values[valuesById[103] = "CELLULAR_EVDO"] = 103; + values[valuesById[104] = "CELLULAR_GPRS"] = 104; + values[valuesById[105] = "CELLULAR_HSDPA"] = 105; + values[valuesById[106] = "CELLULAR_HSUPA"] = 106; + values[valuesById[107] = "CELLULAR_HSPA"] = 107; + values[valuesById[108] = "CELLULAR_CDMA"] = 108; + values[valuesById[109] = "CELLULAR_1XRTT"] = 109; + values[valuesById[110] = "CELLULAR_EHRPD"] = 110; + values[valuesById[111] = "CELLULAR_LTE"] = 111; + values[valuesById[112] = "CELLULAR_HSPAP"] = 112; + return values; + })(); + + ClientPayload.DNSSource = (function() { + + /** + * Properties of a DNSSource. + * @memberof proto.ClientPayload + * @interface IDNSSource + * @property {proto.ClientPayload.DNSSource.DNSResolutionMethod|null} [dnsMethod] DNSSource dnsMethod + * @property {boolean|null} [appCached] DNSSource appCached + */ + + /** + * Constructs a new DNSSource. + * @memberof proto.ClientPayload + * @classdesc Represents a DNSSource. + * @implements IDNSSource + * @constructor + * @param {proto.ClientPayload.IDNSSource=} [properties] Properties to set + */ + function DNSSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DNSSource dnsMethod. + * @member {proto.ClientPayload.DNSSource.DNSResolutionMethod} dnsMethod + * @memberof proto.ClientPayload.DNSSource + * @instance + */ + DNSSource.prototype.dnsMethod = 0; + + /** + * DNSSource appCached. + * @member {boolean} appCached + * @memberof proto.ClientPayload.DNSSource + * @instance + */ + DNSSource.prototype.appCached = false; + + /** + * Creates a new DNSSource instance using the specified properties. + * @function create + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {proto.ClientPayload.IDNSSource=} [properties] Properties to set + * @returns {proto.ClientPayload.DNSSource} DNSSource instance + */ + DNSSource.create = function create(properties) { + return new DNSSource(properties); + }; + + /** + * Encodes the specified DNSSource message. Does not implicitly {@link proto.ClientPayload.DNSSource.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {proto.ClientPayload.IDNSSource} message DNSSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DNSSource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dnsMethod != null && Object.hasOwnProperty.call(message, "dnsMethod")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.dnsMethod); + if (message.appCached != null && Object.hasOwnProperty.call(message, "appCached")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.appCached); + return writer; + }; + + /** + * Encodes the specified DNSSource message, length delimited. Does not implicitly {@link proto.ClientPayload.DNSSource.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {proto.ClientPayload.IDNSSource} message DNSSource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DNSSource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DNSSource message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload.DNSSource} DNSSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DNSSource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload.DNSSource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 15: + message.dnsMethod = reader.int32(); + break; + case 16: + message.appCached = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DNSSource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload.DNSSource} DNSSource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DNSSource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DNSSource message. + * @function verify + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DNSSource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dnsMethod != null && message.hasOwnProperty("dnsMethod")) + switch (message.dnsMethod) { + default: + return "dnsMethod: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.appCached != null && message.hasOwnProperty("appCached")) + if (typeof message.appCached !== "boolean") + return "appCached: boolean expected"; + return null; + }; + + /** + * Creates a DNSSource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload.DNSSource} DNSSource + */ + DNSSource.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload.DNSSource) + return object; + var message = new $root.proto.ClientPayload.DNSSource(); + switch (object.dnsMethod) { + case "SYSTEM": + case 0: + message.dnsMethod = 0; + break; + case "GOOGLE": + case 1: + message.dnsMethod = 1; + break; + case "HARDCODED": + case 2: + message.dnsMethod = 2; + break; + case "OVERRIDE": + case 3: + message.dnsMethod = 3; + break; + case "FALLBACK": + case 4: + message.dnsMethod = 4; + break; + } + if (object.appCached != null) + message.appCached = Boolean(object.appCached); + return message; + }; + + /** + * Creates a plain object from a DNSSource message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload.DNSSource + * @static + * @param {proto.ClientPayload.DNSSource} message DNSSource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DNSSource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dnsMethod = options.enums === String ? "SYSTEM" : 0; + object.appCached = false; + } + if (message.dnsMethod != null && message.hasOwnProperty("dnsMethod")) + object.dnsMethod = options.enums === String ? $root.proto.ClientPayload.DNSSource.DNSResolutionMethod[message.dnsMethod] : message.dnsMethod; + if (message.appCached != null && message.hasOwnProperty("appCached")) + object.appCached = message.appCached; + return object; + }; + + /** + * Converts this DNSSource to JSON. + * @function toJSON + * @memberof proto.ClientPayload.DNSSource + * @instance + * @returns {Object.} JSON object + */ + DNSSource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * DNSResolutionMethod enum. + * @name proto.ClientPayload.DNSSource.DNSResolutionMethod + * @enum {number} + * @property {number} SYSTEM=0 SYSTEM value + * @property {number} GOOGLE=1 GOOGLE value + * @property {number} HARDCODED=2 HARDCODED value + * @property {number} OVERRIDE=3 OVERRIDE value + * @property {number} FALLBACK=4 FALLBACK value + */ + DNSSource.DNSResolutionMethod = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SYSTEM"] = 0; + values[valuesById[1] = "GOOGLE"] = 1; + values[valuesById[2] = "HARDCODED"] = 2; + values[valuesById[3] = "OVERRIDE"] = 3; + values[valuesById[4] = "FALLBACK"] = 4; + return values; + })(); + + return DNSSource; + })(); + + ClientPayload.DevicePairingRegistrationData = (function() { + + /** + * Properties of a DevicePairingRegistrationData. + * @memberof proto.ClientPayload + * @interface IDevicePairingRegistrationData + * @property {Uint8Array|null} [eRegid] DevicePairingRegistrationData eRegid + * @property {Uint8Array|null} [eKeytype] DevicePairingRegistrationData eKeytype + * @property {Uint8Array|null} [eIdent] DevicePairingRegistrationData eIdent + * @property {Uint8Array|null} [eSkeyId] DevicePairingRegistrationData eSkeyId + * @property {Uint8Array|null} [eSkeyVal] DevicePairingRegistrationData eSkeyVal + * @property {Uint8Array|null} [eSkeySig] DevicePairingRegistrationData eSkeySig + * @property {Uint8Array|null} [buildHash] DevicePairingRegistrationData buildHash + * @property {Uint8Array|null} [deviceProps] DevicePairingRegistrationData deviceProps + */ + + /** + * Constructs a new DevicePairingRegistrationData. + * @memberof proto.ClientPayload + * @classdesc Represents a DevicePairingRegistrationData. + * @implements IDevicePairingRegistrationData + * @constructor + * @param {proto.ClientPayload.IDevicePairingRegistrationData=} [properties] Properties to set + */ + function DevicePairingRegistrationData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DevicePairingRegistrationData eRegid. + * @member {Uint8Array} eRegid + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.eRegid = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData eKeytype. + * @member {Uint8Array} eKeytype + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.eKeytype = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData eIdent. + * @member {Uint8Array} eIdent + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.eIdent = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData eSkeyId. + * @member {Uint8Array} eSkeyId + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.eSkeyId = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData eSkeyVal. + * @member {Uint8Array} eSkeyVal + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.eSkeyVal = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData eSkeySig. + * @member {Uint8Array} eSkeySig + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.eSkeySig = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData buildHash. + * @member {Uint8Array} buildHash + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.buildHash = $util.newBuffer([]); + + /** + * DevicePairingRegistrationData deviceProps. + * @member {Uint8Array} deviceProps + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + */ + DevicePairingRegistrationData.prototype.deviceProps = $util.newBuffer([]); + + /** + * Creates a new DevicePairingRegistrationData instance using the specified properties. + * @function create + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {proto.ClientPayload.IDevicePairingRegistrationData=} [properties] Properties to set + * @returns {proto.ClientPayload.DevicePairingRegistrationData} DevicePairingRegistrationData instance + */ + DevicePairingRegistrationData.create = function create(properties) { + return new DevicePairingRegistrationData(properties); + }; + + /** + * Encodes the specified DevicePairingRegistrationData message. Does not implicitly {@link proto.ClientPayload.DevicePairingRegistrationData.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {proto.ClientPayload.IDevicePairingRegistrationData} message DevicePairingRegistrationData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DevicePairingRegistrationData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.eRegid != null && Object.hasOwnProperty.call(message, "eRegid")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.eRegid); + if (message.eKeytype != null && Object.hasOwnProperty.call(message, "eKeytype")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.eKeytype); + if (message.eIdent != null && Object.hasOwnProperty.call(message, "eIdent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.eIdent); + if (message.eSkeyId != null && Object.hasOwnProperty.call(message, "eSkeyId")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.eSkeyId); + if (message.eSkeyVal != null && Object.hasOwnProperty.call(message, "eSkeyVal")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.eSkeyVal); + if (message.eSkeySig != null && Object.hasOwnProperty.call(message, "eSkeySig")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.eSkeySig); + if (message.buildHash != null && Object.hasOwnProperty.call(message, "buildHash")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.buildHash); + if (message.deviceProps != null && Object.hasOwnProperty.call(message, "deviceProps")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.deviceProps); + return writer; + }; + + /** + * Encodes the specified DevicePairingRegistrationData message, length delimited. Does not implicitly {@link proto.ClientPayload.DevicePairingRegistrationData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {proto.ClientPayload.IDevicePairingRegistrationData} message DevicePairingRegistrationData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DevicePairingRegistrationData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DevicePairingRegistrationData message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload.DevicePairingRegistrationData} DevicePairingRegistrationData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DevicePairingRegistrationData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload.DevicePairingRegistrationData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.eRegid = reader.bytes(); + break; + case 2: + message.eKeytype = reader.bytes(); + break; + case 3: + message.eIdent = reader.bytes(); + break; + case 4: + message.eSkeyId = reader.bytes(); + break; + case 5: + message.eSkeyVal = reader.bytes(); + break; + case 6: + message.eSkeySig = reader.bytes(); + break; + case 7: + message.buildHash = reader.bytes(); + break; + case 8: + message.deviceProps = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DevicePairingRegistrationData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload.DevicePairingRegistrationData} DevicePairingRegistrationData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DevicePairingRegistrationData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DevicePairingRegistrationData message. + * @function verify + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DevicePairingRegistrationData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.eRegid != null && message.hasOwnProperty("eRegid")) + if (!(message.eRegid && typeof message.eRegid.length === "number" || $util.isString(message.eRegid))) + return "eRegid: buffer expected"; + if (message.eKeytype != null && message.hasOwnProperty("eKeytype")) + if (!(message.eKeytype && typeof message.eKeytype.length === "number" || $util.isString(message.eKeytype))) + return "eKeytype: buffer expected"; + if (message.eIdent != null && message.hasOwnProperty("eIdent")) + if (!(message.eIdent && typeof message.eIdent.length === "number" || $util.isString(message.eIdent))) + return "eIdent: buffer expected"; + if (message.eSkeyId != null && message.hasOwnProperty("eSkeyId")) + if (!(message.eSkeyId && typeof message.eSkeyId.length === "number" || $util.isString(message.eSkeyId))) + return "eSkeyId: buffer expected"; + if (message.eSkeyVal != null && message.hasOwnProperty("eSkeyVal")) + if (!(message.eSkeyVal && typeof message.eSkeyVal.length === "number" || $util.isString(message.eSkeyVal))) + return "eSkeyVal: buffer expected"; + if (message.eSkeySig != null && message.hasOwnProperty("eSkeySig")) + if (!(message.eSkeySig && typeof message.eSkeySig.length === "number" || $util.isString(message.eSkeySig))) + return "eSkeySig: buffer expected"; + if (message.buildHash != null && message.hasOwnProperty("buildHash")) + if (!(message.buildHash && typeof message.buildHash.length === "number" || $util.isString(message.buildHash))) + return "buildHash: buffer expected"; + if (message.deviceProps != null && message.hasOwnProperty("deviceProps")) + if (!(message.deviceProps && typeof message.deviceProps.length === "number" || $util.isString(message.deviceProps))) + return "deviceProps: buffer expected"; + return null; + }; + + /** + * Creates a DevicePairingRegistrationData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload.DevicePairingRegistrationData} DevicePairingRegistrationData + */ + DevicePairingRegistrationData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload.DevicePairingRegistrationData) + return object; + var message = new $root.proto.ClientPayload.DevicePairingRegistrationData(); + if (object.eRegid != null) + if (typeof object.eRegid === "string") + $util.base64.decode(object.eRegid, message.eRegid = $util.newBuffer($util.base64.length(object.eRegid)), 0); + else if (object.eRegid.length) + message.eRegid = object.eRegid; + if (object.eKeytype != null) + if (typeof object.eKeytype === "string") + $util.base64.decode(object.eKeytype, message.eKeytype = $util.newBuffer($util.base64.length(object.eKeytype)), 0); + else if (object.eKeytype.length) + message.eKeytype = object.eKeytype; + if (object.eIdent != null) + if (typeof object.eIdent === "string") + $util.base64.decode(object.eIdent, message.eIdent = $util.newBuffer($util.base64.length(object.eIdent)), 0); + else if (object.eIdent.length) + message.eIdent = object.eIdent; + if (object.eSkeyId != null) + if (typeof object.eSkeyId === "string") + $util.base64.decode(object.eSkeyId, message.eSkeyId = $util.newBuffer($util.base64.length(object.eSkeyId)), 0); + else if (object.eSkeyId.length) + message.eSkeyId = object.eSkeyId; + if (object.eSkeyVal != null) + if (typeof object.eSkeyVal === "string") + $util.base64.decode(object.eSkeyVal, message.eSkeyVal = $util.newBuffer($util.base64.length(object.eSkeyVal)), 0); + else if (object.eSkeyVal.length) + message.eSkeyVal = object.eSkeyVal; + if (object.eSkeySig != null) + if (typeof object.eSkeySig === "string") + $util.base64.decode(object.eSkeySig, message.eSkeySig = $util.newBuffer($util.base64.length(object.eSkeySig)), 0); + else if (object.eSkeySig.length) + message.eSkeySig = object.eSkeySig; + if (object.buildHash != null) + if (typeof object.buildHash === "string") + $util.base64.decode(object.buildHash, message.buildHash = $util.newBuffer($util.base64.length(object.buildHash)), 0); + else if (object.buildHash.length) + message.buildHash = object.buildHash; + if (object.deviceProps != null) + if (typeof object.deviceProps === "string") + $util.base64.decode(object.deviceProps, message.deviceProps = $util.newBuffer($util.base64.length(object.deviceProps)), 0); + else if (object.deviceProps.length) + message.deviceProps = object.deviceProps; + return message; + }; + + /** + * Creates a plain object from a DevicePairingRegistrationData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @static + * @param {proto.ClientPayload.DevicePairingRegistrationData} message DevicePairingRegistrationData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DevicePairingRegistrationData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.eRegid = ""; + else { + object.eRegid = []; + if (options.bytes !== Array) + object.eRegid = $util.newBuffer(object.eRegid); + } + if (options.bytes === String) + object.eKeytype = ""; + else { + object.eKeytype = []; + if (options.bytes !== Array) + object.eKeytype = $util.newBuffer(object.eKeytype); + } + if (options.bytes === String) + object.eIdent = ""; + else { + object.eIdent = []; + if (options.bytes !== Array) + object.eIdent = $util.newBuffer(object.eIdent); + } + if (options.bytes === String) + object.eSkeyId = ""; + else { + object.eSkeyId = []; + if (options.bytes !== Array) + object.eSkeyId = $util.newBuffer(object.eSkeyId); + } + if (options.bytes === String) + object.eSkeyVal = ""; + else { + object.eSkeyVal = []; + if (options.bytes !== Array) + object.eSkeyVal = $util.newBuffer(object.eSkeyVal); + } + if (options.bytes === String) + object.eSkeySig = ""; + else { + object.eSkeySig = []; + if (options.bytes !== Array) + object.eSkeySig = $util.newBuffer(object.eSkeySig); + } + if (options.bytes === String) + object.buildHash = ""; + else { + object.buildHash = []; + if (options.bytes !== Array) + object.buildHash = $util.newBuffer(object.buildHash); + } + if (options.bytes === String) + object.deviceProps = ""; + else { + object.deviceProps = []; + if (options.bytes !== Array) + object.deviceProps = $util.newBuffer(object.deviceProps); + } + } + if (message.eRegid != null && message.hasOwnProperty("eRegid")) + object.eRegid = options.bytes === String ? $util.base64.encode(message.eRegid, 0, message.eRegid.length) : options.bytes === Array ? Array.prototype.slice.call(message.eRegid) : message.eRegid; + if (message.eKeytype != null && message.hasOwnProperty("eKeytype")) + object.eKeytype = options.bytes === String ? $util.base64.encode(message.eKeytype, 0, message.eKeytype.length) : options.bytes === Array ? Array.prototype.slice.call(message.eKeytype) : message.eKeytype; + if (message.eIdent != null && message.hasOwnProperty("eIdent")) + object.eIdent = options.bytes === String ? $util.base64.encode(message.eIdent, 0, message.eIdent.length) : options.bytes === Array ? Array.prototype.slice.call(message.eIdent) : message.eIdent; + if (message.eSkeyId != null && message.hasOwnProperty("eSkeyId")) + object.eSkeyId = options.bytes === String ? $util.base64.encode(message.eSkeyId, 0, message.eSkeyId.length) : options.bytes === Array ? Array.prototype.slice.call(message.eSkeyId) : message.eSkeyId; + if (message.eSkeyVal != null && message.hasOwnProperty("eSkeyVal")) + object.eSkeyVal = options.bytes === String ? $util.base64.encode(message.eSkeyVal, 0, message.eSkeyVal.length) : options.bytes === Array ? Array.prototype.slice.call(message.eSkeyVal) : message.eSkeyVal; + if (message.eSkeySig != null && message.hasOwnProperty("eSkeySig")) + object.eSkeySig = options.bytes === String ? $util.base64.encode(message.eSkeySig, 0, message.eSkeySig.length) : options.bytes === Array ? Array.prototype.slice.call(message.eSkeySig) : message.eSkeySig; + if (message.buildHash != null && message.hasOwnProperty("buildHash")) + object.buildHash = options.bytes === String ? $util.base64.encode(message.buildHash, 0, message.buildHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.buildHash) : message.buildHash; + if (message.deviceProps != null && message.hasOwnProperty("deviceProps")) + object.deviceProps = options.bytes === String ? $util.base64.encode(message.deviceProps, 0, message.deviceProps.length) : options.bytes === Array ? Array.prototype.slice.call(message.deviceProps) : message.deviceProps; + return object; + }; + + /** + * Converts this DevicePairingRegistrationData to JSON. + * @function toJSON + * @memberof proto.ClientPayload.DevicePairingRegistrationData + * @instance + * @returns {Object.} JSON object + */ + DevicePairingRegistrationData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DevicePairingRegistrationData; + })(); + + /** + * IOSAppExtension enum. + * @name proto.ClientPayload.IOSAppExtension + * @enum {number} + * @property {number} SHARE_EXTENSION=0 SHARE_EXTENSION value + * @property {number} SERVICE_EXTENSION=1 SERVICE_EXTENSION value + * @property {number} INTENTS_EXTENSION=2 INTENTS_EXTENSION value + */ + ClientPayload.IOSAppExtension = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SHARE_EXTENSION"] = 0; + values[valuesById[1] = "SERVICE_EXTENSION"] = 1; + values[valuesById[2] = "INTENTS_EXTENSION"] = 2; + return values; + })(); + + /** + * Product enum. + * @name proto.ClientPayload.Product + * @enum {number} + * @property {number} WHATSAPP=0 WHATSAPP value + * @property {number} MESSENGER=1 MESSENGER value + */ + ClientPayload.Product = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WHATSAPP"] = 0; + values[valuesById[1] = "MESSENGER"] = 1; + return values; + })(); + + ClientPayload.UserAgent = (function() { + + /** + * Properties of a UserAgent. + * @memberof proto.ClientPayload + * @interface IUserAgent + * @property {proto.ClientPayload.UserAgent.Platform|null} [platform] UserAgent platform + * @property {proto.ClientPayload.UserAgent.IAppVersion|null} [appVersion] UserAgent appVersion + * @property {string|null} [mcc] UserAgent mcc + * @property {string|null} [mnc] UserAgent mnc + * @property {string|null} [osVersion] UserAgent osVersion + * @property {string|null} [manufacturer] UserAgent manufacturer + * @property {string|null} [device] UserAgent device + * @property {string|null} [osBuildNumber] UserAgent osBuildNumber + * @property {string|null} [phoneId] UserAgent phoneId + * @property {proto.ClientPayload.UserAgent.ReleaseChannel|null} [releaseChannel] UserAgent releaseChannel + * @property {string|null} [localeLanguageIso6391] UserAgent localeLanguageIso6391 + * @property {string|null} [localeCountryIso31661Alpha2] UserAgent localeCountryIso31661Alpha2 + * @property {string|null} [deviceBoard] UserAgent deviceBoard + */ + + /** + * Constructs a new UserAgent. + * @memberof proto.ClientPayload + * @classdesc Represents a UserAgent. + * @implements IUserAgent + * @constructor + * @param {proto.ClientPayload.IUserAgent=} [properties] Properties to set + */ + function UserAgent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserAgent platform. + * @member {proto.ClientPayload.UserAgent.Platform} platform + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.platform = 0; + + /** + * UserAgent appVersion. + * @member {proto.ClientPayload.UserAgent.IAppVersion|null|undefined} appVersion + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.appVersion = null; + + /** + * UserAgent mcc. + * @member {string} mcc + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.mcc = ""; + + /** + * UserAgent mnc. + * @member {string} mnc + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.mnc = ""; + + /** + * UserAgent osVersion. + * @member {string} osVersion + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.osVersion = ""; + + /** + * UserAgent manufacturer. + * @member {string} manufacturer + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.manufacturer = ""; + + /** + * UserAgent device. + * @member {string} device + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.device = ""; + + /** + * UserAgent osBuildNumber. + * @member {string} osBuildNumber + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.osBuildNumber = ""; + + /** + * UserAgent phoneId. + * @member {string} phoneId + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.phoneId = ""; + + /** + * UserAgent releaseChannel. + * @member {proto.ClientPayload.UserAgent.ReleaseChannel} releaseChannel + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.releaseChannel = 0; + + /** + * UserAgent localeLanguageIso6391. + * @member {string} localeLanguageIso6391 + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.localeLanguageIso6391 = ""; + + /** + * UserAgent localeCountryIso31661Alpha2. + * @member {string} localeCountryIso31661Alpha2 + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.localeCountryIso31661Alpha2 = ""; + + /** + * UserAgent deviceBoard. + * @member {string} deviceBoard + * @memberof proto.ClientPayload.UserAgent + * @instance + */ + UserAgent.prototype.deviceBoard = ""; + + /** + * Creates a new UserAgent instance using the specified properties. + * @function create + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {proto.ClientPayload.IUserAgent=} [properties] Properties to set + * @returns {proto.ClientPayload.UserAgent} UserAgent instance + */ + UserAgent.create = function create(properties) { + return new UserAgent(properties); + }; + + /** + * Encodes the specified UserAgent message. Does not implicitly {@link proto.ClientPayload.UserAgent.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {proto.ClientPayload.IUserAgent} message UserAgent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserAgent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.platform != null && Object.hasOwnProperty.call(message, "platform")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.platform); + if (message.appVersion != null && Object.hasOwnProperty.call(message, "appVersion")) + $root.proto.ClientPayload.UserAgent.AppVersion.encode(message.appVersion, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mcc != null && Object.hasOwnProperty.call(message, "mcc")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mcc); + if (message.mnc != null && Object.hasOwnProperty.call(message, "mnc")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mnc); + if (message.osVersion != null && Object.hasOwnProperty.call(message, "osVersion")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.osVersion); + if (message.manufacturer != null && Object.hasOwnProperty.call(message, "manufacturer")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.manufacturer); + if (message.device != null && Object.hasOwnProperty.call(message, "device")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.device); + if (message.osBuildNumber != null && Object.hasOwnProperty.call(message, "osBuildNumber")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.osBuildNumber); + if (message.phoneId != null && Object.hasOwnProperty.call(message, "phoneId")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.phoneId); + if (message.releaseChannel != null && Object.hasOwnProperty.call(message, "releaseChannel")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.releaseChannel); + if (message.localeLanguageIso6391 != null && Object.hasOwnProperty.call(message, "localeLanguageIso6391")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.localeLanguageIso6391); + if (message.localeCountryIso31661Alpha2 != null && Object.hasOwnProperty.call(message, "localeCountryIso31661Alpha2")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.localeCountryIso31661Alpha2); + if (message.deviceBoard != null && Object.hasOwnProperty.call(message, "deviceBoard")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.deviceBoard); + return writer; + }; + + /** + * Encodes the specified UserAgent message, length delimited. Does not implicitly {@link proto.ClientPayload.UserAgent.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {proto.ClientPayload.IUserAgent} message UserAgent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserAgent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserAgent message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload.UserAgent} UserAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserAgent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload.UserAgent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.platform = reader.int32(); + break; + case 2: + message.appVersion = $root.proto.ClientPayload.UserAgent.AppVersion.decode(reader, reader.uint32()); + break; + case 3: + message.mcc = reader.string(); + break; + case 4: + message.mnc = reader.string(); + break; + case 5: + message.osVersion = reader.string(); + break; + case 6: + message.manufacturer = reader.string(); + break; + case 7: + message.device = reader.string(); + break; + case 8: + message.osBuildNumber = reader.string(); + break; + case 9: + message.phoneId = reader.string(); + break; + case 10: + message.releaseChannel = reader.int32(); + break; + case 11: + message.localeLanguageIso6391 = reader.string(); + break; + case 12: + message.localeCountryIso31661Alpha2 = reader.string(); + break; + case 13: + message.deviceBoard = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserAgent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload.UserAgent} UserAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserAgent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserAgent message. + * @function verify + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserAgent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.platform != null && message.hasOwnProperty("platform")) + switch (message.platform) { + default: + return "platform: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + break; + } + if (message.appVersion != null && message.hasOwnProperty("appVersion")) { + var error = $root.proto.ClientPayload.UserAgent.AppVersion.verify(message.appVersion); + if (error) + return "appVersion." + error; + } + if (message.mcc != null && message.hasOwnProperty("mcc")) + if (!$util.isString(message.mcc)) + return "mcc: string expected"; + if (message.mnc != null && message.hasOwnProperty("mnc")) + if (!$util.isString(message.mnc)) + return "mnc: string expected"; + if (message.osVersion != null && message.hasOwnProperty("osVersion")) + if (!$util.isString(message.osVersion)) + return "osVersion: string expected"; + if (message.manufacturer != null && message.hasOwnProperty("manufacturer")) + if (!$util.isString(message.manufacturer)) + return "manufacturer: string expected"; + if (message.device != null && message.hasOwnProperty("device")) + if (!$util.isString(message.device)) + return "device: string expected"; + if (message.osBuildNumber != null && message.hasOwnProperty("osBuildNumber")) + if (!$util.isString(message.osBuildNumber)) + return "osBuildNumber: string expected"; + if (message.phoneId != null && message.hasOwnProperty("phoneId")) + if (!$util.isString(message.phoneId)) + return "phoneId: string expected"; + if (message.releaseChannel != null && message.hasOwnProperty("releaseChannel")) + switch (message.releaseChannel) { + default: + return "releaseChannel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.localeLanguageIso6391 != null && message.hasOwnProperty("localeLanguageIso6391")) + if (!$util.isString(message.localeLanguageIso6391)) + return "localeLanguageIso6391: string expected"; + if (message.localeCountryIso31661Alpha2 != null && message.hasOwnProperty("localeCountryIso31661Alpha2")) + if (!$util.isString(message.localeCountryIso31661Alpha2)) + return "localeCountryIso31661Alpha2: string expected"; + if (message.deviceBoard != null && message.hasOwnProperty("deviceBoard")) + if (!$util.isString(message.deviceBoard)) + return "deviceBoard: string expected"; + return null; + }; + + /** + * Creates a UserAgent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload.UserAgent} UserAgent + */ + UserAgent.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload.UserAgent) + return object; + var message = new $root.proto.ClientPayload.UserAgent(); + switch (object.platform) { + case "ANDROID": + case 0: + message.platform = 0; + break; + case "IOS": + case 1: + message.platform = 1; + break; + case "WINDOWS_PHONE": + case 2: + message.platform = 2; + break; + case "BLACKBERRY": + case 3: + message.platform = 3; + break; + case "BLACKBERRYX": + case 4: + message.platform = 4; + break; + case "S40": + case 5: + message.platform = 5; + break; + case "S60": + case 6: + message.platform = 6; + break; + case "PYTHON_CLIENT": + case 7: + message.platform = 7; + break; + case "TIZEN": + case 8: + message.platform = 8; + break; + case "ENTERPRISE": + case 9: + message.platform = 9; + break; + case "SMB_ANDROID": + case 10: + message.platform = 10; + break; + case "KAIOS": + case 11: + message.platform = 11; + break; + case "SMB_IOS": + case 12: + message.platform = 12; + break; + case "WINDOWS": + case 13: + message.platform = 13; + break; + case "WEB": + case 14: + message.platform = 14; + break; + case "PORTAL": + case 15: + message.platform = 15; + break; + case "GREEN_ANDROID": + case 16: + message.platform = 16; + break; + case "GREEN_IPHONE": + case 17: + message.platform = 17; + break; + case "BLUE_ANDROID": + case 18: + message.platform = 18; + break; + case "BLUE_IPHONE": + case 19: + message.platform = 19; + break; + case "FBLITE_ANDROID": + case 20: + message.platform = 20; + break; + case "MLITE_ANDROID": + case 21: + message.platform = 21; + break; + case "IGLITE_ANDROID": + case 22: + message.platform = 22; + break; + case "PAGE": + case 23: + message.platform = 23; + break; + case "MACOS": + case 24: + message.platform = 24; + break; + case "OCULUS_MSG": + case 25: + message.platform = 25; + break; + case "OCULUS_CALL": + case 26: + message.platform = 26; + break; + case "MILAN": + case 27: + message.platform = 27; + break; + case "CAPI": + case 28: + message.platform = 28; + break; + case "WEAROS": + case 29: + message.platform = 29; + break; + case "ARDEVICE": + case 30: + message.platform = 30; + break; + case "VRDEVICE": + case 31: + message.platform = 31; + break; + case "BLUE_WEB": + case 32: + message.platform = 32; + break; + } + if (object.appVersion != null) { + if (typeof object.appVersion !== "object") + throw TypeError(".proto.ClientPayload.UserAgent.appVersion: object expected"); + message.appVersion = $root.proto.ClientPayload.UserAgent.AppVersion.fromObject(object.appVersion); + } + if (object.mcc != null) + message.mcc = String(object.mcc); + if (object.mnc != null) + message.mnc = String(object.mnc); + if (object.osVersion != null) + message.osVersion = String(object.osVersion); + if (object.manufacturer != null) + message.manufacturer = String(object.manufacturer); + if (object.device != null) + message.device = String(object.device); + if (object.osBuildNumber != null) + message.osBuildNumber = String(object.osBuildNumber); + if (object.phoneId != null) + message.phoneId = String(object.phoneId); + switch (object.releaseChannel) { + case "RELEASE": + case 0: + message.releaseChannel = 0; + break; + case "BETA": + case 1: + message.releaseChannel = 1; + break; + case "ALPHA": + case 2: + message.releaseChannel = 2; + break; + case "DEBUG": + case 3: + message.releaseChannel = 3; + break; + } + if (object.localeLanguageIso6391 != null) + message.localeLanguageIso6391 = String(object.localeLanguageIso6391); + if (object.localeCountryIso31661Alpha2 != null) + message.localeCountryIso31661Alpha2 = String(object.localeCountryIso31661Alpha2); + if (object.deviceBoard != null) + message.deviceBoard = String(object.deviceBoard); + return message; + }; + + /** + * Creates a plain object from a UserAgent message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload.UserAgent + * @static + * @param {proto.ClientPayload.UserAgent} message UserAgent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserAgent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.platform = options.enums === String ? "ANDROID" : 0; + object.appVersion = null; + object.mcc = ""; + object.mnc = ""; + object.osVersion = ""; + object.manufacturer = ""; + object.device = ""; + object.osBuildNumber = ""; + object.phoneId = ""; + object.releaseChannel = options.enums === String ? "RELEASE" : 0; + object.localeLanguageIso6391 = ""; + object.localeCountryIso31661Alpha2 = ""; + object.deviceBoard = ""; + } + if (message.platform != null && message.hasOwnProperty("platform")) + object.platform = options.enums === String ? $root.proto.ClientPayload.UserAgent.Platform[message.platform] : message.platform; + if (message.appVersion != null && message.hasOwnProperty("appVersion")) + object.appVersion = $root.proto.ClientPayload.UserAgent.AppVersion.toObject(message.appVersion, options); + if (message.mcc != null && message.hasOwnProperty("mcc")) + object.mcc = message.mcc; + if (message.mnc != null && message.hasOwnProperty("mnc")) + object.mnc = message.mnc; + if (message.osVersion != null && message.hasOwnProperty("osVersion")) + object.osVersion = message.osVersion; + if (message.manufacturer != null && message.hasOwnProperty("manufacturer")) + object.manufacturer = message.manufacturer; + if (message.device != null && message.hasOwnProperty("device")) + object.device = message.device; + if (message.osBuildNumber != null && message.hasOwnProperty("osBuildNumber")) + object.osBuildNumber = message.osBuildNumber; + if (message.phoneId != null && message.hasOwnProperty("phoneId")) + object.phoneId = message.phoneId; + if (message.releaseChannel != null && message.hasOwnProperty("releaseChannel")) + object.releaseChannel = options.enums === String ? $root.proto.ClientPayload.UserAgent.ReleaseChannel[message.releaseChannel] : message.releaseChannel; + if (message.localeLanguageIso6391 != null && message.hasOwnProperty("localeLanguageIso6391")) + object.localeLanguageIso6391 = message.localeLanguageIso6391; + if (message.localeCountryIso31661Alpha2 != null && message.hasOwnProperty("localeCountryIso31661Alpha2")) + object.localeCountryIso31661Alpha2 = message.localeCountryIso31661Alpha2; + if (message.deviceBoard != null && message.hasOwnProperty("deviceBoard")) + object.deviceBoard = message.deviceBoard; + return object; + }; + + /** + * Converts this UserAgent to JSON. + * @function toJSON + * @memberof proto.ClientPayload.UserAgent + * @instance + * @returns {Object.} JSON object + */ + UserAgent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + UserAgent.AppVersion = (function() { + + /** + * Properties of an AppVersion. + * @memberof proto.ClientPayload.UserAgent + * @interface IAppVersion + * @property {number|null} [primary] AppVersion primary + * @property {number|null} [secondary] AppVersion secondary + * @property {number|null} [tertiary] AppVersion tertiary + * @property {number|null} [quaternary] AppVersion quaternary + * @property {number|null} [quinary] AppVersion quinary + */ + + /** + * Constructs a new AppVersion. + * @memberof proto.ClientPayload.UserAgent + * @classdesc Represents an AppVersion. + * @implements IAppVersion + * @constructor + * @param {proto.ClientPayload.UserAgent.IAppVersion=} [properties] Properties to set + */ + function AppVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppVersion primary. + * @member {number} primary + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @instance + */ + AppVersion.prototype.primary = 0; + + /** + * AppVersion secondary. + * @member {number} secondary + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @instance + */ + AppVersion.prototype.secondary = 0; + + /** + * AppVersion tertiary. + * @member {number} tertiary + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @instance + */ + AppVersion.prototype.tertiary = 0; + + /** + * AppVersion quaternary. + * @member {number} quaternary + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @instance + */ + AppVersion.prototype.quaternary = 0; + + /** + * AppVersion quinary. + * @member {number} quinary + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @instance + */ + AppVersion.prototype.quinary = 0; + + /** + * Creates a new AppVersion instance using the specified properties. + * @function create + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {proto.ClientPayload.UserAgent.IAppVersion=} [properties] Properties to set + * @returns {proto.ClientPayload.UserAgent.AppVersion} AppVersion instance + */ + AppVersion.create = function create(properties) { + return new AppVersion(properties); + }; + + /** + * Encodes the specified AppVersion message. Does not implicitly {@link proto.ClientPayload.UserAgent.AppVersion.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {proto.ClientPayload.UserAgent.IAppVersion} message AppVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.primary != null && Object.hasOwnProperty.call(message, "primary")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.primary); + if (message.secondary != null && Object.hasOwnProperty.call(message, "secondary")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.secondary); + if (message.tertiary != null && Object.hasOwnProperty.call(message, "tertiary")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.tertiary); + if (message.quaternary != null && Object.hasOwnProperty.call(message, "quaternary")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.quaternary); + if (message.quinary != null && Object.hasOwnProperty.call(message, "quinary")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.quinary); + return writer; + }; + + /** + * Encodes the specified AppVersion message, length delimited. Does not implicitly {@link proto.ClientPayload.UserAgent.AppVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {proto.ClientPayload.UserAgent.IAppVersion} message AppVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppVersion message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload.UserAgent.AppVersion} AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload.UserAgent.AppVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.primary = reader.uint32(); + break; + case 2: + message.secondary = reader.uint32(); + break; + case 3: + message.tertiary = reader.uint32(); + break; + case 4: + message.quaternary = reader.uint32(); + break; + case 5: + message.quinary = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload.UserAgent.AppVersion} AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppVersion message. + * @function verify + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.primary != null && message.hasOwnProperty("primary")) + if (!$util.isInteger(message.primary)) + return "primary: integer expected"; + if (message.secondary != null && message.hasOwnProperty("secondary")) + if (!$util.isInteger(message.secondary)) + return "secondary: integer expected"; + if (message.tertiary != null && message.hasOwnProperty("tertiary")) + if (!$util.isInteger(message.tertiary)) + return "tertiary: integer expected"; + if (message.quaternary != null && message.hasOwnProperty("quaternary")) + if (!$util.isInteger(message.quaternary)) + return "quaternary: integer expected"; + if (message.quinary != null && message.hasOwnProperty("quinary")) + if (!$util.isInteger(message.quinary)) + return "quinary: integer expected"; + return null; + }; + + /** + * Creates an AppVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload.UserAgent.AppVersion} AppVersion + */ + AppVersion.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload.UserAgent.AppVersion) + return object; + var message = new $root.proto.ClientPayload.UserAgent.AppVersion(); + if (object.primary != null) + message.primary = object.primary >>> 0; + if (object.secondary != null) + message.secondary = object.secondary >>> 0; + if (object.tertiary != null) + message.tertiary = object.tertiary >>> 0; + if (object.quaternary != null) + message.quaternary = object.quaternary >>> 0; + if (object.quinary != null) + message.quinary = object.quinary >>> 0; + return message; + }; + + /** + * Creates a plain object from an AppVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @static + * @param {proto.ClientPayload.UserAgent.AppVersion} message AppVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.primary = 0; + object.secondary = 0; + object.tertiary = 0; + object.quaternary = 0; + object.quinary = 0; + } + if (message.primary != null && message.hasOwnProperty("primary")) + object.primary = message.primary; + if (message.secondary != null && message.hasOwnProperty("secondary")) + object.secondary = message.secondary; + if (message.tertiary != null && message.hasOwnProperty("tertiary")) + object.tertiary = message.tertiary; + if (message.quaternary != null && message.hasOwnProperty("quaternary")) + object.quaternary = message.quaternary; + if (message.quinary != null && message.hasOwnProperty("quinary")) + object.quinary = message.quinary; + return object; + }; + + /** + * Converts this AppVersion to JSON. + * @function toJSON + * @memberof proto.ClientPayload.UserAgent.AppVersion + * @instance + * @returns {Object.} JSON object + */ + AppVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppVersion; + })(); + + /** + * Platform enum. + * @name proto.ClientPayload.UserAgent.Platform + * @enum {number} + * @property {number} ANDROID=0 ANDROID value + * @property {number} IOS=1 IOS value + * @property {number} WINDOWS_PHONE=2 WINDOWS_PHONE value + * @property {number} BLACKBERRY=3 BLACKBERRY value + * @property {number} BLACKBERRYX=4 BLACKBERRYX value + * @property {number} S40=5 S40 value + * @property {number} S60=6 S60 value + * @property {number} PYTHON_CLIENT=7 PYTHON_CLIENT value + * @property {number} TIZEN=8 TIZEN value + * @property {number} ENTERPRISE=9 ENTERPRISE value + * @property {number} SMB_ANDROID=10 SMB_ANDROID value + * @property {number} KAIOS=11 KAIOS value + * @property {number} SMB_IOS=12 SMB_IOS value + * @property {number} WINDOWS=13 WINDOWS value + * @property {number} WEB=14 WEB value + * @property {number} PORTAL=15 PORTAL value + * @property {number} GREEN_ANDROID=16 GREEN_ANDROID value + * @property {number} GREEN_IPHONE=17 GREEN_IPHONE value + * @property {number} BLUE_ANDROID=18 BLUE_ANDROID value + * @property {number} BLUE_IPHONE=19 BLUE_IPHONE value + * @property {number} FBLITE_ANDROID=20 FBLITE_ANDROID value + * @property {number} MLITE_ANDROID=21 MLITE_ANDROID value + * @property {number} IGLITE_ANDROID=22 IGLITE_ANDROID value + * @property {number} PAGE=23 PAGE value + * @property {number} MACOS=24 MACOS value + * @property {number} OCULUS_MSG=25 OCULUS_MSG value + * @property {number} OCULUS_CALL=26 OCULUS_CALL value + * @property {number} MILAN=27 MILAN value + * @property {number} CAPI=28 CAPI value + * @property {number} WEAROS=29 WEAROS value + * @property {number} ARDEVICE=30 ARDEVICE value + * @property {number} VRDEVICE=31 VRDEVICE value + * @property {number} BLUE_WEB=32 BLUE_WEB value + */ + UserAgent.Platform = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANDROID"] = 0; + values[valuesById[1] = "IOS"] = 1; + values[valuesById[2] = "WINDOWS_PHONE"] = 2; + values[valuesById[3] = "BLACKBERRY"] = 3; + values[valuesById[4] = "BLACKBERRYX"] = 4; + values[valuesById[5] = "S40"] = 5; + values[valuesById[6] = "S60"] = 6; + values[valuesById[7] = "PYTHON_CLIENT"] = 7; + values[valuesById[8] = "TIZEN"] = 8; + values[valuesById[9] = "ENTERPRISE"] = 9; + values[valuesById[10] = "SMB_ANDROID"] = 10; + values[valuesById[11] = "KAIOS"] = 11; + values[valuesById[12] = "SMB_IOS"] = 12; + values[valuesById[13] = "WINDOWS"] = 13; + values[valuesById[14] = "WEB"] = 14; + values[valuesById[15] = "PORTAL"] = 15; + values[valuesById[16] = "GREEN_ANDROID"] = 16; + values[valuesById[17] = "GREEN_IPHONE"] = 17; + values[valuesById[18] = "BLUE_ANDROID"] = 18; + values[valuesById[19] = "BLUE_IPHONE"] = 19; + values[valuesById[20] = "FBLITE_ANDROID"] = 20; + values[valuesById[21] = "MLITE_ANDROID"] = 21; + values[valuesById[22] = "IGLITE_ANDROID"] = 22; + values[valuesById[23] = "PAGE"] = 23; + values[valuesById[24] = "MACOS"] = 24; + values[valuesById[25] = "OCULUS_MSG"] = 25; + values[valuesById[26] = "OCULUS_CALL"] = 26; + values[valuesById[27] = "MILAN"] = 27; + values[valuesById[28] = "CAPI"] = 28; + values[valuesById[29] = "WEAROS"] = 29; + values[valuesById[30] = "ARDEVICE"] = 30; + values[valuesById[31] = "VRDEVICE"] = 31; + values[valuesById[32] = "BLUE_WEB"] = 32; + return values; + })(); + + /** + * ReleaseChannel enum. + * @name proto.ClientPayload.UserAgent.ReleaseChannel + * @enum {number} + * @property {number} RELEASE=0 RELEASE value + * @property {number} BETA=1 BETA value + * @property {number} ALPHA=2 ALPHA value + * @property {number} DEBUG=3 DEBUG value + */ + UserAgent.ReleaseChannel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RELEASE"] = 0; + values[valuesById[1] = "BETA"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "DEBUG"] = 3; + return values; + })(); + + return UserAgent; + })(); + + ClientPayload.WebInfo = (function() { + + /** + * Properties of a WebInfo. + * @memberof proto.ClientPayload + * @interface IWebInfo + * @property {string|null} [refToken] WebInfo refToken + * @property {string|null} [version] WebInfo version + * @property {proto.ClientPayload.WebInfo.IWebdPayload|null} [webdPayload] WebInfo webdPayload + * @property {proto.ClientPayload.WebInfo.WebSubPlatform|null} [webSubPlatform] WebInfo webSubPlatform + */ + + /** + * Constructs a new WebInfo. + * @memberof proto.ClientPayload + * @classdesc Represents a WebInfo. + * @implements IWebInfo + * @constructor + * @param {proto.ClientPayload.IWebInfo=} [properties] Properties to set + */ + function WebInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebInfo refToken. + * @member {string} refToken + * @memberof proto.ClientPayload.WebInfo + * @instance + */ + WebInfo.prototype.refToken = ""; + + /** + * WebInfo version. + * @member {string} version + * @memberof proto.ClientPayload.WebInfo + * @instance + */ + WebInfo.prototype.version = ""; + + /** + * WebInfo webdPayload. + * @member {proto.ClientPayload.WebInfo.IWebdPayload|null|undefined} webdPayload + * @memberof proto.ClientPayload.WebInfo + * @instance + */ + WebInfo.prototype.webdPayload = null; + + /** + * WebInfo webSubPlatform. + * @member {proto.ClientPayload.WebInfo.WebSubPlatform} webSubPlatform + * @memberof proto.ClientPayload.WebInfo + * @instance + */ + WebInfo.prototype.webSubPlatform = 0; + + /** + * Creates a new WebInfo instance using the specified properties. + * @function create + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {proto.ClientPayload.IWebInfo=} [properties] Properties to set + * @returns {proto.ClientPayload.WebInfo} WebInfo instance + */ + WebInfo.create = function create(properties) { + return new WebInfo(properties); + }; + + /** + * Encodes the specified WebInfo message. Does not implicitly {@link proto.ClientPayload.WebInfo.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {proto.ClientPayload.IWebInfo} message WebInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.refToken != null && Object.hasOwnProperty.call(message, "refToken")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.refToken); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + if (message.webdPayload != null && Object.hasOwnProperty.call(message, "webdPayload")) + $root.proto.ClientPayload.WebInfo.WebdPayload.encode(message.webdPayload, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.webSubPlatform != null && Object.hasOwnProperty.call(message, "webSubPlatform")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.webSubPlatform); + return writer; + }; + + /** + * Encodes the specified WebInfo message, length delimited. Does not implicitly {@link proto.ClientPayload.WebInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {proto.ClientPayload.IWebInfo} message WebInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload.WebInfo} WebInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload.WebInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.refToken = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.webdPayload = $root.proto.ClientPayload.WebInfo.WebdPayload.decode(reader, reader.uint32()); + break; + case 4: + message.webSubPlatform = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload.WebInfo} WebInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebInfo message. + * @function verify + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.refToken != null && message.hasOwnProperty("refToken")) + if (!$util.isString(message.refToken)) + return "refToken: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.webdPayload != null && message.hasOwnProperty("webdPayload")) { + var error = $root.proto.ClientPayload.WebInfo.WebdPayload.verify(message.webdPayload); + if (error) + return "webdPayload." + error; + } + if (message.webSubPlatform != null && message.hasOwnProperty("webSubPlatform")) + switch (message.webSubPlatform) { + default: + return "webSubPlatform: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a WebInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload.WebInfo} WebInfo + */ + WebInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload.WebInfo) + return object; + var message = new $root.proto.ClientPayload.WebInfo(); + if (object.refToken != null) + message.refToken = String(object.refToken); + if (object.version != null) + message.version = String(object.version); + if (object.webdPayload != null) { + if (typeof object.webdPayload !== "object") + throw TypeError(".proto.ClientPayload.WebInfo.webdPayload: object expected"); + message.webdPayload = $root.proto.ClientPayload.WebInfo.WebdPayload.fromObject(object.webdPayload); + } + switch (object.webSubPlatform) { + case "WEB_BROWSER": + case 0: + message.webSubPlatform = 0; + break; + case "APP_STORE": + case 1: + message.webSubPlatform = 1; + break; + case "WIN_STORE": + case 2: + message.webSubPlatform = 2; + break; + case "DARWIN": + case 3: + message.webSubPlatform = 3; + break; + case "WIN32": + case 4: + message.webSubPlatform = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a WebInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload.WebInfo + * @static + * @param {proto.ClientPayload.WebInfo} message WebInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.refToken = ""; + object.version = ""; + object.webdPayload = null; + object.webSubPlatform = options.enums === String ? "WEB_BROWSER" : 0; + } + if (message.refToken != null && message.hasOwnProperty("refToken")) + object.refToken = message.refToken; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.webdPayload != null && message.hasOwnProperty("webdPayload")) + object.webdPayload = $root.proto.ClientPayload.WebInfo.WebdPayload.toObject(message.webdPayload, options); + if (message.webSubPlatform != null && message.hasOwnProperty("webSubPlatform")) + object.webSubPlatform = options.enums === String ? $root.proto.ClientPayload.WebInfo.WebSubPlatform[message.webSubPlatform] : message.webSubPlatform; + return object; + }; + + /** + * Converts this WebInfo to JSON. + * @function toJSON + * @memberof proto.ClientPayload.WebInfo + * @instance + * @returns {Object.} JSON object + */ + WebInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * WebSubPlatform enum. + * @name proto.ClientPayload.WebInfo.WebSubPlatform + * @enum {number} + * @property {number} WEB_BROWSER=0 WEB_BROWSER value + * @property {number} APP_STORE=1 APP_STORE value + * @property {number} WIN_STORE=2 WIN_STORE value + * @property {number} DARWIN=3 DARWIN value + * @property {number} WIN32=4 WIN32 value + */ + WebInfo.WebSubPlatform = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WEB_BROWSER"] = 0; + values[valuesById[1] = "APP_STORE"] = 1; + values[valuesById[2] = "WIN_STORE"] = 2; + values[valuesById[3] = "DARWIN"] = 3; + values[valuesById[4] = "WIN32"] = 4; + return values; + })(); + + WebInfo.WebdPayload = (function() { + + /** + * Properties of a WebdPayload. + * @memberof proto.ClientPayload.WebInfo + * @interface IWebdPayload + * @property {boolean|null} [usesParticipantInKey] WebdPayload usesParticipantInKey + * @property {boolean|null} [supportsStarredMessages] WebdPayload supportsStarredMessages + * @property {boolean|null} [supportsDocumentMessages] WebdPayload supportsDocumentMessages + * @property {boolean|null} [supportsUrlMessages] WebdPayload supportsUrlMessages + * @property {boolean|null} [supportsMediaRetry] WebdPayload supportsMediaRetry + * @property {boolean|null} [supportsE2EImage] WebdPayload supportsE2EImage + * @property {boolean|null} [supportsE2EVideo] WebdPayload supportsE2EVideo + * @property {boolean|null} [supportsE2EAudio] WebdPayload supportsE2EAudio + * @property {boolean|null} [supportsE2EDocument] WebdPayload supportsE2EDocument + * @property {string|null} [documentTypes] WebdPayload documentTypes + * @property {Uint8Array|null} [features] WebdPayload features + */ + + /** + * Constructs a new WebdPayload. + * @memberof proto.ClientPayload.WebInfo + * @classdesc Represents a WebdPayload. + * @implements IWebdPayload + * @constructor + * @param {proto.ClientPayload.WebInfo.IWebdPayload=} [properties] Properties to set + */ + function WebdPayload(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebdPayload usesParticipantInKey. + * @member {boolean} usesParticipantInKey + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.usesParticipantInKey = false; + + /** + * WebdPayload supportsStarredMessages. + * @member {boolean} supportsStarredMessages + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsStarredMessages = false; + + /** + * WebdPayload supportsDocumentMessages. + * @member {boolean} supportsDocumentMessages + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsDocumentMessages = false; + + /** + * WebdPayload supportsUrlMessages. + * @member {boolean} supportsUrlMessages + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsUrlMessages = false; + + /** + * WebdPayload supportsMediaRetry. + * @member {boolean} supportsMediaRetry + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsMediaRetry = false; + + /** + * WebdPayload supportsE2EImage. + * @member {boolean} supportsE2EImage + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsE2EImage = false; + + /** + * WebdPayload supportsE2EVideo. + * @member {boolean} supportsE2EVideo + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsE2EVideo = false; + + /** + * WebdPayload supportsE2EAudio. + * @member {boolean} supportsE2EAudio + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsE2EAudio = false; + + /** + * WebdPayload supportsE2EDocument. + * @member {boolean} supportsE2EDocument + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.supportsE2EDocument = false; + + /** + * WebdPayload documentTypes. + * @member {string} documentTypes + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.documentTypes = ""; + + /** + * WebdPayload features. + * @member {Uint8Array} features + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + */ + WebdPayload.prototype.features = $util.newBuffer([]); + + /** + * Creates a new WebdPayload instance using the specified properties. + * @function create + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {proto.ClientPayload.WebInfo.IWebdPayload=} [properties] Properties to set + * @returns {proto.ClientPayload.WebInfo.WebdPayload} WebdPayload instance + */ + WebdPayload.create = function create(properties) { + return new WebdPayload(properties); + }; + + /** + * Encodes the specified WebdPayload message. Does not implicitly {@link proto.ClientPayload.WebInfo.WebdPayload.verify|verify} messages. + * @function encode + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {proto.ClientPayload.WebInfo.IWebdPayload} message WebdPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebdPayload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.usesParticipantInKey != null && Object.hasOwnProperty.call(message, "usesParticipantInKey")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.usesParticipantInKey); + if (message.supportsStarredMessages != null && Object.hasOwnProperty.call(message, "supportsStarredMessages")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.supportsStarredMessages); + if (message.supportsDocumentMessages != null && Object.hasOwnProperty.call(message, "supportsDocumentMessages")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.supportsDocumentMessages); + if (message.supportsUrlMessages != null && Object.hasOwnProperty.call(message, "supportsUrlMessages")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.supportsUrlMessages); + if (message.supportsMediaRetry != null && Object.hasOwnProperty.call(message, "supportsMediaRetry")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.supportsMediaRetry); + if (message.supportsE2EImage != null && Object.hasOwnProperty.call(message, "supportsE2EImage")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.supportsE2EImage); + if (message.supportsE2EVideo != null && Object.hasOwnProperty.call(message, "supportsE2EVideo")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.supportsE2EVideo); + if (message.supportsE2EAudio != null && Object.hasOwnProperty.call(message, "supportsE2EAudio")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.supportsE2EAudio); + if (message.supportsE2EDocument != null && Object.hasOwnProperty.call(message, "supportsE2EDocument")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.supportsE2EDocument); + if (message.documentTypes != null && Object.hasOwnProperty.call(message, "documentTypes")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.documentTypes); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + writer.uint32(/* id 11, wireType 2 =*/90).bytes(message.features); + return writer; + }; + + /** + * Encodes the specified WebdPayload message, length delimited. Does not implicitly {@link proto.ClientPayload.WebInfo.WebdPayload.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {proto.ClientPayload.WebInfo.IWebdPayload} message WebdPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebdPayload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebdPayload message from the specified reader or buffer. + * @function decode + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ClientPayload.WebInfo.WebdPayload} WebdPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebdPayload.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ClientPayload.WebInfo.WebdPayload(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.usesParticipantInKey = reader.bool(); + break; + case 2: + message.supportsStarredMessages = reader.bool(); + break; + case 3: + message.supportsDocumentMessages = reader.bool(); + break; + case 4: + message.supportsUrlMessages = reader.bool(); + break; + case 5: + message.supportsMediaRetry = reader.bool(); + break; + case 6: + message.supportsE2EImage = reader.bool(); + break; + case 7: + message.supportsE2EVideo = reader.bool(); + break; + case 8: + message.supportsE2EAudio = reader.bool(); + break; + case 9: + message.supportsE2EDocument = reader.bool(); + break; + case 10: + message.documentTypes = reader.string(); + break; + case 11: + message.features = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebdPayload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ClientPayload.WebInfo.WebdPayload} WebdPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebdPayload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebdPayload message. + * @function verify + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebdPayload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.usesParticipantInKey != null && message.hasOwnProperty("usesParticipantInKey")) + if (typeof message.usesParticipantInKey !== "boolean") + return "usesParticipantInKey: boolean expected"; + if (message.supportsStarredMessages != null && message.hasOwnProperty("supportsStarredMessages")) + if (typeof message.supportsStarredMessages !== "boolean") + return "supportsStarredMessages: boolean expected"; + if (message.supportsDocumentMessages != null && message.hasOwnProperty("supportsDocumentMessages")) + if (typeof message.supportsDocumentMessages !== "boolean") + return "supportsDocumentMessages: boolean expected"; + if (message.supportsUrlMessages != null && message.hasOwnProperty("supportsUrlMessages")) + if (typeof message.supportsUrlMessages !== "boolean") + return "supportsUrlMessages: boolean expected"; + if (message.supportsMediaRetry != null && message.hasOwnProperty("supportsMediaRetry")) + if (typeof message.supportsMediaRetry !== "boolean") + return "supportsMediaRetry: boolean expected"; + if (message.supportsE2EImage != null && message.hasOwnProperty("supportsE2EImage")) + if (typeof message.supportsE2EImage !== "boolean") + return "supportsE2EImage: boolean expected"; + if (message.supportsE2EVideo != null && message.hasOwnProperty("supportsE2EVideo")) + if (typeof message.supportsE2EVideo !== "boolean") + return "supportsE2EVideo: boolean expected"; + if (message.supportsE2EAudio != null && message.hasOwnProperty("supportsE2EAudio")) + if (typeof message.supportsE2EAudio !== "boolean") + return "supportsE2EAudio: boolean expected"; + if (message.supportsE2EDocument != null && message.hasOwnProperty("supportsE2EDocument")) + if (typeof message.supportsE2EDocument !== "boolean") + return "supportsE2EDocument: boolean expected"; + if (message.documentTypes != null && message.hasOwnProperty("documentTypes")) + if (!$util.isString(message.documentTypes)) + return "documentTypes: string expected"; + if (message.features != null && message.hasOwnProperty("features")) + if (!(message.features && typeof message.features.length === "number" || $util.isString(message.features))) + return "features: buffer expected"; + return null; + }; + + /** + * Creates a WebdPayload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {Object.} object Plain object + * @returns {proto.ClientPayload.WebInfo.WebdPayload} WebdPayload + */ + WebdPayload.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ClientPayload.WebInfo.WebdPayload) + return object; + var message = new $root.proto.ClientPayload.WebInfo.WebdPayload(); + if (object.usesParticipantInKey != null) + message.usesParticipantInKey = Boolean(object.usesParticipantInKey); + if (object.supportsStarredMessages != null) + message.supportsStarredMessages = Boolean(object.supportsStarredMessages); + if (object.supportsDocumentMessages != null) + message.supportsDocumentMessages = Boolean(object.supportsDocumentMessages); + if (object.supportsUrlMessages != null) + message.supportsUrlMessages = Boolean(object.supportsUrlMessages); + if (object.supportsMediaRetry != null) + message.supportsMediaRetry = Boolean(object.supportsMediaRetry); + if (object.supportsE2EImage != null) + message.supportsE2EImage = Boolean(object.supportsE2EImage); + if (object.supportsE2EVideo != null) + message.supportsE2EVideo = Boolean(object.supportsE2EVideo); + if (object.supportsE2EAudio != null) + message.supportsE2EAudio = Boolean(object.supportsE2EAudio); + if (object.supportsE2EDocument != null) + message.supportsE2EDocument = Boolean(object.supportsE2EDocument); + if (object.documentTypes != null) + message.documentTypes = String(object.documentTypes); + if (object.features != null) + if (typeof object.features === "string") + $util.base64.decode(object.features, message.features = $util.newBuffer($util.base64.length(object.features)), 0); + else if (object.features.length) + message.features = object.features; + return message; + }; + + /** + * Creates a plain object from a WebdPayload message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @static + * @param {proto.ClientPayload.WebInfo.WebdPayload} message WebdPayload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebdPayload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.usesParticipantInKey = false; + object.supportsStarredMessages = false; + object.supportsDocumentMessages = false; + object.supportsUrlMessages = false; + object.supportsMediaRetry = false; + object.supportsE2EImage = false; + object.supportsE2EVideo = false; + object.supportsE2EAudio = false; + object.supportsE2EDocument = false; + object.documentTypes = ""; + if (options.bytes === String) + object.features = ""; + else { + object.features = []; + if (options.bytes !== Array) + object.features = $util.newBuffer(object.features); + } + } + if (message.usesParticipantInKey != null && message.hasOwnProperty("usesParticipantInKey")) + object.usesParticipantInKey = message.usesParticipantInKey; + if (message.supportsStarredMessages != null && message.hasOwnProperty("supportsStarredMessages")) + object.supportsStarredMessages = message.supportsStarredMessages; + if (message.supportsDocumentMessages != null && message.hasOwnProperty("supportsDocumentMessages")) + object.supportsDocumentMessages = message.supportsDocumentMessages; + if (message.supportsUrlMessages != null && message.hasOwnProperty("supportsUrlMessages")) + object.supportsUrlMessages = message.supportsUrlMessages; + if (message.supportsMediaRetry != null && message.hasOwnProperty("supportsMediaRetry")) + object.supportsMediaRetry = message.supportsMediaRetry; + if (message.supportsE2EImage != null && message.hasOwnProperty("supportsE2EImage")) + object.supportsE2EImage = message.supportsE2EImage; + if (message.supportsE2EVideo != null && message.hasOwnProperty("supportsE2EVideo")) + object.supportsE2EVideo = message.supportsE2EVideo; + if (message.supportsE2EAudio != null && message.hasOwnProperty("supportsE2EAudio")) + object.supportsE2EAudio = message.supportsE2EAudio; + if (message.supportsE2EDocument != null && message.hasOwnProperty("supportsE2EDocument")) + object.supportsE2EDocument = message.supportsE2EDocument; + if (message.documentTypes != null && message.hasOwnProperty("documentTypes")) + object.documentTypes = message.documentTypes; + if (message.features != null && message.hasOwnProperty("features")) + object.features = options.bytes === String ? $util.base64.encode(message.features, 0, message.features.length) : options.bytes === Array ? Array.prototype.slice.call(message.features) : message.features; + return object; + }; + + /** + * Converts this WebdPayload to JSON. + * @function toJSON + * @memberof proto.ClientPayload.WebInfo.WebdPayload + * @instance + * @returns {Object.} JSON object + */ + WebdPayload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WebdPayload; + })(); + + return WebInfo; + })(); + + return ClientPayload; + })(); + + proto.ContextInfo = (function() { + + /** + * Properties of a ContextInfo. + * @memberof proto + * @interface IContextInfo + * @property {string|null} [stanzaId] ContextInfo stanzaId + * @property {string|null} [participant] ContextInfo participant + * @property {proto.IMessage|null} [quotedMessage] ContextInfo quotedMessage + * @property {string|null} [remoteJid] ContextInfo remoteJid + * @property {Array.|null} [mentionedJid] ContextInfo mentionedJid + * @property {string|null} [conversionSource] ContextInfo conversionSource + * @property {Uint8Array|null} [conversionData] ContextInfo conversionData + * @property {number|null} [conversionDelaySeconds] ContextInfo conversionDelaySeconds + * @property {number|null} [forwardingScore] ContextInfo forwardingScore + * @property {boolean|null} [isForwarded] ContextInfo isForwarded + * @property {proto.ContextInfo.IAdReplyInfo|null} [quotedAd] ContextInfo quotedAd + * @property {proto.IMessageKey|null} [placeholderKey] ContextInfo placeholderKey + * @property {number|null} [expiration] ContextInfo expiration + * @property {number|Long|null} [ephemeralSettingTimestamp] ContextInfo ephemeralSettingTimestamp + * @property {Uint8Array|null} [ephemeralSharedSecret] ContextInfo ephemeralSharedSecret + * @property {proto.ContextInfo.IExternalAdReplyInfo|null} [externalAdReply] ContextInfo externalAdReply + * @property {string|null} [entryPointConversionSource] ContextInfo entryPointConversionSource + * @property {string|null} [entryPointConversionApp] ContextInfo entryPointConversionApp + * @property {number|null} [entryPointConversionDelaySeconds] ContextInfo entryPointConversionDelaySeconds + * @property {proto.IDisappearingMode|null} [disappearingMode] ContextInfo disappearingMode + * @property {proto.IActionLink|null} [actionLink] ContextInfo actionLink + * @property {string|null} [groupSubject] ContextInfo groupSubject + * @property {string|null} [parentGroupJid] ContextInfo parentGroupJid + * @property {string|null} [trustBannerType] ContextInfo trustBannerType + * @property {number|null} [trustBannerAction] ContextInfo trustBannerAction + * @property {boolean|null} [isSampled] ContextInfo isSampled + * @property {Array.|null} [groupMentions] ContextInfo groupMentions + * @property {proto.ContextInfo.IUTMInfo|null} [utm] ContextInfo utm + */ + + /** + * Constructs a new ContextInfo. + * @memberof proto + * @classdesc Represents a ContextInfo. + * @implements IContextInfo + * @constructor + * @param {proto.IContextInfo=} [properties] Properties to set + */ + function ContextInfo(properties) { + this.mentionedJid = []; + this.groupMentions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContextInfo stanzaId. + * @member {string} stanzaId + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.stanzaId = ""; + + /** + * ContextInfo participant. + * @member {string} participant + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.participant = ""; + + /** + * ContextInfo quotedMessage. + * @member {proto.IMessage|null|undefined} quotedMessage + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.quotedMessage = null; + + /** + * ContextInfo remoteJid. + * @member {string} remoteJid + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.remoteJid = ""; + + /** + * ContextInfo mentionedJid. + * @member {Array.} mentionedJid + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.mentionedJid = $util.emptyArray; + + /** + * ContextInfo conversionSource. + * @member {string} conversionSource + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.conversionSource = ""; + + /** + * ContextInfo conversionData. + * @member {Uint8Array} conversionData + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.conversionData = $util.newBuffer([]); + + /** + * ContextInfo conversionDelaySeconds. + * @member {number} conversionDelaySeconds + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.conversionDelaySeconds = 0; + + /** + * ContextInfo forwardingScore. + * @member {number} forwardingScore + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.forwardingScore = 0; + + /** + * ContextInfo isForwarded. + * @member {boolean} isForwarded + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.isForwarded = false; + + /** + * ContextInfo quotedAd. + * @member {proto.ContextInfo.IAdReplyInfo|null|undefined} quotedAd + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.quotedAd = null; + + /** + * ContextInfo placeholderKey. + * @member {proto.IMessageKey|null|undefined} placeholderKey + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.placeholderKey = null; + + /** + * ContextInfo expiration. + * @member {number} expiration + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.expiration = 0; + + /** + * ContextInfo ephemeralSettingTimestamp. + * @member {number|Long} ephemeralSettingTimestamp + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.ephemeralSettingTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ContextInfo ephemeralSharedSecret. + * @member {Uint8Array} ephemeralSharedSecret + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.ephemeralSharedSecret = $util.newBuffer([]); + + /** + * ContextInfo externalAdReply. + * @member {proto.ContextInfo.IExternalAdReplyInfo|null|undefined} externalAdReply + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.externalAdReply = null; + + /** + * ContextInfo entryPointConversionSource. + * @member {string} entryPointConversionSource + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.entryPointConversionSource = ""; + + /** + * ContextInfo entryPointConversionApp. + * @member {string} entryPointConversionApp + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.entryPointConversionApp = ""; + + /** + * ContextInfo entryPointConversionDelaySeconds. + * @member {number} entryPointConversionDelaySeconds + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.entryPointConversionDelaySeconds = 0; + + /** + * ContextInfo disappearingMode. + * @member {proto.IDisappearingMode|null|undefined} disappearingMode + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.disappearingMode = null; + + /** + * ContextInfo actionLink. + * @member {proto.IActionLink|null|undefined} actionLink + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.actionLink = null; + + /** + * ContextInfo groupSubject. + * @member {string} groupSubject + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.groupSubject = ""; + + /** + * ContextInfo parentGroupJid. + * @member {string} parentGroupJid + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.parentGroupJid = ""; + + /** + * ContextInfo trustBannerType. + * @member {string} trustBannerType + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.trustBannerType = ""; + + /** + * ContextInfo trustBannerAction. + * @member {number} trustBannerAction + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.trustBannerAction = 0; + + /** + * ContextInfo isSampled. + * @member {boolean} isSampled + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.isSampled = false; + + /** + * ContextInfo groupMentions. + * @member {Array.} groupMentions + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.groupMentions = $util.emptyArray; + + /** + * ContextInfo utm. + * @member {proto.ContextInfo.IUTMInfo|null|undefined} utm + * @memberof proto.ContextInfo + * @instance + */ + ContextInfo.prototype.utm = null; + + /** + * Creates a new ContextInfo instance using the specified properties. + * @function create + * @memberof proto.ContextInfo + * @static + * @param {proto.IContextInfo=} [properties] Properties to set + * @returns {proto.ContextInfo} ContextInfo instance + */ + ContextInfo.create = function create(properties) { + return new ContextInfo(properties); + }; + + /** + * Encodes the specified ContextInfo message. Does not implicitly {@link proto.ContextInfo.verify|verify} messages. + * @function encode + * @memberof proto.ContextInfo + * @static + * @param {proto.IContextInfo} message ContextInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContextInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.stanzaId != null && Object.hasOwnProperty.call(message, "stanzaId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.stanzaId); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.participant); + if (message.quotedMessage != null && Object.hasOwnProperty.call(message, "quotedMessage")) + $root.proto.Message.encode(message.quotedMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.remoteJid != null && Object.hasOwnProperty.call(message, "remoteJid")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.remoteJid); + if (message.mentionedJid != null && message.mentionedJid.length) + for (var i = 0; i < message.mentionedJid.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.mentionedJid[i]); + if (message.conversionSource != null && Object.hasOwnProperty.call(message, "conversionSource")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.conversionSource); + if (message.conversionData != null && Object.hasOwnProperty.call(message, "conversionData")) + writer.uint32(/* id 19, wireType 2 =*/154).bytes(message.conversionData); + if (message.conversionDelaySeconds != null && Object.hasOwnProperty.call(message, "conversionDelaySeconds")) + writer.uint32(/* id 20, wireType 0 =*/160).uint32(message.conversionDelaySeconds); + if (message.forwardingScore != null && Object.hasOwnProperty.call(message, "forwardingScore")) + writer.uint32(/* id 21, wireType 0 =*/168).uint32(message.forwardingScore); + if (message.isForwarded != null && Object.hasOwnProperty.call(message, "isForwarded")) + writer.uint32(/* id 22, wireType 0 =*/176).bool(message.isForwarded); + if (message.quotedAd != null && Object.hasOwnProperty.call(message, "quotedAd")) + $root.proto.ContextInfo.AdReplyInfo.encode(message.quotedAd, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.placeholderKey != null && Object.hasOwnProperty.call(message, "placeholderKey")) + $root.proto.MessageKey.encode(message.placeholderKey, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.expiration != null && Object.hasOwnProperty.call(message, "expiration")) + writer.uint32(/* id 25, wireType 0 =*/200).uint32(message.expiration); + if (message.ephemeralSettingTimestamp != null && Object.hasOwnProperty.call(message, "ephemeralSettingTimestamp")) + writer.uint32(/* id 26, wireType 0 =*/208).int64(message.ephemeralSettingTimestamp); + if (message.ephemeralSharedSecret != null && Object.hasOwnProperty.call(message, "ephemeralSharedSecret")) + writer.uint32(/* id 27, wireType 2 =*/218).bytes(message.ephemeralSharedSecret); + if (message.externalAdReply != null && Object.hasOwnProperty.call(message, "externalAdReply")) + $root.proto.ContextInfo.ExternalAdReplyInfo.encode(message.externalAdReply, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + if (message.entryPointConversionSource != null && Object.hasOwnProperty.call(message, "entryPointConversionSource")) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.entryPointConversionSource); + if (message.entryPointConversionApp != null && Object.hasOwnProperty.call(message, "entryPointConversionApp")) + writer.uint32(/* id 30, wireType 2 =*/242).string(message.entryPointConversionApp); + if (message.entryPointConversionDelaySeconds != null && Object.hasOwnProperty.call(message, "entryPointConversionDelaySeconds")) + writer.uint32(/* id 31, wireType 0 =*/248).uint32(message.entryPointConversionDelaySeconds); + if (message.disappearingMode != null && Object.hasOwnProperty.call(message, "disappearingMode")) + $root.proto.DisappearingMode.encode(message.disappearingMode, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.actionLink != null && Object.hasOwnProperty.call(message, "actionLink")) + $root.proto.ActionLink.encode(message.actionLink, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.groupSubject != null && Object.hasOwnProperty.call(message, "groupSubject")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.groupSubject); + if (message.parentGroupJid != null && Object.hasOwnProperty.call(message, "parentGroupJid")) + writer.uint32(/* id 35, wireType 2 =*/282).string(message.parentGroupJid); + if (message.trustBannerType != null && Object.hasOwnProperty.call(message, "trustBannerType")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.trustBannerType); + if (message.trustBannerAction != null && Object.hasOwnProperty.call(message, "trustBannerAction")) + writer.uint32(/* id 38, wireType 0 =*/304).uint32(message.trustBannerAction); + if (message.isSampled != null && Object.hasOwnProperty.call(message, "isSampled")) + writer.uint32(/* id 39, wireType 0 =*/312).bool(message.isSampled); + if (message.groupMentions != null && message.groupMentions.length) + for (var i = 0; i < message.groupMentions.length; ++i) + $root.proto.GroupMention.encode(message.groupMentions[i], writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); + if (message.utm != null && Object.hasOwnProperty.call(message, "utm")) + $root.proto.ContextInfo.UTMInfo.encode(message.utm, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ContextInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ContextInfo + * @static + * @param {proto.IContextInfo} message ContextInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContextInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContextInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.ContextInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ContextInfo} ContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContextInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ContextInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stanzaId = reader.string(); + break; + case 2: + message.participant = reader.string(); + break; + case 3: + message.quotedMessage = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 4: + message.remoteJid = reader.string(); + break; + case 15: + if (!(message.mentionedJid && message.mentionedJid.length)) + message.mentionedJid = []; + message.mentionedJid.push(reader.string()); + break; + case 18: + message.conversionSource = reader.string(); + break; + case 19: + message.conversionData = reader.bytes(); + break; + case 20: + message.conversionDelaySeconds = reader.uint32(); + break; + case 21: + message.forwardingScore = reader.uint32(); + break; + case 22: + message.isForwarded = reader.bool(); + break; + case 23: + message.quotedAd = $root.proto.ContextInfo.AdReplyInfo.decode(reader, reader.uint32()); + break; + case 24: + message.placeholderKey = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 25: + message.expiration = reader.uint32(); + break; + case 26: + message.ephemeralSettingTimestamp = reader.int64(); + break; + case 27: + message.ephemeralSharedSecret = reader.bytes(); + break; + case 28: + message.externalAdReply = $root.proto.ContextInfo.ExternalAdReplyInfo.decode(reader, reader.uint32()); + break; + case 29: + message.entryPointConversionSource = reader.string(); + break; + case 30: + message.entryPointConversionApp = reader.string(); + break; + case 31: + message.entryPointConversionDelaySeconds = reader.uint32(); + break; + case 32: + message.disappearingMode = $root.proto.DisappearingMode.decode(reader, reader.uint32()); + break; + case 33: + message.actionLink = $root.proto.ActionLink.decode(reader, reader.uint32()); + break; + case 34: + message.groupSubject = reader.string(); + break; + case 35: + message.parentGroupJid = reader.string(); + break; + case 37: + message.trustBannerType = reader.string(); + break; + case 38: + message.trustBannerAction = reader.uint32(); + break; + case 39: + message.isSampled = reader.bool(); + break; + case 40: + if (!(message.groupMentions && message.groupMentions.length)) + message.groupMentions = []; + message.groupMentions.push($root.proto.GroupMention.decode(reader, reader.uint32())); + break; + case 41: + message.utm = $root.proto.ContextInfo.UTMInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContextInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ContextInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ContextInfo} ContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContextInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContextInfo message. + * @function verify + * @memberof proto.ContextInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContextInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + if (!$util.isString(message.stanzaId)) + return "stanzaId: string expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.quotedMessage != null && message.hasOwnProperty("quotedMessage")) { + var error = $root.proto.Message.verify(message.quotedMessage); + if (error) + return "quotedMessage." + error; + } + if (message.remoteJid != null && message.hasOwnProperty("remoteJid")) + if (!$util.isString(message.remoteJid)) + return "remoteJid: string expected"; + if (message.mentionedJid != null && message.hasOwnProperty("mentionedJid")) { + if (!Array.isArray(message.mentionedJid)) + return "mentionedJid: array expected"; + for (var i = 0; i < message.mentionedJid.length; ++i) + if (!$util.isString(message.mentionedJid[i])) + return "mentionedJid: string[] expected"; + } + if (message.conversionSource != null && message.hasOwnProperty("conversionSource")) + if (!$util.isString(message.conversionSource)) + return "conversionSource: string expected"; + if (message.conversionData != null && message.hasOwnProperty("conversionData")) + if (!(message.conversionData && typeof message.conversionData.length === "number" || $util.isString(message.conversionData))) + return "conversionData: buffer expected"; + if (message.conversionDelaySeconds != null && message.hasOwnProperty("conversionDelaySeconds")) + if (!$util.isInteger(message.conversionDelaySeconds)) + return "conversionDelaySeconds: integer expected"; + if (message.forwardingScore != null && message.hasOwnProperty("forwardingScore")) + if (!$util.isInteger(message.forwardingScore)) + return "forwardingScore: integer expected"; + if (message.isForwarded != null && message.hasOwnProperty("isForwarded")) + if (typeof message.isForwarded !== "boolean") + return "isForwarded: boolean expected"; + if (message.quotedAd != null && message.hasOwnProperty("quotedAd")) { + var error = $root.proto.ContextInfo.AdReplyInfo.verify(message.quotedAd); + if (error) + return "quotedAd." + error; + } + if (message.placeholderKey != null && message.hasOwnProperty("placeholderKey")) { + var error = $root.proto.MessageKey.verify(message.placeholderKey); + if (error) + return "placeholderKey." + error; + } + if (message.expiration != null && message.hasOwnProperty("expiration")) + if (!$util.isInteger(message.expiration)) + return "expiration: integer expected"; + if (message.ephemeralSettingTimestamp != null && message.hasOwnProperty("ephemeralSettingTimestamp")) + if (!$util.isInteger(message.ephemeralSettingTimestamp) && !(message.ephemeralSettingTimestamp && $util.isInteger(message.ephemeralSettingTimestamp.low) && $util.isInteger(message.ephemeralSettingTimestamp.high))) + return "ephemeralSettingTimestamp: integer|Long expected"; + if (message.ephemeralSharedSecret != null && message.hasOwnProperty("ephemeralSharedSecret")) + if (!(message.ephemeralSharedSecret && typeof message.ephemeralSharedSecret.length === "number" || $util.isString(message.ephemeralSharedSecret))) + return "ephemeralSharedSecret: buffer expected"; + if (message.externalAdReply != null && message.hasOwnProperty("externalAdReply")) { + var error = $root.proto.ContextInfo.ExternalAdReplyInfo.verify(message.externalAdReply); + if (error) + return "externalAdReply." + error; + } + if (message.entryPointConversionSource != null && message.hasOwnProperty("entryPointConversionSource")) + if (!$util.isString(message.entryPointConversionSource)) + return "entryPointConversionSource: string expected"; + if (message.entryPointConversionApp != null && message.hasOwnProperty("entryPointConversionApp")) + if (!$util.isString(message.entryPointConversionApp)) + return "entryPointConversionApp: string expected"; + if (message.entryPointConversionDelaySeconds != null && message.hasOwnProperty("entryPointConversionDelaySeconds")) + if (!$util.isInteger(message.entryPointConversionDelaySeconds)) + return "entryPointConversionDelaySeconds: integer expected"; + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) { + var error = $root.proto.DisappearingMode.verify(message.disappearingMode); + if (error) + return "disappearingMode." + error; + } + if (message.actionLink != null && message.hasOwnProperty("actionLink")) { + var error = $root.proto.ActionLink.verify(message.actionLink); + if (error) + return "actionLink." + error; + } + if (message.groupSubject != null && message.hasOwnProperty("groupSubject")) + if (!$util.isString(message.groupSubject)) + return "groupSubject: string expected"; + if (message.parentGroupJid != null && message.hasOwnProperty("parentGroupJid")) + if (!$util.isString(message.parentGroupJid)) + return "parentGroupJid: string expected"; + if (message.trustBannerType != null && message.hasOwnProperty("trustBannerType")) + if (!$util.isString(message.trustBannerType)) + return "trustBannerType: string expected"; + if (message.trustBannerAction != null && message.hasOwnProperty("trustBannerAction")) + if (!$util.isInteger(message.trustBannerAction)) + return "trustBannerAction: integer expected"; + if (message.isSampled != null && message.hasOwnProperty("isSampled")) + if (typeof message.isSampled !== "boolean") + return "isSampled: boolean expected"; + if (message.groupMentions != null && message.hasOwnProperty("groupMentions")) { + if (!Array.isArray(message.groupMentions)) + return "groupMentions: array expected"; + for (var i = 0; i < message.groupMentions.length; ++i) { + var error = $root.proto.GroupMention.verify(message.groupMentions[i]); + if (error) + return "groupMentions." + error; + } + } + if (message.utm != null && message.hasOwnProperty("utm")) { + var error = $root.proto.ContextInfo.UTMInfo.verify(message.utm); + if (error) + return "utm." + error; + } + return null; + }; + + /** + * Creates a ContextInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ContextInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.ContextInfo} ContextInfo + */ + ContextInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ContextInfo) + return object; + var message = new $root.proto.ContextInfo(); + if (object.stanzaId != null) + message.stanzaId = String(object.stanzaId); + if (object.participant != null) + message.participant = String(object.participant); + if (object.quotedMessage != null) { + if (typeof object.quotedMessage !== "object") + throw TypeError(".proto.ContextInfo.quotedMessage: object expected"); + message.quotedMessage = $root.proto.Message.fromObject(object.quotedMessage); + } + if (object.remoteJid != null) + message.remoteJid = String(object.remoteJid); + if (object.mentionedJid) { + if (!Array.isArray(object.mentionedJid)) + throw TypeError(".proto.ContextInfo.mentionedJid: array expected"); + message.mentionedJid = []; + for (var i = 0; i < object.mentionedJid.length; ++i) + message.mentionedJid[i] = String(object.mentionedJid[i]); + } + if (object.conversionSource != null) + message.conversionSource = String(object.conversionSource); + if (object.conversionData != null) + if (typeof object.conversionData === "string") + $util.base64.decode(object.conversionData, message.conversionData = $util.newBuffer($util.base64.length(object.conversionData)), 0); + else if (object.conversionData.length) + message.conversionData = object.conversionData; + if (object.conversionDelaySeconds != null) + message.conversionDelaySeconds = object.conversionDelaySeconds >>> 0; + if (object.forwardingScore != null) + message.forwardingScore = object.forwardingScore >>> 0; + if (object.isForwarded != null) + message.isForwarded = Boolean(object.isForwarded); + if (object.quotedAd != null) { + if (typeof object.quotedAd !== "object") + throw TypeError(".proto.ContextInfo.quotedAd: object expected"); + message.quotedAd = $root.proto.ContextInfo.AdReplyInfo.fromObject(object.quotedAd); + } + if (object.placeholderKey != null) { + if (typeof object.placeholderKey !== "object") + throw TypeError(".proto.ContextInfo.placeholderKey: object expected"); + message.placeholderKey = $root.proto.MessageKey.fromObject(object.placeholderKey); + } + if (object.expiration != null) + message.expiration = object.expiration >>> 0; + if (object.ephemeralSettingTimestamp != null) + if ($util.Long) + (message.ephemeralSettingTimestamp = $util.Long.fromValue(object.ephemeralSettingTimestamp)).unsigned = false; + else if (typeof object.ephemeralSettingTimestamp === "string") + message.ephemeralSettingTimestamp = parseInt(object.ephemeralSettingTimestamp, 10); + else if (typeof object.ephemeralSettingTimestamp === "number") + message.ephemeralSettingTimestamp = object.ephemeralSettingTimestamp; + else if (typeof object.ephemeralSettingTimestamp === "object") + message.ephemeralSettingTimestamp = new $util.LongBits(object.ephemeralSettingTimestamp.low >>> 0, object.ephemeralSettingTimestamp.high >>> 0).toNumber(); + if (object.ephemeralSharedSecret != null) + if (typeof object.ephemeralSharedSecret === "string") + $util.base64.decode(object.ephemeralSharedSecret, message.ephemeralSharedSecret = $util.newBuffer($util.base64.length(object.ephemeralSharedSecret)), 0); + else if (object.ephemeralSharedSecret.length) + message.ephemeralSharedSecret = object.ephemeralSharedSecret; + if (object.externalAdReply != null) { + if (typeof object.externalAdReply !== "object") + throw TypeError(".proto.ContextInfo.externalAdReply: object expected"); + message.externalAdReply = $root.proto.ContextInfo.ExternalAdReplyInfo.fromObject(object.externalAdReply); + } + if (object.entryPointConversionSource != null) + message.entryPointConversionSource = String(object.entryPointConversionSource); + if (object.entryPointConversionApp != null) + message.entryPointConversionApp = String(object.entryPointConversionApp); + if (object.entryPointConversionDelaySeconds != null) + message.entryPointConversionDelaySeconds = object.entryPointConversionDelaySeconds >>> 0; + if (object.disappearingMode != null) { + if (typeof object.disappearingMode !== "object") + throw TypeError(".proto.ContextInfo.disappearingMode: object expected"); + message.disappearingMode = $root.proto.DisappearingMode.fromObject(object.disappearingMode); + } + if (object.actionLink != null) { + if (typeof object.actionLink !== "object") + throw TypeError(".proto.ContextInfo.actionLink: object expected"); + message.actionLink = $root.proto.ActionLink.fromObject(object.actionLink); + } + if (object.groupSubject != null) + message.groupSubject = String(object.groupSubject); + if (object.parentGroupJid != null) + message.parentGroupJid = String(object.parentGroupJid); + if (object.trustBannerType != null) + message.trustBannerType = String(object.trustBannerType); + if (object.trustBannerAction != null) + message.trustBannerAction = object.trustBannerAction >>> 0; + if (object.isSampled != null) + message.isSampled = Boolean(object.isSampled); + if (object.groupMentions) { + if (!Array.isArray(object.groupMentions)) + throw TypeError(".proto.ContextInfo.groupMentions: array expected"); + message.groupMentions = []; + for (var i = 0; i < object.groupMentions.length; ++i) { + if (typeof object.groupMentions[i] !== "object") + throw TypeError(".proto.ContextInfo.groupMentions: object expected"); + message.groupMentions[i] = $root.proto.GroupMention.fromObject(object.groupMentions[i]); + } + } + if (object.utm != null) { + if (typeof object.utm !== "object") + throw TypeError(".proto.ContextInfo.utm: object expected"); + message.utm = $root.proto.ContextInfo.UTMInfo.fromObject(object.utm); + } + return message; + }; + + /** + * Creates a plain object from a ContextInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ContextInfo + * @static + * @param {proto.ContextInfo} message ContextInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContextInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.mentionedJid = []; + object.groupMentions = []; + } + if (options.defaults) { + object.stanzaId = ""; + object.participant = ""; + object.quotedMessage = null; + object.remoteJid = ""; + object.conversionSource = ""; + if (options.bytes === String) + object.conversionData = ""; + else { + object.conversionData = []; + if (options.bytes !== Array) + object.conversionData = $util.newBuffer(object.conversionData); + } + object.conversionDelaySeconds = 0; + object.forwardingScore = 0; + object.isForwarded = false; + object.quotedAd = null; + object.placeholderKey = null; + object.expiration = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ephemeralSettingTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ephemeralSettingTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.ephemeralSharedSecret = ""; + else { + object.ephemeralSharedSecret = []; + if (options.bytes !== Array) + object.ephemeralSharedSecret = $util.newBuffer(object.ephemeralSharedSecret); + } + object.externalAdReply = null; + object.entryPointConversionSource = ""; + object.entryPointConversionApp = ""; + object.entryPointConversionDelaySeconds = 0; + object.disappearingMode = null; + object.actionLink = null; + object.groupSubject = ""; + object.parentGroupJid = ""; + object.trustBannerType = ""; + object.trustBannerAction = 0; + object.isSampled = false; + object.utm = null; + } + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + object.stanzaId = message.stanzaId; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.quotedMessage != null && message.hasOwnProperty("quotedMessage")) + object.quotedMessage = $root.proto.Message.toObject(message.quotedMessage, options); + if (message.remoteJid != null && message.hasOwnProperty("remoteJid")) + object.remoteJid = message.remoteJid; + if (message.mentionedJid && message.mentionedJid.length) { + object.mentionedJid = []; + for (var j = 0; j < message.mentionedJid.length; ++j) + object.mentionedJid[j] = message.mentionedJid[j]; + } + if (message.conversionSource != null && message.hasOwnProperty("conversionSource")) + object.conversionSource = message.conversionSource; + if (message.conversionData != null && message.hasOwnProperty("conversionData")) + object.conversionData = options.bytes === String ? $util.base64.encode(message.conversionData, 0, message.conversionData.length) : options.bytes === Array ? Array.prototype.slice.call(message.conversionData) : message.conversionData; + if (message.conversionDelaySeconds != null && message.hasOwnProperty("conversionDelaySeconds")) + object.conversionDelaySeconds = message.conversionDelaySeconds; + if (message.forwardingScore != null && message.hasOwnProperty("forwardingScore")) + object.forwardingScore = message.forwardingScore; + if (message.isForwarded != null && message.hasOwnProperty("isForwarded")) + object.isForwarded = message.isForwarded; + if (message.quotedAd != null && message.hasOwnProperty("quotedAd")) + object.quotedAd = $root.proto.ContextInfo.AdReplyInfo.toObject(message.quotedAd, options); + if (message.placeholderKey != null && message.hasOwnProperty("placeholderKey")) + object.placeholderKey = $root.proto.MessageKey.toObject(message.placeholderKey, options); + if (message.expiration != null && message.hasOwnProperty("expiration")) + object.expiration = message.expiration; + if (message.ephemeralSettingTimestamp != null && message.hasOwnProperty("ephemeralSettingTimestamp")) + if (typeof message.ephemeralSettingTimestamp === "number") + object.ephemeralSettingTimestamp = options.longs === String ? String(message.ephemeralSettingTimestamp) : message.ephemeralSettingTimestamp; + else + object.ephemeralSettingTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.ephemeralSettingTimestamp) : options.longs === Number ? new $util.LongBits(message.ephemeralSettingTimestamp.low >>> 0, message.ephemeralSettingTimestamp.high >>> 0).toNumber() : message.ephemeralSettingTimestamp; + if (message.ephemeralSharedSecret != null && message.hasOwnProperty("ephemeralSharedSecret")) + object.ephemeralSharedSecret = options.bytes === String ? $util.base64.encode(message.ephemeralSharedSecret, 0, message.ephemeralSharedSecret.length) : options.bytes === Array ? Array.prototype.slice.call(message.ephemeralSharedSecret) : message.ephemeralSharedSecret; + if (message.externalAdReply != null && message.hasOwnProperty("externalAdReply")) + object.externalAdReply = $root.proto.ContextInfo.ExternalAdReplyInfo.toObject(message.externalAdReply, options); + if (message.entryPointConversionSource != null && message.hasOwnProperty("entryPointConversionSource")) + object.entryPointConversionSource = message.entryPointConversionSource; + if (message.entryPointConversionApp != null && message.hasOwnProperty("entryPointConversionApp")) + object.entryPointConversionApp = message.entryPointConversionApp; + if (message.entryPointConversionDelaySeconds != null && message.hasOwnProperty("entryPointConversionDelaySeconds")) + object.entryPointConversionDelaySeconds = message.entryPointConversionDelaySeconds; + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) + object.disappearingMode = $root.proto.DisappearingMode.toObject(message.disappearingMode, options); + if (message.actionLink != null && message.hasOwnProperty("actionLink")) + object.actionLink = $root.proto.ActionLink.toObject(message.actionLink, options); + if (message.groupSubject != null && message.hasOwnProperty("groupSubject")) + object.groupSubject = message.groupSubject; + if (message.parentGroupJid != null && message.hasOwnProperty("parentGroupJid")) + object.parentGroupJid = message.parentGroupJid; + if (message.trustBannerType != null && message.hasOwnProperty("trustBannerType")) + object.trustBannerType = message.trustBannerType; + if (message.trustBannerAction != null && message.hasOwnProperty("trustBannerAction")) + object.trustBannerAction = message.trustBannerAction; + if (message.isSampled != null && message.hasOwnProperty("isSampled")) + object.isSampled = message.isSampled; + if (message.groupMentions && message.groupMentions.length) { + object.groupMentions = []; + for (var j = 0; j < message.groupMentions.length; ++j) + object.groupMentions[j] = $root.proto.GroupMention.toObject(message.groupMentions[j], options); + } + if (message.utm != null && message.hasOwnProperty("utm")) + object.utm = $root.proto.ContextInfo.UTMInfo.toObject(message.utm, options); + return object; + }; + + /** + * Converts this ContextInfo to JSON. + * @function toJSON + * @memberof proto.ContextInfo + * @instance + * @returns {Object.} JSON object + */ + ContextInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ContextInfo.AdReplyInfo = (function() { + + /** + * Properties of an AdReplyInfo. + * @memberof proto.ContextInfo + * @interface IAdReplyInfo + * @property {string|null} [advertiserName] AdReplyInfo advertiserName + * @property {proto.ContextInfo.AdReplyInfo.MediaType|null} [mediaType] AdReplyInfo mediaType + * @property {Uint8Array|null} [jpegThumbnail] AdReplyInfo jpegThumbnail + * @property {string|null} [caption] AdReplyInfo caption + */ + + /** + * Constructs a new AdReplyInfo. + * @memberof proto.ContextInfo + * @classdesc Represents an AdReplyInfo. + * @implements IAdReplyInfo + * @constructor + * @param {proto.ContextInfo.IAdReplyInfo=} [properties] Properties to set + */ + function AdReplyInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AdReplyInfo advertiserName. + * @member {string} advertiserName + * @memberof proto.ContextInfo.AdReplyInfo + * @instance + */ + AdReplyInfo.prototype.advertiserName = ""; + + /** + * AdReplyInfo mediaType. + * @member {proto.ContextInfo.AdReplyInfo.MediaType} mediaType + * @memberof proto.ContextInfo.AdReplyInfo + * @instance + */ + AdReplyInfo.prototype.mediaType = 0; + + /** + * AdReplyInfo jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.ContextInfo.AdReplyInfo + * @instance + */ + AdReplyInfo.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * AdReplyInfo caption. + * @member {string} caption + * @memberof proto.ContextInfo.AdReplyInfo + * @instance + */ + AdReplyInfo.prototype.caption = ""; + + /** + * Creates a new AdReplyInfo instance using the specified properties. + * @function create + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {proto.ContextInfo.IAdReplyInfo=} [properties] Properties to set + * @returns {proto.ContextInfo.AdReplyInfo} AdReplyInfo instance + */ + AdReplyInfo.create = function create(properties) { + return new AdReplyInfo(properties); + }; + + /** + * Encodes the specified AdReplyInfo message. Does not implicitly {@link proto.ContextInfo.AdReplyInfo.verify|verify} messages. + * @function encode + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {proto.ContextInfo.IAdReplyInfo} message AdReplyInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AdReplyInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.advertiserName != null && Object.hasOwnProperty.call(message, "advertiserName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.advertiserName); + if (message.mediaType != null && Object.hasOwnProperty.call(message, "mediaType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.mediaType); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.caption); + return writer; + }; + + /** + * Encodes the specified AdReplyInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.AdReplyInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {proto.ContextInfo.IAdReplyInfo} message AdReplyInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AdReplyInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AdReplyInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ContextInfo.AdReplyInfo} AdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdReplyInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ContextInfo.AdReplyInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.advertiserName = reader.string(); + break; + case 2: + message.mediaType = reader.int32(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.caption = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AdReplyInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ContextInfo.AdReplyInfo} AdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdReplyInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AdReplyInfo message. + * @function verify + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AdReplyInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.advertiserName != null && message.hasOwnProperty("advertiserName")) + if (!$util.isString(message.advertiserName)) + return "advertiserName: string expected"; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + switch (message.mediaType) { + default: + return "mediaType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + return null; + }; + + /** + * Creates an AdReplyInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.ContextInfo.AdReplyInfo} AdReplyInfo + */ + AdReplyInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ContextInfo.AdReplyInfo) + return object; + var message = new $root.proto.ContextInfo.AdReplyInfo(); + if (object.advertiserName != null) + message.advertiserName = String(object.advertiserName); + switch (object.mediaType) { + case "NONE": + case 0: + message.mediaType = 0; + break; + case "IMAGE": + case 1: + message.mediaType = 1; + break; + case "VIDEO": + case 2: + message.mediaType = 2; + break; + } + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.caption != null) + message.caption = String(object.caption); + return message; + }; + + /** + * Creates a plain object from an AdReplyInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ContextInfo.AdReplyInfo + * @static + * @param {proto.ContextInfo.AdReplyInfo} message AdReplyInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AdReplyInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.advertiserName = ""; + object.mediaType = options.enums === String ? "NONE" : 0; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.caption = ""; + } + if (message.advertiserName != null && message.hasOwnProperty("advertiserName")) + object.advertiserName = message.advertiserName; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + object.mediaType = options.enums === String ? $root.proto.ContextInfo.AdReplyInfo.MediaType[message.mediaType] : message.mediaType; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + return object; + }; + + /** + * Converts this AdReplyInfo to JSON. + * @function toJSON + * @memberof proto.ContextInfo.AdReplyInfo + * @instance + * @returns {Object.} JSON object + */ + AdReplyInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * MediaType enum. + * @name proto.ContextInfo.AdReplyInfo.MediaType + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} IMAGE=1 IMAGE value + * @property {number} VIDEO=2 VIDEO value + */ + AdReplyInfo.MediaType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "IMAGE"] = 1; + values[valuesById[2] = "VIDEO"] = 2; + return values; + })(); + + return AdReplyInfo; + })(); + + ContextInfo.ExternalAdReplyInfo = (function() { + + /** + * Properties of an ExternalAdReplyInfo. + * @memberof proto.ContextInfo + * @interface IExternalAdReplyInfo + * @property {string|null} [title] ExternalAdReplyInfo title + * @property {string|null} [body] ExternalAdReplyInfo body + * @property {proto.ContextInfo.ExternalAdReplyInfo.MediaType|null} [mediaType] ExternalAdReplyInfo mediaType + * @property {string|null} [thumbnailUrl] ExternalAdReplyInfo thumbnailUrl + * @property {string|null} [mediaUrl] ExternalAdReplyInfo mediaUrl + * @property {Uint8Array|null} [thumbnail] ExternalAdReplyInfo thumbnail + * @property {string|null} [sourceType] ExternalAdReplyInfo sourceType + * @property {string|null} [sourceId] ExternalAdReplyInfo sourceId + * @property {string|null} [sourceUrl] ExternalAdReplyInfo sourceUrl + * @property {boolean|null} [containsAutoReply] ExternalAdReplyInfo containsAutoReply + * @property {boolean|null} [renderLargerThumbnail] ExternalAdReplyInfo renderLargerThumbnail + * @property {boolean|null} [showAdAttribution] ExternalAdReplyInfo showAdAttribution + * @property {string|null} [ctwaClid] ExternalAdReplyInfo ctwaClid + */ + + /** + * Constructs a new ExternalAdReplyInfo. + * @memberof proto.ContextInfo + * @classdesc Represents an ExternalAdReplyInfo. + * @implements IExternalAdReplyInfo + * @constructor + * @param {proto.ContextInfo.IExternalAdReplyInfo=} [properties] Properties to set + */ + function ExternalAdReplyInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExternalAdReplyInfo title. + * @member {string} title + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.title = ""; + + /** + * ExternalAdReplyInfo body. + * @member {string} body + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.body = ""; + + /** + * ExternalAdReplyInfo mediaType. + * @member {proto.ContextInfo.ExternalAdReplyInfo.MediaType} mediaType + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.mediaType = 0; + + /** + * ExternalAdReplyInfo thumbnailUrl. + * @member {string} thumbnailUrl + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.thumbnailUrl = ""; + + /** + * ExternalAdReplyInfo mediaUrl. + * @member {string} mediaUrl + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.mediaUrl = ""; + + /** + * ExternalAdReplyInfo thumbnail. + * @member {Uint8Array} thumbnail + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.thumbnail = $util.newBuffer([]); + + /** + * ExternalAdReplyInfo sourceType. + * @member {string} sourceType + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.sourceType = ""; + + /** + * ExternalAdReplyInfo sourceId. + * @member {string} sourceId + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.sourceId = ""; + + /** + * ExternalAdReplyInfo sourceUrl. + * @member {string} sourceUrl + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.sourceUrl = ""; + + /** + * ExternalAdReplyInfo containsAutoReply. + * @member {boolean} containsAutoReply + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.containsAutoReply = false; + + /** + * ExternalAdReplyInfo renderLargerThumbnail. + * @member {boolean} renderLargerThumbnail + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.renderLargerThumbnail = false; + + /** + * ExternalAdReplyInfo showAdAttribution. + * @member {boolean} showAdAttribution + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.showAdAttribution = false; + + /** + * ExternalAdReplyInfo ctwaClid. + * @member {string} ctwaClid + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + */ + ExternalAdReplyInfo.prototype.ctwaClid = ""; + + /** + * Creates a new ExternalAdReplyInfo instance using the specified properties. + * @function create + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {proto.ContextInfo.IExternalAdReplyInfo=} [properties] Properties to set + * @returns {proto.ContextInfo.ExternalAdReplyInfo} ExternalAdReplyInfo instance + */ + ExternalAdReplyInfo.create = function create(properties) { + return new ExternalAdReplyInfo(properties); + }; + + /** + * Encodes the specified ExternalAdReplyInfo message. Does not implicitly {@link proto.ContextInfo.ExternalAdReplyInfo.verify|verify} messages. + * @function encode + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {proto.ContextInfo.IExternalAdReplyInfo} message ExternalAdReplyInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalAdReplyInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.body); + if (message.mediaType != null && Object.hasOwnProperty.call(message, "mediaType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mediaType); + if (message.thumbnailUrl != null && Object.hasOwnProperty.call(message, "thumbnailUrl")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.thumbnailUrl); + if (message.mediaUrl != null && Object.hasOwnProperty.call(message, "mediaUrl")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.mediaUrl); + if (message.thumbnail != null && Object.hasOwnProperty.call(message, "thumbnail")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.thumbnail); + if (message.sourceType != null && Object.hasOwnProperty.call(message, "sourceType")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.sourceType); + if (message.sourceId != null && Object.hasOwnProperty.call(message, "sourceId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.sourceId); + if (message.sourceUrl != null && Object.hasOwnProperty.call(message, "sourceUrl")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.sourceUrl); + if (message.containsAutoReply != null && Object.hasOwnProperty.call(message, "containsAutoReply")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.containsAutoReply); + if (message.renderLargerThumbnail != null && Object.hasOwnProperty.call(message, "renderLargerThumbnail")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.renderLargerThumbnail); + if (message.showAdAttribution != null && Object.hasOwnProperty.call(message, "showAdAttribution")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.showAdAttribution); + if (message.ctwaClid != null && Object.hasOwnProperty.call(message, "ctwaClid")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.ctwaClid); + return writer; + }; + + /** + * Encodes the specified ExternalAdReplyInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.ExternalAdReplyInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {proto.ContextInfo.IExternalAdReplyInfo} message ExternalAdReplyInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalAdReplyInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExternalAdReplyInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ContextInfo.ExternalAdReplyInfo} ExternalAdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalAdReplyInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ContextInfo.ExternalAdReplyInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.body = reader.string(); + break; + case 3: + message.mediaType = reader.int32(); + break; + case 4: + message.thumbnailUrl = reader.string(); + break; + case 5: + message.mediaUrl = reader.string(); + break; + case 6: + message.thumbnail = reader.bytes(); + break; + case 7: + message.sourceType = reader.string(); + break; + case 8: + message.sourceId = reader.string(); + break; + case 9: + message.sourceUrl = reader.string(); + break; + case 10: + message.containsAutoReply = reader.bool(); + break; + case 11: + message.renderLargerThumbnail = reader.bool(); + break; + case 12: + message.showAdAttribution = reader.bool(); + break; + case 13: + message.ctwaClid = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExternalAdReplyInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ContextInfo.ExternalAdReplyInfo} ExternalAdReplyInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalAdReplyInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExternalAdReplyInfo message. + * @function verify + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExternalAdReplyInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + switch (message.mediaType) { + default: + return "mediaType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.thumbnailUrl != null && message.hasOwnProperty("thumbnailUrl")) + if (!$util.isString(message.thumbnailUrl)) + return "thumbnailUrl: string expected"; + if (message.mediaUrl != null && message.hasOwnProperty("mediaUrl")) + if (!$util.isString(message.mediaUrl)) + return "mediaUrl: string expected"; + if (message.thumbnail != null && message.hasOwnProperty("thumbnail")) + if (!(message.thumbnail && typeof message.thumbnail.length === "number" || $util.isString(message.thumbnail))) + return "thumbnail: buffer expected"; + if (message.sourceType != null && message.hasOwnProperty("sourceType")) + if (!$util.isString(message.sourceType)) + return "sourceType: string expected"; + if (message.sourceId != null && message.hasOwnProperty("sourceId")) + if (!$util.isString(message.sourceId)) + return "sourceId: string expected"; + if (message.sourceUrl != null && message.hasOwnProperty("sourceUrl")) + if (!$util.isString(message.sourceUrl)) + return "sourceUrl: string expected"; + if (message.containsAutoReply != null && message.hasOwnProperty("containsAutoReply")) + if (typeof message.containsAutoReply !== "boolean") + return "containsAutoReply: boolean expected"; + if (message.renderLargerThumbnail != null && message.hasOwnProperty("renderLargerThumbnail")) + if (typeof message.renderLargerThumbnail !== "boolean") + return "renderLargerThumbnail: boolean expected"; + if (message.showAdAttribution != null && message.hasOwnProperty("showAdAttribution")) + if (typeof message.showAdAttribution !== "boolean") + return "showAdAttribution: boolean expected"; + if (message.ctwaClid != null && message.hasOwnProperty("ctwaClid")) + if (!$util.isString(message.ctwaClid)) + return "ctwaClid: string expected"; + return null; + }; + + /** + * Creates an ExternalAdReplyInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.ContextInfo.ExternalAdReplyInfo} ExternalAdReplyInfo + */ + ExternalAdReplyInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ContextInfo.ExternalAdReplyInfo) + return object; + var message = new $root.proto.ContextInfo.ExternalAdReplyInfo(); + if (object.title != null) + message.title = String(object.title); + if (object.body != null) + message.body = String(object.body); + switch (object.mediaType) { + case "NONE": + case 0: + message.mediaType = 0; + break; + case "IMAGE": + case 1: + message.mediaType = 1; + break; + case "VIDEO": + case 2: + message.mediaType = 2; + break; + } + if (object.thumbnailUrl != null) + message.thumbnailUrl = String(object.thumbnailUrl); + if (object.mediaUrl != null) + message.mediaUrl = String(object.mediaUrl); + if (object.thumbnail != null) + if (typeof object.thumbnail === "string") + $util.base64.decode(object.thumbnail, message.thumbnail = $util.newBuffer($util.base64.length(object.thumbnail)), 0); + else if (object.thumbnail.length) + message.thumbnail = object.thumbnail; + if (object.sourceType != null) + message.sourceType = String(object.sourceType); + if (object.sourceId != null) + message.sourceId = String(object.sourceId); + if (object.sourceUrl != null) + message.sourceUrl = String(object.sourceUrl); + if (object.containsAutoReply != null) + message.containsAutoReply = Boolean(object.containsAutoReply); + if (object.renderLargerThumbnail != null) + message.renderLargerThumbnail = Boolean(object.renderLargerThumbnail); + if (object.showAdAttribution != null) + message.showAdAttribution = Boolean(object.showAdAttribution); + if (object.ctwaClid != null) + message.ctwaClid = String(object.ctwaClid); + return message; + }; + + /** + * Creates a plain object from an ExternalAdReplyInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @static + * @param {proto.ContextInfo.ExternalAdReplyInfo} message ExternalAdReplyInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExternalAdReplyInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.title = ""; + object.body = ""; + object.mediaType = options.enums === String ? "NONE" : 0; + object.thumbnailUrl = ""; + object.mediaUrl = ""; + if (options.bytes === String) + object.thumbnail = ""; + else { + object.thumbnail = []; + if (options.bytes !== Array) + object.thumbnail = $util.newBuffer(object.thumbnail); + } + object.sourceType = ""; + object.sourceId = ""; + object.sourceUrl = ""; + object.containsAutoReply = false; + object.renderLargerThumbnail = false; + object.showAdAttribution = false; + object.ctwaClid = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + object.mediaType = options.enums === String ? $root.proto.ContextInfo.ExternalAdReplyInfo.MediaType[message.mediaType] : message.mediaType; + if (message.thumbnailUrl != null && message.hasOwnProperty("thumbnailUrl")) + object.thumbnailUrl = message.thumbnailUrl; + if (message.mediaUrl != null && message.hasOwnProperty("mediaUrl")) + object.mediaUrl = message.mediaUrl; + if (message.thumbnail != null && message.hasOwnProperty("thumbnail")) + object.thumbnail = options.bytes === String ? $util.base64.encode(message.thumbnail, 0, message.thumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnail) : message.thumbnail; + if (message.sourceType != null && message.hasOwnProperty("sourceType")) + object.sourceType = message.sourceType; + if (message.sourceId != null && message.hasOwnProperty("sourceId")) + object.sourceId = message.sourceId; + if (message.sourceUrl != null && message.hasOwnProperty("sourceUrl")) + object.sourceUrl = message.sourceUrl; + if (message.containsAutoReply != null && message.hasOwnProperty("containsAutoReply")) + object.containsAutoReply = message.containsAutoReply; + if (message.renderLargerThumbnail != null && message.hasOwnProperty("renderLargerThumbnail")) + object.renderLargerThumbnail = message.renderLargerThumbnail; + if (message.showAdAttribution != null && message.hasOwnProperty("showAdAttribution")) + object.showAdAttribution = message.showAdAttribution; + if (message.ctwaClid != null && message.hasOwnProperty("ctwaClid")) + object.ctwaClid = message.ctwaClid; + return object; + }; + + /** + * Converts this ExternalAdReplyInfo to JSON. + * @function toJSON + * @memberof proto.ContextInfo.ExternalAdReplyInfo + * @instance + * @returns {Object.} JSON object + */ + ExternalAdReplyInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * MediaType enum. + * @name proto.ContextInfo.ExternalAdReplyInfo.MediaType + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} IMAGE=1 IMAGE value + * @property {number} VIDEO=2 VIDEO value + */ + ExternalAdReplyInfo.MediaType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "IMAGE"] = 1; + values[valuesById[2] = "VIDEO"] = 2; + return values; + })(); + + return ExternalAdReplyInfo; + })(); + + ContextInfo.UTMInfo = (function() { + + /** + * Properties of a UTMInfo. + * @memberof proto.ContextInfo + * @interface IUTMInfo + * @property {string|null} [utmSource] UTMInfo utmSource + * @property {string|null} [utmCampaign] UTMInfo utmCampaign + */ + + /** + * Constructs a new UTMInfo. + * @memberof proto.ContextInfo + * @classdesc Represents a UTMInfo. + * @implements IUTMInfo + * @constructor + * @param {proto.ContextInfo.IUTMInfo=} [properties] Properties to set + */ + function UTMInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UTMInfo utmSource. + * @member {string} utmSource + * @memberof proto.ContextInfo.UTMInfo + * @instance + */ + UTMInfo.prototype.utmSource = ""; + + /** + * UTMInfo utmCampaign. + * @member {string} utmCampaign + * @memberof proto.ContextInfo.UTMInfo + * @instance + */ + UTMInfo.prototype.utmCampaign = ""; + + /** + * Creates a new UTMInfo instance using the specified properties. + * @function create + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {proto.ContextInfo.IUTMInfo=} [properties] Properties to set + * @returns {proto.ContextInfo.UTMInfo} UTMInfo instance + */ + UTMInfo.create = function create(properties) { + return new UTMInfo(properties); + }; + + /** + * Encodes the specified UTMInfo message. Does not implicitly {@link proto.ContextInfo.UTMInfo.verify|verify} messages. + * @function encode + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {proto.ContextInfo.IUTMInfo} message UTMInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UTMInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.utmSource != null && Object.hasOwnProperty.call(message, "utmSource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.utmSource); + if (message.utmCampaign != null && Object.hasOwnProperty.call(message, "utmCampaign")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.utmCampaign); + return writer; + }; + + /** + * Encodes the specified UTMInfo message, length delimited. Does not implicitly {@link proto.ContextInfo.UTMInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {proto.ContextInfo.IUTMInfo} message UTMInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UTMInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UTMInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ContextInfo.UTMInfo} UTMInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UTMInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ContextInfo.UTMInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.utmSource = reader.string(); + break; + case 2: + message.utmCampaign = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UTMInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ContextInfo.UTMInfo} UTMInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UTMInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UTMInfo message. + * @function verify + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UTMInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.utmSource != null && message.hasOwnProperty("utmSource")) + if (!$util.isString(message.utmSource)) + return "utmSource: string expected"; + if (message.utmCampaign != null && message.hasOwnProperty("utmCampaign")) + if (!$util.isString(message.utmCampaign)) + return "utmCampaign: string expected"; + return null; + }; + + /** + * Creates a UTMInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.ContextInfo.UTMInfo} UTMInfo + */ + UTMInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ContextInfo.UTMInfo) + return object; + var message = new $root.proto.ContextInfo.UTMInfo(); + if (object.utmSource != null) + message.utmSource = String(object.utmSource); + if (object.utmCampaign != null) + message.utmCampaign = String(object.utmCampaign); + return message; + }; + + /** + * Creates a plain object from a UTMInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ContextInfo.UTMInfo + * @static + * @param {proto.ContextInfo.UTMInfo} message UTMInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UTMInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.utmSource = ""; + object.utmCampaign = ""; + } + if (message.utmSource != null && message.hasOwnProperty("utmSource")) + object.utmSource = message.utmSource; + if (message.utmCampaign != null && message.hasOwnProperty("utmCampaign")) + object.utmCampaign = message.utmCampaign; + return object; + }; + + /** + * Converts this UTMInfo to JSON. + * @function toJSON + * @memberof proto.ContextInfo.UTMInfo + * @instance + * @returns {Object.} JSON object + */ + UTMInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UTMInfo; + })(); + + return ContextInfo; + })(); + + proto.Conversation = (function() { + + /** + * Properties of a Conversation. + * @memberof proto + * @interface IConversation + * @property {string} id Conversation id + * @property {Array.|null} [messages] Conversation messages + * @property {string|null} [newJid] Conversation newJid + * @property {string|null} [oldJid] Conversation oldJid + * @property {number|Long|null} [lastMsgTimestamp] Conversation lastMsgTimestamp + * @property {number|null} [unreadCount] Conversation unreadCount + * @property {boolean|null} [readOnly] Conversation readOnly + * @property {boolean|null} [endOfHistoryTransfer] Conversation endOfHistoryTransfer + * @property {number|null} [ephemeralExpiration] Conversation ephemeralExpiration + * @property {number|Long|null} [ephemeralSettingTimestamp] Conversation ephemeralSettingTimestamp + * @property {proto.Conversation.EndOfHistoryTransferType|null} [endOfHistoryTransferType] Conversation endOfHistoryTransferType + * @property {number|Long|null} [conversationTimestamp] Conversation conversationTimestamp + * @property {string|null} [name] Conversation name + * @property {string|null} [pHash] Conversation pHash + * @property {boolean|null} [notSpam] Conversation notSpam + * @property {boolean|null} [archived] Conversation archived + * @property {proto.IDisappearingMode|null} [disappearingMode] Conversation disappearingMode + * @property {number|null} [unreadMentionCount] Conversation unreadMentionCount + * @property {boolean|null} [markedAsUnread] Conversation markedAsUnread + * @property {Array.|null} [participant] Conversation participant + * @property {Uint8Array|null} [tcToken] Conversation tcToken + * @property {number|Long|null} [tcTokenTimestamp] Conversation tcTokenTimestamp + * @property {Uint8Array|null} [contactPrimaryIdentityKey] Conversation contactPrimaryIdentityKey + * @property {number|null} [pinned] Conversation pinned + * @property {number|Long|null} [muteEndTime] Conversation muteEndTime + * @property {proto.IWallpaperSettings|null} [wallpaper] Conversation wallpaper + * @property {proto.MediaVisibility|null} [mediaVisibility] Conversation mediaVisibility + * @property {number|Long|null} [tcTokenSenderTimestamp] Conversation tcTokenSenderTimestamp + * @property {boolean|null} [suspended] Conversation suspended + * @property {boolean|null} [terminated] Conversation terminated + * @property {number|Long|null} [createdAt] Conversation createdAt + * @property {string|null} [createdBy] Conversation createdBy + * @property {string|null} [description] Conversation description + * @property {boolean|null} [support] Conversation support + * @property {boolean|null} [isParentGroup] Conversation isParentGroup + * @property {string|null} [parentGroupId] Conversation parentGroupId + * @property {boolean|null} [isDefaultSubgroup] Conversation isDefaultSubgroup + * @property {string|null} [displayName] Conversation displayName + * @property {string|null} [pnJid] Conversation pnJid + * @property {boolean|null} [shareOwnPn] Conversation shareOwnPn + * @property {boolean|null} [pnhDuplicateLidThread] Conversation pnhDuplicateLidThread + * @property {string|null} [lidJid] Conversation lidJid + */ + + /** + * Constructs a new Conversation. + * @memberof proto + * @classdesc Represents a Conversation. + * @implements IConversation + * @constructor + * @param {proto.IConversation=} [properties] Properties to set + */ + function Conversation(properties) { + this.messages = []; + this.participant = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Conversation id. + * @member {string} id + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.id = ""; + + /** + * Conversation messages. + * @member {Array.} messages + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.messages = $util.emptyArray; + + /** + * Conversation newJid. + * @member {string} newJid + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.newJid = ""; + + /** + * Conversation oldJid. + * @member {string} oldJid + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.oldJid = ""; + + /** + * Conversation lastMsgTimestamp. + * @member {number|Long} lastMsgTimestamp + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.lastMsgTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Conversation unreadCount. + * @member {number} unreadCount + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.unreadCount = 0; + + /** + * Conversation readOnly. + * @member {boolean} readOnly + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.readOnly = false; + + /** + * Conversation endOfHistoryTransfer. + * @member {boolean} endOfHistoryTransfer + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.endOfHistoryTransfer = false; + + /** + * Conversation ephemeralExpiration. + * @member {number} ephemeralExpiration + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.ephemeralExpiration = 0; + + /** + * Conversation ephemeralSettingTimestamp. + * @member {number|Long} ephemeralSettingTimestamp + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.ephemeralSettingTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Conversation endOfHistoryTransferType. + * @member {proto.Conversation.EndOfHistoryTransferType} endOfHistoryTransferType + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.endOfHistoryTransferType = 0; + + /** + * Conversation conversationTimestamp. + * @member {number|Long} conversationTimestamp + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.conversationTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Conversation name. + * @member {string} name + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.name = ""; + + /** + * Conversation pHash. + * @member {string} pHash + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.pHash = ""; + + /** + * Conversation notSpam. + * @member {boolean} notSpam + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.notSpam = false; + + /** + * Conversation archived. + * @member {boolean} archived + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.archived = false; + + /** + * Conversation disappearingMode. + * @member {proto.IDisappearingMode|null|undefined} disappearingMode + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.disappearingMode = null; + + /** + * Conversation unreadMentionCount. + * @member {number} unreadMentionCount + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.unreadMentionCount = 0; + + /** + * Conversation markedAsUnread. + * @member {boolean} markedAsUnread + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.markedAsUnread = false; + + /** + * Conversation participant. + * @member {Array.} participant + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.participant = $util.emptyArray; + + /** + * Conversation tcToken. + * @member {Uint8Array} tcToken + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.tcToken = $util.newBuffer([]); + + /** + * Conversation tcTokenTimestamp. + * @member {number|Long} tcTokenTimestamp + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.tcTokenTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Conversation contactPrimaryIdentityKey. + * @member {Uint8Array} contactPrimaryIdentityKey + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.contactPrimaryIdentityKey = $util.newBuffer([]); + + /** + * Conversation pinned. + * @member {number} pinned + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.pinned = 0; + + /** + * Conversation muteEndTime. + * @member {number|Long} muteEndTime + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.muteEndTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Conversation wallpaper. + * @member {proto.IWallpaperSettings|null|undefined} wallpaper + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.wallpaper = null; + + /** + * Conversation mediaVisibility. + * @member {proto.MediaVisibility} mediaVisibility + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.mediaVisibility = 0; + + /** + * Conversation tcTokenSenderTimestamp. + * @member {number|Long} tcTokenSenderTimestamp + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.tcTokenSenderTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Conversation suspended. + * @member {boolean} suspended + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.suspended = false; + + /** + * Conversation terminated. + * @member {boolean} terminated + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.terminated = false; + + /** + * Conversation createdAt. + * @member {number|Long} createdAt + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.createdAt = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Conversation createdBy. + * @member {string} createdBy + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.createdBy = ""; + + /** + * Conversation description. + * @member {string} description + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.description = ""; + + /** + * Conversation support. + * @member {boolean} support + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.support = false; + + /** + * Conversation isParentGroup. + * @member {boolean} isParentGroup + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.isParentGroup = false; + + /** + * Conversation parentGroupId. + * @member {string} parentGroupId + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.parentGroupId = ""; + + /** + * Conversation isDefaultSubgroup. + * @member {boolean} isDefaultSubgroup + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.isDefaultSubgroup = false; + + /** + * Conversation displayName. + * @member {string} displayName + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.displayName = ""; + + /** + * Conversation pnJid. + * @member {string} pnJid + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.pnJid = ""; + + /** + * Conversation shareOwnPn. + * @member {boolean} shareOwnPn + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.shareOwnPn = false; + + /** + * Conversation pnhDuplicateLidThread. + * @member {boolean} pnhDuplicateLidThread + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.pnhDuplicateLidThread = false; + + /** + * Conversation lidJid. + * @member {string} lidJid + * @memberof proto.Conversation + * @instance + */ + Conversation.prototype.lidJid = ""; + + /** + * Creates a new Conversation instance using the specified properties. + * @function create + * @memberof proto.Conversation + * @static + * @param {proto.IConversation=} [properties] Properties to set + * @returns {proto.Conversation} Conversation instance + */ + Conversation.create = function create(properties) { + return new Conversation(properties); + }; + + /** + * Encodes the specified Conversation message. Does not implicitly {@link proto.Conversation.verify|verify} messages. + * @function encode + * @memberof proto.Conversation + * @static + * @param {proto.IConversation} message Conversation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Conversation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.proto.HistorySyncMsg.encode(message.messages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.newJid != null && Object.hasOwnProperty.call(message, "newJid")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.newJid); + if (message.oldJid != null && Object.hasOwnProperty.call(message, "oldJid")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.oldJid); + if (message.lastMsgTimestamp != null && Object.hasOwnProperty.call(message, "lastMsgTimestamp")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.lastMsgTimestamp); + if (message.unreadCount != null && Object.hasOwnProperty.call(message, "unreadCount")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.unreadCount); + if (message.readOnly != null && Object.hasOwnProperty.call(message, "readOnly")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.readOnly); + if (message.endOfHistoryTransfer != null && Object.hasOwnProperty.call(message, "endOfHistoryTransfer")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.endOfHistoryTransfer); + if (message.ephemeralExpiration != null && Object.hasOwnProperty.call(message, "ephemeralExpiration")) + writer.uint32(/* id 9, wireType 0 =*/72).uint32(message.ephemeralExpiration); + if (message.ephemeralSettingTimestamp != null && Object.hasOwnProperty.call(message, "ephemeralSettingTimestamp")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.ephemeralSettingTimestamp); + if (message.endOfHistoryTransferType != null && Object.hasOwnProperty.call(message, "endOfHistoryTransferType")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.endOfHistoryTransferType); + if (message.conversationTimestamp != null && Object.hasOwnProperty.call(message, "conversationTimestamp")) + writer.uint32(/* id 12, wireType 0 =*/96).uint64(message.conversationTimestamp); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.name); + if (message.pHash != null && Object.hasOwnProperty.call(message, "pHash")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.pHash); + if (message.notSpam != null && Object.hasOwnProperty.call(message, "notSpam")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.notSpam); + if (message.archived != null && Object.hasOwnProperty.call(message, "archived")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.archived); + if (message.disappearingMode != null && Object.hasOwnProperty.call(message, "disappearingMode")) + $root.proto.DisappearingMode.encode(message.disappearingMode, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.unreadMentionCount != null && Object.hasOwnProperty.call(message, "unreadMentionCount")) + writer.uint32(/* id 18, wireType 0 =*/144).uint32(message.unreadMentionCount); + if (message.markedAsUnread != null && Object.hasOwnProperty.call(message, "markedAsUnread")) + writer.uint32(/* id 19, wireType 0 =*/152).bool(message.markedAsUnread); + if (message.participant != null && message.participant.length) + for (var i = 0; i < message.participant.length; ++i) + $root.proto.GroupParticipant.encode(message.participant[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.tcToken != null && Object.hasOwnProperty.call(message, "tcToken")) + writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.tcToken); + if (message.tcTokenTimestamp != null && Object.hasOwnProperty.call(message, "tcTokenTimestamp")) + writer.uint32(/* id 22, wireType 0 =*/176).uint64(message.tcTokenTimestamp); + if (message.contactPrimaryIdentityKey != null && Object.hasOwnProperty.call(message, "contactPrimaryIdentityKey")) + writer.uint32(/* id 23, wireType 2 =*/186).bytes(message.contactPrimaryIdentityKey); + if (message.pinned != null && Object.hasOwnProperty.call(message, "pinned")) + writer.uint32(/* id 24, wireType 0 =*/192).uint32(message.pinned); + if (message.muteEndTime != null && Object.hasOwnProperty.call(message, "muteEndTime")) + writer.uint32(/* id 25, wireType 0 =*/200).uint64(message.muteEndTime); + if (message.wallpaper != null && Object.hasOwnProperty.call(message, "wallpaper")) + $root.proto.WallpaperSettings.encode(message.wallpaper, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.mediaVisibility != null && Object.hasOwnProperty.call(message, "mediaVisibility")) + writer.uint32(/* id 27, wireType 0 =*/216).int32(message.mediaVisibility); + if (message.tcTokenSenderTimestamp != null && Object.hasOwnProperty.call(message, "tcTokenSenderTimestamp")) + writer.uint32(/* id 28, wireType 0 =*/224).uint64(message.tcTokenSenderTimestamp); + if (message.suspended != null && Object.hasOwnProperty.call(message, "suspended")) + writer.uint32(/* id 29, wireType 0 =*/232).bool(message.suspended); + if (message.terminated != null && Object.hasOwnProperty.call(message, "terminated")) + writer.uint32(/* id 30, wireType 0 =*/240).bool(message.terminated); + if (message.createdAt != null && Object.hasOwnProperty.call(message, "createdAt")) + writer.uint32(/* id 31, wireType 0 =*/248).uint64(message.createdAt); + if (message.createdBy != null && Object.hasOwnProperty.call(message, "createdBy")) + writer.uint32(/* id 32, wireType 2 =*/258).string(message.createdBy); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 33, wireType 2 =*/266).string(message.description); + if (message.support != null && Object.hasOwnProperty.call(message, "support")) + writer.uint32(/* id 34, wireType 0 =*/272).bool(message.support); + if (message.isParentGroup != null && Object.hasOwnProperty.call(message, "isParentGroup")) + writer.uint32(/* id 35, wireType 0 =*/280).bool(message.isParentGroup); + if (message.isDefaultSubgroup != null && Object.hasOwnProperty.call(message, "isDefaultSubgroup")) + writer.uint32(/* id 36, wireType 0 =*/288).bool(message.isDefaultSubgroup); + if (message.parentGroupId != null && Object.hasOwnProperty.call(message, "parentGroupId")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.parentGroupId); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 38, wireType 2 =*/306).string(message.displayName); + if (message.pnJid != null && Object.hasOwnProperty.call(message, "pnJid")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.pnJid); + if (message.shareOwnPn != null && Object.hasOwnProperty.call(message, "shareOwnPn")) + writer.uint32(/* id 40, wireType 0 =*/320).bool(message.shareOwnPn); + if (message.pnhDuplicateLidThread != null && Object.hasOwnProperty.call(message, "pnhDuplicateLidThread")) + writer.uint32(/* id 41, wireType 0 =*/328).bool(message.pnhDuplicateLidThread); + if (message.lidJid != null && Object.hasOwnProperty.call(message, "lidJid")) + writer.uint32(/* id 42, wireType 2 =*/338).string(message.lidJid); + return writer; + }; + + /** + * Encodes the specified Conversation message, length delimited. Does not implicitly {@link proto.Conversation.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Conversation + * @static + * @param {proto.IConversation} message Conversation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Conversation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Conversation message from the specified reader or buffer. + * @function decode + * @memberof proto.Conversation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Conversation} Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Conversation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Conversation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.proto.HistorySyncMsg.decode(reader, reader.uint32())); + break; + case 3: + message.newJid = reader.string(); + break; + case 4: + message.oldJid = reader.string(); + break; + case 5: + message.lastMsgTimestamp = reader.uint64(); + break; + case 6: + message.unreadCount = reader.uint32(); + break; + case 7: + message.readOnly = reader.bool(); + break; + case 8: + message.endOfHistoryTransfer = reader.bool(); + break; + case 9: + message.ephemeralExpiration = reader.uint32(); + break; + case 10: + message.ephemeralSettingTimestamp = reader.int64(); + break; + case 11: + message.endOfHistoryTransferType = reader.int32(); + break; + case 12: + message.conversationTimestamp = reader.uint64(); + break; + case 13: + message.name = reader.string(); + break; + case 14: + message.pHash = reader.string(); + break; + case 15: + message.notSpam = reader.bool(); + break; + case 16: + message.archived = reader.bool(); + break; + case 17: + message.disappearingMode = $root.proto.DisappearingMode.decode(reader, reader.uint32()); + break; + case 18: + message.unreadMentionCount = reader.uint32(); + break; + case 19: + message.markedAsUnread = reader.bool(); + break; + case 20: + if (!(message.participant && message.participant.length)) + message.participant = []; + message.participant.push($root.proto.GroupParticipant.decode(reader, reader.uint32())); + break; + case 21: + message.tcToken = reader.bytes(); + break; + case 22: + message.tcTokenTimestamp = reader.uint64(); + break; + case 23: + message.contactPrimaryIdentityKey = reader.bytes(); + break; + case 24: + message.pinned = reader.uint32(); + break; + case 25: + message.muteEndTime = reader.uint64(); + break; + case 26: + message.wallpaper = $root.proto.WallpaperSettings.decode(reader, reader.uint32()); + break; + case 27: + message.mediaVisibility = reader.int32(); + break; + case 28: + message.tcTokenSenderTimestamp = reader.uint64(); + break; + case 29: + message.suspended = reader.bool(); + break; + case 30: + message.terminated = reader.bool(); + break; + case 31: + message.createdAt = reader.uint64(); + break; + case 32: + message.createdBy = reader.string(); + break; + case 33: + message.description = reader.string(); + break; + case 34: + message.support = reader.bool(); + break; + case 35: + message.isParentGroup = reader.bool(); + break; + case 37: + message.parentGroupId = reader.string(); + break; + case 36: + message.isDefaultSubgroup = reader.bool(); + break; + case 38: + message.displayName = reader.string(); + break; + case 39: + message.pnJid = reader.string(); + break; + case 40: + message.shareOwnPn = reader.bool(); + break; + case 41: + message.pnhDuplicateLidThread = reader.bool(); + break; + case 42: + message.lidJid = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("id")) + throw $util.ProtocolError("missing required 'id'", { instance: message }); + return message; + }; + + /** + * Decodes a Conversation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Conversation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Conversation} Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Conversation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Conversation message. + * @function verify + * @memberof proto.Conversation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Conversation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.proto.HistorySyncMsg.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.newJid != null && message.hasOwnProperty("newJid")) + if (!$util.isString(message.newJid)) + return "newJid: string expected"; + if (message.oldJid != null && message.hasOwnProperty("oldJid")) + if (!$util.isString(message.oldJid)) + return "oldJid: string expected"; + if (message.lastMsgTimestamp != null && message.hasOwnProperty("lastMsgTimestamp")) + if (!$util.isInteger(message.lastMsgTimestamp) && !(message.lastMsgTimestamp && $util.isInteger(message.lastMsgTimestamp.low) && $util.isInteger(message.lastMsgTimestamp.high))) + return "lastMsgTimestamp: integer|Long expected"; + if (message.unreadCount != null && message.hasOwnProperty("unreadCount")) + if (!$util.isInteger(message.unreadCount)) + return "unreadCount: integer expected"; + if (message.readOnly != null && message.hasOwnProperty("readOnly")) + if (typeof message.readOnly !== "boolean") + return "readOnly: boolean expected"; + if (message.endOfHistoryTransfer != null && message.hasOwnProperty("endOfHistoryTransfer")) + if (typeof message.endOfHistoryTransfer !== "boolean") + return "endOfHistoryTransfer: boolean expected"; + if (message.ephemeralExpiration != null && message.hasOwnProperty("ephemeralExpiration")) + if (!$util.isInteger(message.ephemeralExpiration)) + return "ephemeralExpiration: integer expected"; + if (message.ephemeralSettingTimestamp != null && message.hasOwnProperty("ephemeralSettingTimestamp")) + if (!$util.isInteger(message.ephemeralSettingTimestamp) && !(message.ephemeralSettingTimestamp && $util.isInteger(message.ephemeralSettingTimestamp.low) && $util.isInteger(message.ephemeralSettingTimestamp.high))) + return "ephemeralSettingTimestamp: integer|Long expected"; + if (message.endOfHistoryTransferType != null && message.hasOwnProperty("endOfHistoryTransferType")) + switch (message.endOfHistoryTransferType) { + default: + return "endOfHistoryTransferType: enum value expected"; + case 0: + case 1: + break; + } + if (message.conversationTimestamp != null && message.hasOwnProperty("conversationTimestamp")) + if (!$util.isInteger(message.conversationTimestamp) && !(message.conversationTimestamp && $util.isInteger(message.conversationTimestamp.low) && $util.isInteger(message.conversationTimestamp.high))) + return "conversationTimestamp: integer|Long expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.pHash != null && message.hasOwnProperty("pHash")) + if (!$util.isString(message.pHash)) + return "pHash: string expected"; + if (message.notSpam != null && message.hasOwnProperty("notSpam")) + if (typeof message.notSpam !== "boolean") + return "notSpam: boolean expected"; + if (message.archived != null && message.hasOwnProperty("archived")) + if (typeof message.archived !== "boolean") + return "archived: boolean expected"; + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) { + var error = $root.proto.DisappearingMode.verify(message.disappearingMode); + if (error) + return "disappearingMode." + error; + } + if (message.unreadMentionCount != null && message.hasOwnProperty("unreadMentionCount")) + if (!$util.isInteger(message.unreadMentionCount)) + return "unreadMentionCount: integer expected"; + if (message.markedAsUnread != null && message.hasOwnProperty("markedAsUnread")) + if (typeof message.markedAsUnread !== "boolean") + return "markedAsUnread: boolean expected"; + if (message.participant != null && message.hasOwnProperty("participant")) { + if (!Array.isArray(message.participant)) + return "participant: array expected"; + for (var i = 0; i < message.participant.length; ++i) { + var error = $root.proto.GroupParticipant.verify(message.participant[i]); + if (error) + return "participant." + error; + } + } + if (message.tcToken != null && message.hasOwnProperty("tcToken")) + if (!(message.tcToken && typeof message.tcToken.length === "number" || $util.isString(message.tcToken))) + return "tcToken: buffer expected"; + if (message.tcTokenTimestamp != null && message.hasOwnProperty("tcTokenTimestamp")) + if (!$util.isInteger(message.tcTokenTimestamp) && !(message.tcTokenTimestamp && $util.isInteger(message.tcTokenTimestamp.low) && $util.isInteger(message.tcTokenTimestamp.high))) + return "tcTokenTimestamp: integer|Long expected"; + if (message.contactPrimaryIdentityKey != null && message.hasOwnProperty("contactPrimaryIdentityKey")) + if (!(message.contactPrimaryIdentityKey && typeof message.contactPrimaryIdentityKey.length === "number" || $util.isString(message.contactPrimaryIdentityKey))) + return "contactPrimaryIdentityKey: buffer expected"; + if (message.pinned != null && message.hasOwnProperty("pinned")) + if (!$util.isInteger(message.pinned)) + return "pinned: integer expected"; + if (message.muteEndTime != null && message.hasOwnProperty("muteEndTime")) + if (!$util.isInteger(message.muteEndTime) && !(message.muteEndTime && $util.isInteger(message.muteEndTime.low) && $util.isInteger(message.muteEndTime.high))) + return "muteEndTime: integer|Long expected"; + if (message.wallpaper != null && message.hasOwnProperty("wallpaper")) { + var error = $root.proto.WallpaperSettings.verify(message.wallpaper); + if (error) + return "wallpaper." + error; + } + if (message.mediaVisibility != null && message.hasOwnProperty("mediaVisibility")) + switch (message.mediaVisibility) { + default: + return "mediaVisibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.tcTokenSenderTimestamp != null && message.hasOwnProperty("tcTokenSenderTimestamp")) + if (!$util.isInteger(message.tcTokenSenderTimestamp) && !(message.tcTokenSenderTimestamp && $util.isInteger(message.tcTokenSenderTimestamp.low) && $util.isInteger(message.tcTokenSenderTimestamp.high))) + return "tcTokenSenderTimestamp: integer|Long expected"; + if (message.suspended != null && message.hasOwnProperty("suspended")) + if (typeof message.suspended !== "boolean") + return "suspended: boolean expected"; + if (message.terminated != null && message.hasOwnProperty("terminated")) + if (typeof message.terminated !== "boolean") + return "terminated: boolean expected"; + if (message.createdAt != null && message.hasOwnProperty("createdAt")) + if (!$util.isInteger(message.createdAt) && !(message.createdAt && $util.isInteger(message.createdAt.low) && $util.isInteger(message.createdAt.high))) + return "createdAt: integer|Long expected"; + if (message.createdBy != null && message.hasOwnProperty("createdBy")) + if (!$util.isString(message.createdBy)) + return "createdBy: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.support != null && message.hasOwnProperty("support")) + if (typeof message.support !== "boolean") + return "support: boolean expected"; + if (message.isParentGroup != null && message.hasOwnProperty("isParentGroup")) + if (typeof message.isParentGroup !== "boolean") + return "isParentGroup: boolean expected"; + if (message.parentGroupId != null && message.hasOwnProperty("parentGroupId")) + if (!$util.isString(message.parentGroupId)) + return "parentGroupId: string expected"; + if (message.isDefaultSubgroup != null && message.hasOwnProperty("isDefaultSubgroup")) + if (typeof message.isDefaultSubgroup !== "boolean") + return "isDefaultSubgroup: boolean expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.pnJid != null && message.hasOwnProperty("pnJid")) + if (!$util.isString(message.pnJid)) + return "pnJid: string expected"; + if (message.shareOwnPn != null && message.hasOwnProperty("shareOwnPn")) + if (typeof message.shareOwnPn !== "boolean") + return "shareOwnPn: boolean expected"; + if (message.pnhDuplicateLidThread != null && message.hasOwnProperty("pnhDuplicateLidThread")) + if (typeof message.pnhDuplicateLidThread !== "boolean") + return "pnhDuplicateLidThread: boolean expected"; + if (message.lidJid != null && message.hasOwnProperty("lidJid")) + if (!$util.isString(message.lidJid)) + return "lidJid: string expected"; + return null; + }; + + /** + * Creates a Conversation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Conversation + * @static + * @param {Object.} object Plain object + * @returns {proto.Conversation} Conversation + */ + Conversation.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Conversation) + return object; + var message = new $root.proto.Conversation(); + if (object.id != null) + message.id = String(object.id); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".proto.Conversation.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".proto.Conversation.messages: object expected"); + message.messages[i] = $root.proto.HistorySyncMsg.fromObject(object.messages[i]); + } + } + if (object.newJid != null) + message.newJid = String(object.newJid); + if (object.oldJid != null) + message.oldJid = String(object.oldJid); + if (object.lastMsgTimestamp != null) + if ($util.Long) + (message.lastMsgTimestamp = $util.Long.fromValue(object.lastMsgTimestamp)).unsigned = true; + else if (typeof object.lastMsgTimestamp === "string") + message.lastMsgTimestamp = parseInt(object.lastMsgTimestamp, 10); + else if (typeof object.lastMsgTimestamp === "number") + message.lastMsgTimestamp = object.lastMsgTimestamp; + else if (typeof object.lastMsgTimestamp === "object") + message.lastMsgTimestamp = new $util.LongBits(object.lastMsgTimestamp.low >>> 0, object.lastMsgTimestamp.high >>> 0).toNumber(true); + if (object.unreadCount != null) + message.unreadCount = object.unreadCount >>> 0; + if (object.readOnly != null) + message.readOnly = Boolean(object.readOnly); + if (object.endOfHistoryTransfer != null) + message.endOfHistoryTransfer = Boolean(object.endOfHistoryTransfer); + if (object.ephemeralExpiration != null) + message.ephemeralExpiration = object.ephemeralExpiration >>> 0; + if (object.ephemeralSettingTimestamp != null) + if ($util.Long) + (message.ephemeralSettingTimestamp = $util.Long.fromValue(object.ephemeralSettingTimestamp)).unsigned = false; + else if (typeof object.ephemeralSettingTimestamp === "string") + message.ephemeralSettingTimestamp = parseInt(object.ephemeralSettingTimestamp, 10); + else if (typeof object.ephemeralSettingTimestamp === "number") + message.ephemeralSettingTimestamp = object.ephemeralSettingTimestamp; + else if (typeof object.ephemeralSettingTimestamp === "object") + message.ephemeralSettingTimestamp = new $util.LongBits(object.ephemeralSettingTimestamp.low >>> 0, object.ephemeralSettingTimestamp.high >>> 0).toNumber(); + switch (object.endOfHistoryTransferType) { + case "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY": + case 0: + message.endOfHistoryTransferType = 0; + break; + case "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY": + case 1: + message.endOfHistoryTransferType = 1; + break; + } + if (object.conversationTimestamp != null) + if ($util.Long) + (message.conversationTimestamp = $util.Long.fromValue(object.conversationTimestamp)).unsigned = true; + else if (typeof object.conversationTimestamp === "string") + message.conversationTimestamp = parseInt(object.conversationTimestamp, 10); + else if (typeof object.conversationTimestamp === "number") + message.conversationTimestamp = object.conversationTimestamp; + else if (typeof object.conversationTimestamp === "object") + message.conversationTimestamp = new $util.LongBits(object.conversationTimestamp.low >>> 0, object.conversationTimestamp.high >>> 0).toNumber(true); + if (object.name != null) + message.name = String(object.name); + if (object.pHash != null) + message.pHash = String(object.pHash); + if (object.notSpam != null) + message.notSpam = Boolean(object.notSpam); + if (object.archived != null) + message.archived = Boolean(object.archived); + if (object.disappearingMode != null) { + if (typeof object.disappearingMode !== "object") + throw TypeError(".proto.Conversation.disappearingMode: object expected"); + message.disappearingMode = $root.proto.DisappearingMode.fromObject(object.disappearingMode); + } + if (object.unreadMentionCount != null) + message.unreadMentionCount = object.unreadMentionCount >>> 0; + if (object.markedAsUnread != null) + message.markedAsUnread = Boolean(object.markedAsUnread); + if (object.participant) { + if (!Array.isArray(object.participant)) + throw TypeError(".proto.Conversation.participant: array expected"); + message.participant = []; + for (var i = 0; i < object.participant.length; ++i) { + if (typeof object.participant[i] !== "object") + throw TypeError(".proto.Conversation.participant: object expected"); + message.participant[i] = $root.proto.GroupParticipant.fromObject(object.participant[i]); + } + } + if (object.tcToken != null) + if (typeof object.tcToken === "string") + $util.base64.decode(object.tcToken, message.tcToken = $util.newBuffer($util.base64.length(object.tcToken)), 0); + else if (object.tcToken.length) + message.tcToken = object.tcToken; + if (object.tcTokenTimestamp != null) + if ($util.Long) + (message.tcTokenTimestamp = $util.Long.fromValue(object.tcTokenTimestamp)).unsigned = true; + else if (typeof object.tcTokenTimestamp === "string") + message.tcTokenTimestamp = parseInt(object.tcTokenTimestamp, 10); + else if (typeof object.tcTokenTimestamp === "number") + message.tcTokenTimestamp = object.tcTokenTimestamp; + else if (typeof object.tcTokenTimestamp === "object") + message.tcTokenTimestamp = new $util.LongBits(object.tcTokenTimestamp.low >>> 0, object.tcTokenTimestamp.high >>> 0).toNumber(true); + if (object.contactPrimaryIdentityKey != null) + if (typeof object.contactPrimaryIdentityKey === "string") + $util.base64.decode(object.contactPrimaryIdentityKey, message.contactPrimaryIdentityKey = $util.newBuffer($util.base64.length(object.contactPrimaryIdentityKey)), 0); + else if (object.contactPrimaryIdentityKey.length) + message.contactPrimaryIdentityKey = object.contactPrimaryIdentityKey; + if (object.pinned != null) + message.pinned = object.pinned >>> 0; + if (object.muteEndTime != null) + if ($util.Long) + (message.muteEndTime = $util.Long.fromValue(object.muteEndTime)).unsigned = true; + else if (typeof object.muteEndTime === "string") + message.muteEndTime = parseInt(object.muteEndTime, 10); + else if (typeof object.muteEndTime === "number") + message.muteEndTime = object.muteEndTime; + else if (typeof object.muteEndTime === "object") + message.muteEndTime = new $util.LongBits(object.muteEndTime.low >>> 0, object.muteEndTime.high >>> 0).toNumber(true); + if (object.wallpaper != null) { + if (typeof object.wallpaper !== "object") + throw TypeError(".proto.Conversation.wallpaper: object expected"); + message.wallpaper = $root.proto.WallpaperSettings.fromObject(object.wallpaper); + } + switch (object.mediaVisibility) { + case "DEFAULT": + case 0: + message.mediaVisibility = 0; + break; + case "OFF": + case 1: + message.mediaVisibility = 1; + break; + case "ON": + case 2: + message.mediaVisibility = 2; + break; + } + if (object.tcTokenSenderTimestamp != null) + if ($util.Long) + (message.tcTokenSenderTimestamp = $util.Long.fromValue(object.tcTokenSenderTimestamp)).unsigned = true; + else if (typeof object.tcTokenSenderTimestamp === "string") + message.tcTokenSenderTimestamp = parseInt(object.tcTokenSenderTimestamp, 10); + else if (typeof object.tcTokenSenderTimestamp === "number") + message.tcTokenSenderTimestamp = object.tcTokenSenderTimestamp; + else if (typeof object.tcTokenSenderTimestamp === "object") + message.tcTokenSenderTimestamp = new $util.LongBits(object.tcTokenSenderTimestamp.low >>> 0, object.tcTokenSenderTimestamp.high >>> 0).toNumber(true); + if (object.suspended != null) + message.suspended = Boolean(object.suspended); + if (object.terminated != null) + message.terminated = Boolean(object.terminated); + if (object.createdAt != null) + if ($util.Long) + (message.createdAt = $util.Long.fromValue(object.createdAt)).unsigned = true; + else if (typeof object.createdAt === "string") + message.createdAt = parseInt(object.createdAt, 10); + else if (typeof object.createdAt === "number") + message.createdAt = object.createdAt; + else if (typeof object.createdAt === "object") + message.createdAt = new $util.LongBits(object.createdAt.low >>> 0, object.createdAt.high >>> 0).toNumber(true); + if (object.createdBy != null) + message.createdBy = String(object.createdBy); + if (object.description != null) + message.description = String(object.description); + if (object.support != null) + message.support = Boolean(object.support); + if (object.isParentGroup != null) + message.isParentGroup = Boolean(object.isParentGroup); + if (object.parentGroupId != null) + message.parentGroupId = String(object.parentGroupId); + if (object.isDefaultSubgroup != null) + message.isDefaultSubgroup = Boolean(object.isDefaultSubgroup); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.pnJid != null) + message.pnJid = String(object.pnJid); + if (object.shareOwnPn != null) + message.shareOwnPn = Boolean(object.shareOwnPn); + if (object.pnhDuplicateLidThread != null) + message.pnhDuplicateLidThread = Boolean(object.pnhDuplicateLidThread); + if (object.lidJid != null) + message.lidJid = String(object.lidJid); + return message; + }; + + /** + * Creates a plain object from a Conversation message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Conversation + * @static + * @param {proto.Conversation} message Conversation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Conversation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.messages = []; + object.participant = []; + } + if (options.defaults) { + object.id = ""; + object.newJid = ""; + object.oldJid = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.lastMsgTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastMsgTimestamp = options.longs === String ? "0" : 0; + object.unreadCount = 0; + object.readOnly = false; + object.endOfHistoryTransfer = false; + object.ephemeralExpiration = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ephemeralSettingTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ephemeralSettingTimestamp = options.longs === String ? "0" : 0; + object.endOfHistoryTransferType = options.enums === String ? "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.conversationTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.conversationTimestamp = options.longs === String ? "0" : 0; + object.name = ""; + object.pHash = ""; + object.notSpam = false; + object.archived = false; + object.disappearingMode = null; + object.unreadMentionCount = 0; + object.markedAsUnread = false; + if (options.bytes === String) + object.tcToken = ""; + else { + object.tcToken = []; + if (options.bytes !== Array) + object.tcToken = $util.newBuffer(object.tcToken); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.tcTokenTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.tcTokenTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.contactPrimaryIdentityKey = ""; + else { + object.contactPrimaryIdentityKey = []; + if (options.bytes !== Array) + object.contactPrimaryIdentityKey = $util.newBuffer(object.contactPrimaryIdentityKey); + } + object.pinned = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.muteEndTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.muteEndTime = options.longs === String ? "0" : 0; + object.wallpaper = null; + object.mediaVisibility = options.enums === String ? "DEFAULT" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.tcTokenSenderTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.tcTokenSenderTimestamp = options.longs === String ? "0" : 0; + object.suspended = false; + object.terminated = false; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.createdAt = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.createdAt = options.longs === String ? "0" : 0; + object.createdBy = ""; + object.description = ""; + object.support = false; + object.isParentGroup = false; + object.isDefaultSubgroup = false; + object.parentGroupId = ""; + object.displayName = ""; + object.pnJid = ""; + object.shareOwnPn = false; + object.pnhDuplicateLidThread = false; + object.lidJid = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.proto.HistorySyncMsg.toObject(message.messages[j], options); + } + if (message.newJid != null && message.hasOwnProperty("newJid")) + object.newJid = message.newJid; + if (message.oldJid != null && message.hasOwnProperty("oldJid")) + object.oldJid = message.oldJid; + if (message.lastMsgTimestamp != null && message.hasOwnProperty("lastMsgTimestamp")) + if (typeof message.lastMsgTimestamp === "number") + object.lastMsgTimestamp = options.longs === String ? String(message.lastMsgTimestamp) : message.lastMsgTimestamp; + else + object.lastMsgTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.lastMsgTimestamp) : options.longs === Number ? new $util.LongBits(message.lastMsgTimestamp.low >>> 0, message.lastMsgTimestamp.high >>> 0).toNumber(true) : message.lastMsgTimestamp; + if (message.unreadCount != null && message.hasOwnProperty("unreadCount")) + object.unreadCount = message.unreadCount; + if (message.readOnly != null && message.hasOwnProperty("readOnly")) + object.readOnly = message.readOnly; + if (message.endOfHistoryTransfer != null && message.hasOwnProperty("endOfHistoryTransfer")) + object.endOfHistoryTransfer = message.endOfHistoryTransfer; + if (message.ephemeralExpiration != null && message.hasOwnProperty("ephemeralExpiration")) + object.ephemeralExpiration = message.ephemeralExpiration; + if (message.ephemeralSettingTimestamp != null && message.hasOwnProperty("ephemeralSettingTimestamp")) + if (typeof message.ephemeralSettingTimestamp === "number") + object.ephemeralSettingTimestamp = options.longs === String ? String(message.ephemeralSettingTimestamp) : message.ephemeralSettingTimestamp; + else + object.ephemeralSettingTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.ephemeralSettingTimestamp) : options.longs === Number ? new $util.LongBits(message.ephemeralSettingTimestamp.low >>> 0, message.ephemeralSettingTimestamp.high >>> 0).toNumber() : message.ephemeralSettingTimestamp; + if (message.endOfHistoryTransferType != null && message.hasOwnProperty("endOfHistoryTransferType")) + object.endOfHistoryTransferType = options.enums === String ? $root.proto.Conversation.EndOfHistoryTransferType[message.endOfHistoryTransferType] : message.endOfHistoryTransferType; + if (message.conversationTimestamp != null && message.hasOwnProperty("conversationTimestamp")) + if (typeof message.conversationTimestamp === "number") + object.conversationTimestamp = options.longs === String ? String(message.conversationTimestamp) : message.conversationTimestamp; + else + object.conversationTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.conversationTimestamp) : options.longs === Number ? new $util.LongBits(message.conversationTimestamp.low >>> 0, message.conversationTimestamp.high >>> 0).toNumber(true) : message.conversationTimestamp; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.pHash != null && message.hasOwnProperty("pHash")) + object.pHash = message.pHash; + if (message.notSpam != null && message.hasOwnProperty("notSpam")) + object.notSpam = message.notSpam; + if (message.archived != null && message.hasOwnProperty("archived")) + object.archived = message.archived; + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) + object.disappearingMode = $root.proto.DisappearingMode.toObject(message.disappearingMode, options); + if (message.unreadMentionCount != null && message.hasOwnProperty("unreadMentionCount")) + object.unreadMentionCount = message.unreadMentionCount; + if (message.markedAsUnread != null && message.hasOwnProperty("markedAsUnread")) + object.markedAsUnread = message.markedAsUnread; + if (message.participant && message.participant.length) { + object.participant = []; + for (var j = 0; j < message.participant.length; ++j) + object.participant[j] = $root.proto.GroupParticipant.toObject(message.participant[j], options); + } + if (message.tcToken != null && message.hasOwnProperty("tcToken")) + object.tcToken = options.bytes === String ? $util.base64.encode(message.tcToken, 0, message.tcToken.length) : options.bytes === Array ? Array.prototype.slice.call(message.tcToken) : message.tcToken; + if (message.tcTokenTimestamp != null && message.hasOwnProperty("tcTokenTimestamp")) + if (typeof message.tcTokenTimestamp === "number") + object.tcTokenTimestamp = options.longs === String ? String(message.tcTokenTimestamp) : message.tcTokenTimestamp; + else + object.tcTokenTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.tcTokenTimestamp) : options.longs === Number ? new $util.LongBits(message.tcTokenTimestamp.low >>> 0, message.tcTokenTimestamp.high >>> 0).toNumber(true) : message.tcTokenTimestamp; + if (message.contactPrimaryIdentityKey != null && message.hasOwnProperty("contactPrimaryIdentityKey")) + object.contactPrimaryIdentityKey = options.bytes === String ? $util.base64.encode(message.contactPrimaryIdentityKey, 0, message.contactPrimaryIdentityKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.contactPrimaryIdentityKey) : message.contactPrimaryIdentityKey; + if (message.pinned != null && message.hasOwnProperty("pinned")) + object.pinned = message.pinned; + if (message.muteEndTime != null && message.hasOwnProperty("muteEndTime")) + if (typeof message.muteEndTime === "number") + object.muteEndTime = options.longs === String ? String(message.muteEndTime) : message.muteEndTime; + else + object.muteEndTime = options.longs === String ? $util.Long.prototype.toString.call(message.muteEndTime) : options.longs === Number ? new $util.LongBits(message.muteEndTime.low >>> 0, message.muteEndTime.high >>> 0).toNumber(true) : message.muteEndTime; + if (message.wallpaper != null && message.hasOwnProperty("wallpaper")) + object.wallpaper = $root.proto.WallpaperSettings.toObject(message.wallpaper, options); + if (message.mediaVisibility != null && message.hasOwnProperty("mediaVisibility")) + object.mediaVisibility = options.enums === String ? $root.proto.MediaVisibility[message.mediaVisibility] : message.mediaVisibility; + if (message.tcTokenSenderTimestamp != null && message.hasOwnProperty("tcTokenSenderTimestamp")) + if (typeof message.tcTokenSenderTimestamp === "number") + object.tcTokenSenderTimestamp = options.longs === String ? String(message.tcTokenSenderTimestamp) : message.tcTokenSenderTimestamp; + else + object.tcTokenSenderTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.tcTokenSenderTimestamp) : options.longs === Number ? new $util.LongBits(message.tcTokenSenderTimestamp.low >>> 0, message.tcTokenSenderTimestamp.high >>> 0).toNumber(true) : message.tcTokenSenderTimestamp; + if (message.suspended != null && message.hasOwnProperty("suspended")) + object.suspended = message.suspended; + if (message.terminated != null && message.hasOwnProperty("terminated")) + object.terminated = message.terminated; + if (message.createdAt != null && message.hasOwnProperty("createdAt")) + if (typeof message.createdAt === "number") + object.createdAt = options.longs === String ? String(message.createdAt) : message.createdAt; + else + object.createdAt = options.longs === String ? $util.Long.prototype.toString.call(message.createdAt) : options.longs === Number ? new $util.LongBits(message.createdAt.low >>> 0, message.createdAt.high >>> 0).toNumber(true) : message.createdAt; + if (message.createdBy != null && message.hasOwnProperty("createdBy")) + object.createdBy = message.createdBy; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.support != null && message.hasOwnProperty("support")) + object.support = message.support; + if (message.isParentGroup != null && message.hasOwnProperty("isParentGroup")) + object.isParentGroup = message.isParentGroup; + if (message.isDefaultSubgroup != null && message.hasOwnProperty("isDefaultSubgroup")) + object.isDefaultSubgroup = message.isDefaultSubgroup; + if (message.parentGroupId != null && message.hasOwnProperty("parentGroupId")) + object.parentGroupId = message.parentGroupId; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.pnJid != null && message.hasOwnProperty("pnJid")) + object.pnJid = message.pnJid; + if (message.shareOwnPn != null && message.hasOwnProperty("shareOwnPn")) + object.shareOwnPn = message.shareOwnPn; + if (message.pnhDuplicateLidThread != null && message.hasOwnProperty("pnhDuplicateLidThread")) + object.pnhDuplicateLidThread = message.pnhDuplicateLidThread; + if (message.lidJid != null && message.hasOwnProperty("lidJid")) + object.lidJid = message.lidJid; + return object; + }; + + /** + * Converts this Conversation to JSON. + * @function toJSON + * @memberof proto.Conversation + * @instance + * @returns {Object.} JSON object + */ + Conversation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * EndOfHistoryTransferType enum. + * @name proto.Conversation.EndOfHistoryTransferType + * @enum {number} + * @property {number} COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY=0 COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY value + * @property {number} COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY=1 COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY value + */ + Conversation.EndOfHistoryTransferType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY"] = 0; + values[valuesById[1] = "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY"] = 1; + return values; + })(); + + return Conversation; + })(); + + proto.DeviceListMetadata = (function() { + + /** + * Properties of a DeviceListMetadata. + * @memberof proto + * @interface IDeviceListMetadata + * @property {Uint8Array|null} [senderKeyHash] DeviceListMetadata senderKeyHash + * @property {number|Long|null} [senderTimestamp] DeviceListMetadata senderTimestamp + * @property {Array.|null} [senderKeyIndexes] DeviceListMetadata senderKeyIndexes + * @property {Uint8Array|null} [recipientKeyHash] DeviceListMetadata recipientKeyHash + * @property {number|Long|null} [recipientTimestamp] DeviceListMetadata recipientTimestamp + * @property {Array.|null} [recipientKeyIndexes] DeviceListMetadata recipientKeyIndexes + */ + + /** + * Constructs a new DeviceListMetadata. + * @memberof proto + * @classdesc Represents a DeviceListMetadata. + * @implements IDeviceListMetadata + * @constructor + * @param {proto.IDeviceListMetadata=} [properties] Properties to set + */ + function DeviceListMetadata(properties) { + this.senderKeyIndexes = []; + this.recipientKeyIndexes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeviceListMetadata senderKeyHash. + * @member {Uint8Array} senderKeyHash + * @memberof proto.DeviceListMetadata + * @instance + */ + DeviceListMetadata.prototype.senderKeyHash = $util.newBuffer([]); + + /** + * DeviceListMetadata senderTimestamp. + * @member {number|Long} senderTimestamp + * @memberof proto.DeviceListMetadata + * @instance + */ + DeviceListMetadata.prototype.senderTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * DeviceListMetadata senderKeyIndexes. + * @member {Array.} senderKeyIndexes + * @memberof proto.DeviceListMetadata + * @instance + */ + DeviceListMetadata.prototype.senderKeyIndexes = $util.emptyArray; + + /** + * DeviceListMetadata recipientKeyHash. + * @member {Uint8Array} recipientKeyHash + * @memberof proto.DeviceListMetadata + * @instance + */ + DeviceListMetadata.prototype.recipientKeyHash = $util.newBuffer([]); + + /** + * DeviceListMetadata recipientTimestamp. + * @member {number|Long} recipientTimestamp + * @memberof proto.DeviceListMetadata + * @instance + */ + DeviceListMetadata.prototype.recipientTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * DeviceListMetadata recipientKeyIndexes. + * @member {Array.} recipientKeyIndexes + * @memberof proto.DeviceListMetadata + * @instance + */ + DeviceListMetadata.prototype.recipientKeyIndexes = $util.emptyArray; + + /** + * Creates a new DeviceListMetadata instance using the specified properties. + * @function create + * @memberof proto.DeviceListMetadata + * @static + * @param {proto.IDeviceListMetadata=} [properties] Properties to set + * @returns {proto.DeviceListMetadata} DeviceListMetadata instance + */ + DeviceListMetadata.create = function create(properties) { + return new DeviceListMetadata(properties); + }; + + /** + * Encodes the specified DeviceListMetadata message. Does not implicitly {@link proto.DeviceListMetadata.verify|verify} messages. + * @function encode + * @memberof proto.DeviceListMetadata + * @static + * @param {proto.IDeviceListMetadata} message DeviceListMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeviceListMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.senderKeyHash != null && Object.hasOwnProperty.call(message, "senderKeyHash")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.senderKeyHash); + if (message.senderTimestamp != null && Object.hasOwnProperty.call(message, "senderTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.senderTimestamp); + if (message.senderKeyIndexes != null && message.senderKeyIndexes.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.senderKeyIndexes.length; ++i) + writer.uint32(message.senderKeyIndexes[i]); + writer.ldelim(); + } + if (message.recipientKeyHash != null && Object.hasOwnProperty.call(message, "recipientKeyHash")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.recipientKeyHash); + if (message.recipientTimestamp != null && Object.hasOwnProperty.call(message, "recipientTimestamp")) + writer.uint32(/* id 9, wireType 0 =*/72).uint64(message.recipientTimestamp); + if (message.recipientKeyIndexes != null && message.recipientKeyIndexes.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.recipientKeyIndexes.length; ++i) + writer.uint32(message.recipientKeyIndexes[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified DeviceListMetadata message, length delimited. Does not implicitly {@link proto.DeviceListMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.DeviceListMetadata + * @static + * @param {proto.IDeviceListMetadata} message DeviceListMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeviceListMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeviceListMetadata message from the specified reader or buffer. + * @function decode + * @memberof proto.DeviceListMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.DeviceListMetadata} DeviceListMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeviceListMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.DeviceListMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.senderKeyHash = reader.bytes(); + break; + case 2: + message.senderTimestamp = reader.uint64(); + break; + case 3: + if (!(message.senderKeyIndexes && message.senderKeyIndexes.length)) + message.senderKeyIndexes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.senderKeyIndexes.push(reader.uint32()); + } else + message.senderKeyIndexes.push(reader.uint32()); + break; + case 8: + message.recipientKeyHash = reader.bytes(); + break; + case 9: + message.recipientTimestamp = reader.uint64(); + break; + case 10: + if (!(message.recipientKeyIndexes && message.recipientKeyIndexes.length)) + message.recipientKeyIndexes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.recipientKeyIndexes.push(reader.uint32()); + } else + message.recipientKeyIndexes.push(reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeviceListMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.DeviceListMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.DeviceListMetadata} DeviceListMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeviceListMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeviceListMetadata message. + * @function verify + * @memberof proto.DeviceListMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeviceListMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.senderKeyHash != null && message.hasOwnProperty("senderKeyHash")) + if (!(message.senderKeyHash && typeof message.senderKeyHash.length === "number" || $util.isString(message.senderKeyHash))) + return "senderKeyHash: buffer expected"; + if (message.senderTimestamp != null && message.hasOwnProperty("senderTimestamp")) + if (!$util.isInteger(message.senderTimestamp) && !(message.senderTimestamp && $util.isInteger(message.senderTimestamp.low) && $util.isInteger(message.senderTimestamp.high))) + return "senderTimestamp: integer|Long expected"; + if (message.senderKeyIndexes != null && message.hasOwnProperty("senderKeyIndexes")) { + if (!Array.isArray(message.senderKeyIndexes)) + return "senderKeyIndexes: array expected"; + for (var i = 0; i < message.senderKeyIndexes.length; ++i) + if (!$util.isInteger(message.senderKeyIndexes[i])) + return "senderKeyIndexes: integer[] expected"; + } + if (message.recipientKeyHash != null && message.hasOwnProperty("recipientKeyHash")) + if (!(message.recipientKeyHash && typeof message.recipientKeyHash.length === "number" || $util.isString(message.recipientKeyHash))) + return "recipientKeyHash: buffer expected"; + if (message.recipientTimestamp != null && message.hasOwnProperty("recipientTimestamp")) + if (!$util.isInteger(message.recipientTimestamp) && !(message.recipientTimestamp && $util.isInteger(message.recipientTimestamp.low) && $util.isInteger(message.recipientTimestamp.high))) + return "recipientTimestamp: integer|Long expected"; + if (message.recipientKeyIndexes != null && message.hasOwnProperty("recipientKeyIndexes")) { + if (!Array.isArray(message.recipientKeyIndexes)) + return "recipientKeyIndexes: array expected"; + for (var i = 0; i < message.recipientKeyIndexes.length; ++i) + if (!$util.isInteger(message.recipientKeyIndexes[i])) + return "recipientKeyIndexes: integer[] expected"; + } + return null; + }; + + /** + * Creates a DeviceListMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.DeviceListMetadata + * @static + * @param {Object.} object Plain object + * @returns {proto.DeviceListMetadata} DeviceListMetadata + */ + DeviceListMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.proto.DeviceListMetadata) + return object; + var message = new $root.proto.DeviceListMetadata(); + if (object.senderKeyHash != null) + if (typeof object.senderKeyHash === "string") + $util.base64.decode(object.senderKeyHash, message.senderKeyHash = $util.newBuffer($util.base64.length(object.senderKeyHash)), 0); + else if (object.senderKeyHash.length) + message.senderKeyHash = object.senderKeyHash; + if (object.senderTimestamp != null) + if ($util.Long) + (message.senderTimestamp = $util.Long.fromValue(object.senderTimestamp)).unsigned = true; + else if (typeof object.senderTimestamp === "string") + message.senderTimestamp = parseInt(object.senderTimestamp, 10); + else if (typeof object.senderTimestamp === "number") + message.senderTimestamp = object.senderTimestamp; + else if (typeof object.senderTimestamp === "object") + message.senderTimestamp = new $util.LongBits(object.senderTimestamp.low >>> 0, object.senderTimestamp.high >>> 0).toNumber(true); + if (object.senderKeyIndexes) { + if (!Array.isArray(object.senderKeyIndexes)) + throw TypeError(".proto.DeviceListMetadata.senderKeyIndexes: array expected"); + message.senderKeyIndexes = []; + for (var i = 0; i < object.senderKeyIndexes.length; ++i) + message.senderKeyIndexes[i] = object.senderKeyIndexes[i] >>> 0; + } + if (object.recipientKeyHash != null) + if (typeof object.recipientKeyHash === "string") + $util.base64.decode(object.recipientKeyHash, message.recipientKeyHash = $util.newBuffer($util.base64.length(object.recipientKeyHash)), 0); + else if (object.recipientKeyHash.length) + message.recipientKeyHash = object.recipientKeyHash; + if (object.recipientTimestamp != null) + if ($util.Long) + (message.recipientTimestamp = $util.Long.fromValue(object.recipientTimestamp)).unsigned = true; + else if (typeof object.recipientTimestamp === "string") + message.recipientTimestamp = parseInt(object.recipientTimestamp, 10); + else if (typeof object.recipientTimestamp === "number") + message.recipientTimestamp = object.recipientTimestamp; + else if (typeof object.recipientTimestamp === "object") + message.recipientTimestamp = new $util.LongBits(object.recipientTimestamp.low >>> 0, object.recipientTimestamp.high >>> 0).toNumber(true); + if (object.recipientKeyIndexes) { + if (!Array.isArray(object.recipientKeyIndexes)) + throw TypeError(".proto.DeviceListMetadata.recipientKeyIndexes: array expected"); + message.recipientKeyIndexes = []; + for (var i = 0; i < object.recipientKeyIndexes.length; ++i) + message.recipientKeyIndexes[i] = object.recipientKeyIndexes[i] >>> 0; + } + return message; + }; + + /** + * Creates a plain object from a DeviceListMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.DeviceListMetadata + * @static + * @param {proto.DeviceListMetadata} message DeviceListMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeviceListMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.senderKeyIndexes = []; + object.recipientKeyIndexes = []; + } + if (options.defaults) { + if (options.bytes === String) + object.senderKeyHash = ""; + else { + object.senderKeyHash = []; + if (options.bytes !== Array) + object.senderKeyHash = $util.newBuffer(object.senderKeyHash); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.senderTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.recipientKeyHash = ""; + else { + object.recipientKeyHash = []; + if (options.bytes !== Array) + object.recipientKeyHash = $util.newBuffer(object.recipientKeyHash); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.recipientTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.recipientTimestamp = options.longs === String ? "0" : 0; + } + if (message.senderKeyHash != null && message.hasOwnProperty("senderKeyHash")) + object.senderKeyHash = options.bytes === String ? $util.base64.encode(message.senderKeyHash, 0, message.senderKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.senderKeyHash) : message.senderKeyHash; + if (message.senderTimestamp != null && message.hasOwnProperty("senderTimestamp")) + if (typeof message.senderTimestamp === "number") + object.senderTimestamp = options.longs === String ? String(message.senderTimestamp) : message.senderTimestamp; + else + object.senderTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestamp) : options.longs === Number ? new $util.LongBits(message.senderTimestamp.low >>> 0, message.senderTimestamp.high >>> 0).toNumber(true) : message.senderTimestamp; + if (message.senderKeyIndexes && message.senderKeyIndexes.length) { + object.senderKeyIndexes = []; + for (var j = 0; j < message.senderKeyIndexes.length; ++j) + object.senderKeyIndexes[j] = message.senderKeyIndexes[j]; + } + if (message.recipientKeyHash != null && message.hasOwnProperty("recipientKeyHash")) + object.recipientKeyHash = options.bytes === String ? $util.base64.encode(message.recipientKeyHash, 0, message.recipientKeyHash.length) : options.bytes === Array ? Array.prototype.slice.call(message.recipientKeyHash) : message.recipientKeyHash; + if (message.recipientTimestamp != null && message.hasOwnProperty("recipientTimestamp")) + if (typeof message.recipientTimestamp === "number") + object.recipientTimestamp = options.longs === String ? String(message.recipientTimestamp) : message.recipientTimestamp; + else + object.recipientTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.recipientTimestamp) : options.longs === Number ? new $util.LongBits(message.recipientTimestamp.low >>> 0, message.recipientTimestamp.high >>> 0).toNumber(true) : message.recipientTimestamp; + if (message.recipientKeyIndexes && message.recipientKeyIndexes.length) { + object.recipientKeyIndexes = []; + for (var j = 0; j < message.recipientKeyIndexes.length; ++j) + object.recipientKeyIndexes[j] = message.recipientKeyIndexes[j]; + } + return object; + }; + + /** + * Converts this DeviceListMetadata to JSON. + * @function toJSON + * @memberof proto.DeviceListMetadata + * @instance + * @returns {Object.} JSON object + */ + DeviceListMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeviceListMetadata; + })(); + + proto.DeviceProps = (function() { + + /** + * Properties of a DeviceProps. + * @memberof proto + * @interface IDeviceProps + * @property {string|null} [os] DeviceProps os + * @property {proto.DeviceProps.IAppVersion|null} [version] DeviceProps version + * @property {proto.DeviceProps.PlatformType|null} [platformType] DeviceProps platformType + * @property {boolean|null} [requireFullSync] DeviceProps requireFullSync + * @property {proto.DeviceProps.IHistorySyncConfig|null} [historySyncConfig] DeviceProps historySyncConfig + */ + + /** + * Constructs a new DeviceProps. + * @memberof proto + * @classdesc Represents a DeviceProps. + * @implements IDeviceProps + * @constructor + * @param {proto.IDeviceProps=} [properties] Properties to set + */ + function DeviceProps(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeviceProps os. + * @member {string} os + * @memberof proto.DeviceProps + * @instance + */ + DeviceProps.prototype.os = ""; + + /** + * DeviceProps version. + * @member {proto.DeviceProps.IAppVersion|null|undefined} version + * @memberof proto.DeviceProps + * @instance + */ + DeviceProps.prototype.version = null; + + /** + * DeviceProps platformType. + * @member {proto.DeviceProps.PlatformType} platformType + * @memberof proto.DeviceProps + * @instance + */ + DeviceProps.prototype.platformType = 0; + + /** + * DeviceProps requireFullSync. + * @member {boolean} requireFullSync + * @memberof proto.DeviceProps + * @instance + */ + DeviceProps.prototype.requireFullSync = false; + + /** + * DeviceProps historySyncConfig. + * @member {proto.DeviceProps.IHistorySyncConfig|null|undefined} historySyncConfig + * @memberof proto.DeviceProps + * @instance + */ + DeviceProps.prototype.historySyncConfig = null; + + /** + * Creates a new DeviceProps instance using the specified properties. + * @function create + * @memberof proto.DeviceProps + * @static + * @param {proto.IDeviceProps=} [properties] Properties to set + * @returns {proto.DeviceProps} DeviceProps instance + */ + DeviceProps.create = function create(properties) { + return new DeviceProps(properties); + }; + + /** + * Encodes the specified DeviceProps message. Does not implicitly {@link proto.DeviceProps.verify|verify} messages. + * @function encode + * @memberof proto.DeviceProps + * @static + * @param {proto.IDeviceProps} message DeviceProps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeviceProps.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.os != null && Object.hasOwnProperty.call(message, "os")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.os); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.proto.DeviceProps.AppVersion.encode(message.version, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.platformType != null && Object.hasOwnProperty.call(message, "platformType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.platformType); + if (message.requireFullSync != null && Object.hasOwnProperty.call(message, "requireFullSync")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.requireFullSync); + if (message.historySyncConfig != null && Object.hasOwnProperty.call(message, "historySyncConfig")) + $root.proto.DeviceProps.HistorySyncConfig.encode(message.historySyncConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeviceProps message, length delimited. Does not implicitly {@link proto.DeviceProps.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.DeviceProps + * @static + * @param {proto.IDeviceProps} message DeviceProps message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeviceProps.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeviceProps message from the specified reader or buffer. + * @function decode + * @memberof proto.DeviceProps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.DeviceProps} DeviceProps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeviceProps.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.DeviceProps(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.os = reader.string(); + break; + case 2: + message.version = $root.proto.DeviceProps.AppVersion.decode(reader, reader.uint32()); + break; + case 3: + message.platformType = reader.int32(); + break; + case 4: + message.requireFullSync = reader.bool(); + break; + case 5: + message.historySyncConfig = $root.proto.DeviceProps.HistorySyncConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeviceProps message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.DeviceProps + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.DeviceProps} DeviceProps + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeviceProps.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeviceProps message. + * @function verify + * @memberof proto.DeviceProps + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeviceProps.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.os != null && message.hasOwnProperty("os")) + if (!$util.isString(message.os)) + return "os: string expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.proto.DeviceProps.AppVersion.verify(message.version); + if (error) + return "version." + error; + } + if (message.platformType != null && message.hasOwnProperty("platformType")) + switch (message.platformType) { + default: + return "platformType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + break; + } + if (message.requireFullSync != null && message.hasOwnProperty("requireFullSync")) + if (typeof message.requireFullSync !== "boolean") + return "requireFullSync: boolean expected"; + if (message.historySyncConfig != null && message.hasOwnProperty("historySyncConfig")) { + var error = $root.proto.DeviceProps.HistorySyncConfig.verify(message.historySyncConfig); + if (error) + return "historySyncConfig." + error; + } + return null; + }; + + /** + * Creates a DeviceProps message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.DeviceProps + * @static + * @param {Object.} object Plain object + * @returns {proto.DeviceProps} DeviceProps + */ + DeviceProps.fromObject = function fromObject(object) { + if (object instanceof $root.proto.DeviceProps) + return object; + var message = new $root.proto.DeviceProps(); + if (object.os != null) + message.os = String(object.os); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".proto.DeviceProps.version: object expected"); + message.version = $root.proto.DeviceProps.AppVersion.fromObject(object.version); + } + switch (object.platformType) { + case "UNKNOWN": + case 0: + message.platformType = 0; + break; + case "CHROME": + case 1: + message.platformType = 1; + break; + case "FIREFOX": + case 2: + message.platformType = 2; + break; + case "IE": + case 3: + message.platformType = 3; + break; + case "OPERA": + case 4: + message.platformType = 4; + break; + case "SAFARI": + case 5: + message.platformType = 5; + break; + case "EDGE": + case 6: + message.platformType = 6; + break; + case "DESKTOP": + case 7: + message.platformType = 7; + break; + case "IPAD": + case 8: + message.platformType = 8; + break; + case "ANDROID_TABLET": + case 9: + message.platformType = 9; + break; + case "OHANA": + case 10: + message.platformType = 10; + break; + case "ALOHA": + case 11: + message.platformType = 11; + break; + case "CATALINA": + case 12: + message.platformType = 12; + break; + case "TCL_TV": + case 13: + message.platformType = 13; + break; + case "IOS_PHONE": + case 14: + message.platformType = 14; + break; + case "IOS_CATALYST": + case 15: + message.platformType = 15; + break; + case "ANDROID_PHONE": + case 16: + message.platformType = 16; + break; + case "ANDROID_AMBIGUOUS": + case 17: + message.platformType = 17; + break; + } + if (object.requireFullSync != null) + message.requireFullSync = Boolean(object.requireFullSync); + if (object.historySyncConfig != null) { + if (typeof object.historySyncConfig !== "object") + throw TypeError(".proto.DeviceProps.historySyncConfig: object expected"); + message.historySyncConfig = $root.proto.DeviceProps.HistorySyncConfig.fromObject(object.historySyncConfig); + } + return message; + }; + + /** + * Creates a plain object from a DeviceProps message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.DeviceProps + * @static + * @param {proto.DeviceProps} message DeviceProps + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeviceProps.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.os = ""; + object.version = null; + object.platformType = options.enums === String ? "UNKNOWN" : 0; + object.requireFullSync = false; + object.historySyncConfig = null; + } + if (message.os != null && message.hasOwnProperty("os")) + object.os = message.os; + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.proto.DeviceProps.AppVersion.toObject(message.version, options); + if (message.platformType != null && message.hasOwnProperty("platformType")) + object.platformType = options.enums === String ? $root.proto.DeviceProps.PlatformType[message.platformType] : message.platformType; + if (message.requireFullSync != null && message.hasOwnProperty("requireFullSync")) + object.requireFullSync = message.requireFullSync; + if (message.historySyncConfig != null && message.hasOwnProperty("historySyncConfig")) + object.historySyncConfig = $root.proto.DeviceProps.HistorySyncConfig.toObject(message.historySyncConfig, options); + return object; + }; + + /** + * Converts this DeviceProps to JSON. + * @function toJSON + * @memberof proto.DeviceProps + * @instance + * @returns {Object.} JSON object + */ + DeviceProps.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DeviceProps.AppVersion = (function() { + + /** + * Properties of an AppVersion. + * @memberof proto.DeviceProps + * @interface IAppVersion + * @property {number|null} [primary] AppVersion primary + * @property {number|null} [secondary] AppVersion secondary + * @property {number|null} [tertiary] AppVersion tertiary + * @property {number|null} [quaternary] AppVersion quaternary + * @property {number|null} [quinary] AppVersion quinary + */ + + /** + * Constructs a new AppVersion. + * @memberof proto.DeviceProps + * @classdesc Represents an AppVersion. + * @implements IAppVersion + * @constructor + * @param {proto.DeviceProps.IAppVersion=} [properties] Properties to set + */ + function AppVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppVersion primary. + * @member {number} primary + * @memberof proto.DeviceProps.AppVersion + * @instance + */ + AppVersion.prototype.primary = 0; + + /** + * AppVersion secondary. + * @member {number} secondary + * @memberof proto.DeviceProps.AppVersion + * @instance + */ + AppVersion.prototype.secondary = 0; + + /** + * AppVersion tertiary. + * @member {number} tertiary + * @memberof proto.DeviceProps.AppVersion + * @instance + */ + AppVersion.prototype.tertiary = 0; + + /** + * AppVersion quaternary. + * @member {number} quaternary + * @memberof proto.DeviceProps.AppVersion + * @instance + */ + AppVersion.prototype.quaternary = 0; + + /** + * AppVersion quinary. + * @member {number} quinary + * @memberof proto.DeviceProps.AppVersion + * @instance + */ + AppVersion.prototype.quinary = 0; + + /** + * Creates a new AppVersion instance using the specified properties. + * @function create + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {proto.DeviceProps.IAppVersion=} [properties] Properties to set + * @returns {proto.DeviceProps.AppVersion} AppVersion instance + */ + AppVersion.create = function create(properties) { + return new AppVersion(properties); + }; + + /** + * Encodes the specified AppVersion message. Does not implicitly {@link proto.DeviceProps.AppVersion.verify|verify} messages. + * @function encode + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {proto.DeviceProps.IAppVersion} message AppVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.primary != null && Object.hasOwnProperty.call(message, "primary")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.primary); + if (message.secondary != null && Object.hasOwnProperty.call(message, "secondary")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.secondary); + if (message.tertiary != null && Object.hasOwnProperty.call(message, "tertiary")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.tertiary); + if (message.quaternary != null && Object.hasOwnProperty.call(message, "quaternary")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.quaternary); + if (message.quinary != null && Object.hasOwnProperty.call(message, "quinary")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.quinary); + return writer; + }; + + /** + * Encodes the specified AppVersion message, length delimited. Does not implicitly {@link proto.DeviceProps.AppVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {proto.DeviceProps.IAppVersion} message AppVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppVersion message from the specified reader or buffer. + * @function decode + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.DeviceProps.AppVersion} AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.DeviceProps.AppVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.primary = reader.uint32(); + break; + case 2: + message.secondary = reader.uint32(); + break; + case 3: + message.tertiary = reader.uint32(); + break; + case 4: + message.quaternary = reader.uint32(); + break; + case 5: + message.quinary = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.DeviceProps.AppVersion} AppVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppVersion message. + * @function verify + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.primary != null && message.hasOwnProperty("primary")) + if (!$util.isInteger(message.primary)) + return "primary: integer expected"; + if (message.secondary != null && message.hasOwnProperty("secondary")) + if (!$util.isInteger(message.secondary)) + return "secondary: integer expected"; + if (message.tertiary != null && message.hasOwnProperty("tertiary")) + if (!$util.isInteger(message.tertiary)) + return "tertiary: integer expected"; + if (message.quaternary != null && message.hasOwnProperty("quaternary")) + if (!$util.isInteger(message.quaternary)) + return "quaternary: integer expected"; + if (message.quinary != null && message.hasOwnProperty("quinary")) + if (!$util.isInteger(message.quinary)) + return "quinary: integer expected"; + return null; + }; + + /** + * Creates an AppVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {Object.} object Plain object + * @returns {proto.DeviceProps.AppVersion} AppVersion + */ + AppVersion.fromObject = function fromObject(object) { + if (object instanceof $root.proto.DeviceProps.AppVersion) + return object; + var message = new $root.proto.DeviceProps.AppVersion(); + if (object.primary != null) + message.primary = object.primary >>> 0; + if (object.secondary != null) + message.secondary = object.secondary >>> 0; + if (object.tertiary != null) + message.tertiary = object.tertiary >>> 0; + if (object.quaternary != null) + message.quaternary = object.quaternary >>> 0; + if (object.quinary != null) + message.quinary = object.quinary >>> 0; + return message; + }; + + /** + * Creates a plain object from an AppVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.DeviceProps.AppVersion + * @static + * @param {proto.DeviceProps.AppVersion} message AppVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.primary = 0; + object.secondary = 0; + object.tertiary = 0; + object.quaternary = 0; + object.quinary = 0; + } + if (message.primary != null && message.hasOwnProperty("primary")) + object.primary = message.primary; + if (message.secondary != null && message.hasOwnProperty("secondary")) + object.secondary = message.secondary; + if (message.tertiary != null && message.hasOwnProperty("tertiary")) + object.tertiary = message.tertiary; + if (message.quaternary != null && message.hasOwnProperty("quaternary")) + object.quaternary = message.quaternary; + if (message.quinary != null && message.hasOwnProperty("quinary")) + object.quinary = message.quinary; + return object; + }; + + /** + * Converts this AppVersion to JSON. + * @function toJSON + * @memberof proto.DeviceProps.AppVersion + * @instance + * @returns {Object.} JSON object + */ + AppVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppVersion; + })(); + + DeviceProps.HistorySyncConfig = (function() { + + /** + * Properties of a HistorySyncConfig. + * @memberof proto.DeviceProps + * @interface IHistorySyncConfig + * @property {number|null} [fullSyncDaysLimit] HistorySyncConfig fullSyncDaysLimit + * @property {number|null} [fullSyncSizeMbLimit] HistorySyncConfig fullSyncSizeMbLimit + * @property {number|null} [storageQuotaMb] HistorySyncConfig storageQuotaMb + */ + + /** + * Constructs a new HistorySyncConfig. + * @memberof proto.DeviceProps + * @classdesc Represents a HistorySyncConfig. + * @implements IHistorySyncConfig + * @constructor + * @param {proto.DeviceProps.IHistorySyncConfig=} [properties] Properties to set + */ + function HistorySyncConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HistorySyncConfig fullSyncDaysLimit. + * @member {number} fullSyncDaysLimit + * @memberof proto.DeviceProps.HistorySyncConfig + * @instance + */ + HistorySyncConfig.prototype.fullSyncDaysLimit = 0; + + /** + * HistorySyncConfig fullSyncSizeMbLimit. + * @member {number} fullSyncSizeMbLimit + * @memberof proto.DeviceProps.HistorySyncConfig + * @instance + */ + HistorySyncConfig.prototype.fullSyncSizeMbLimit = 0; + + /** + * HistorySyncConfig storageQuotaMb. + * @member {number} storageQuotaMb + * @memberof proto.DeviceProps.HistorySyncConfig + * @instance + */ + HistorySyncConfig.prototype.storageQuotaMb = 0; + + /** + * Creates a new HistorySyncConfig instance using the specified properties. + * @function create + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {proto.DeviceProps.IHistorySyncConfig=} [properties] Properties to set + * @returns {proto.DeviceProps.HistorySyncConfig} HistorySyncConfig instance + */ + HistorySyncConfig.create = function create(properties) { + return new HistorySyncConfig(properties); + }; + + /** + * Encodes the specified HistorySyncConfig message. Does not implicitly {@link proto.DeviceProps.HistorySyncConfig.verify|verify} messages. + * @function encode + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {proto.DeviceProps.IHistorySyncConfig} message HistorySyncConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fullSyncDaysLimit != null && Object.hasOwnProperty.call(message, "fullSyncDaysLimit")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.fullSyncDaysLimit); + if (message.fullSyncSizeMbLimit != null && Object.hasOwnProperty.call(message, "fullSyncSizeMbLimit")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.fullSyncSizeMbLimit); + if (message.storageQuotaMb != null && Object.hasOwnProperty.call(message, "storageQuotaMb")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.storageQuotaMb); + return writer; + }; + + /** + * Encodes the specified HistorySyncConfig message, length delimited. Does not implicitly {@link proto.DeviceProps.HistorySyncConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {proto.DeviceProps.IHistorySyncConfig} message HistorySyncConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HistorySyncConfig message from the specified reader or buffer. + * @function decode + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.DeviceProps.HistorySyncConfig} HistorySyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.DeviceProps.HistorySyncConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullSyncDaysLimit = reader.uint32(); + break; + case 2: + message.fullSyncSizeMbLimit = reader.uint32(); + break; + case 3: + message.storageQuotaMb = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HistorySyncConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.DeviceProps.HistorySyncConfig} HistorySyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HistorySyncConfig message. + * @function verify + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HistorySyncConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fullSyncDaysLimit != null && message.hasOwnProperty("fullSyncDaysLimit")) + if (!$util.isInteger(message.fullSyncDaysLimit)) + return "fullSyncDaysLimit: integer expected"; + if (message.fullSyncSizeMbLimit != null && message.hasOwnProperty("fullSyncSizeMbLimit")) + if (!$util.isInteger(message.fullSyncSizeMbLimit)) + return "fullSyncSizeMbLimit: integer expected"; + if (message.storageQuotaMb != null && message.hasOwnProperty("storageQuotaMb")) + if (!$util.isInteger(message.storageQuotaMb)) + return "storageQuotaMb: integer expected"; + return null; + }; + + /** + * Creates a HistorySyncConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {Object.} object Plain object + * @returns {proto.DeviceProps.HistorySyncConfig} HistorySyncConfig + */ + HistorySyncConfig.fromObject = function fromObject(object) { + if (object instanceof $root.proto.DeviceProps.HistorySyncConfig) + return object; + var message = new $root.proto.DeviceProps.HistorySyncConfig(); + if (object.fullSyncDaysLimit != null) + message.fullSyncDaysLimit = object.fullSyncDaysLimit >>> 0; + if (object.fullSyncSizeMbLimit != null) + message.fullSyncSizeMbLimit = object.fullSyncSizeMbLimit >>> 0; + if (object.storageQuotaMb != null) + message.storageQuotaMb = object.storageQuotaMb >>> 0; + return message; + }; + + /** + * Creates a plain object from a HistorySyncConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.DeviceProps.HistorySyncConfig + * @static + * @param {proto.DeviceProps.HistorySyncConfig} message HistorySyncConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HistorySyncConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fullSyncDaysLimit = 0; + object.fullSyncSizeMbLimit = 0; + object.storageQuotaMb = 0; + } + if (message.fullSyncDaysLimit != null && message.hasOwnProperty("fullSyncDaysLimit")) + object.fullSyncDaysLimit = message.fullSyncDaysLimit; + if (message.fullSyncSizeMbLimit != null && message.hasOwnProperty("fullSyncSizeMbLimit")) + object.fullSyncSizeMbLimit = message.fullSyncSizeMbLimit; + if (message.storageQuotaMb != null && message.hasOwnProperty("storageQuotaMb")) + object.storageQuotaMb = message.storageQuotaMb; + return object; + }; + + /** + * Converts this HistorySyncConfig to JSON. + * @function toJSON + * @memberof proto.DeviceProps.HistorySyncConfig + * @instance + * @returns {Object.} JSON object + */ + HistorySyncConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HistorySyncConfig; + })(); + + /** + * PlatformType enum. + * @name proto.DeviceProps.PlatformType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} CHROME=1 CHROME value + * @property {number} FIREFOX=2 FIREFOX value + * @property {number} IE=3 IE value + * @property {number} OPERA=4 OPERA value + * @property {number} SAFARI=5 SAFARI value + * @property {number} EDGE=6 EDGE value + * @property {number} DESKTOP=7 DESKTOP value + * @property {number} IPAD=8 IPAD value + * @property {number} ANDROID_TABLET=9 ANDROID_TABLET value + * @property {number} OHANA=10 OHANA value + * @property {number} ALOHA=11 ALOHA value + * @property {number} CATALINA=12 CATALINA value + * @property {number} TCL_TV=13 TCL_TV value + * @property {number} IOS_PHONE=14 IOS_PHONE value + * @property {number} IOS_CATALYST=15 IOS_CATALYST value + * @property {number} ANDROID_PHONE=16 ANDROID_PHONE value + * @property {number} ANDROID_AMBIGUOUS=17 ANDROID_AMBIGUOUS value + */ + DeviceProps.PlatformType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "CHROME"] = 1; + values[valuesById[2] = "FIREFOX"] = 2; + values[valuesById[3] = "IE"] = 3; + values[valuesById[4] = "OPERA"] = 4; + values[valuesById[5] = "SAFARI"] = 5; + values[valuesById[6] = "EDGE"] = 6; + values[valuesById[7] = "DESKTOP"] = 7; + values[valuesById[8] = "IPAD"] = 8; + values[valuesById[9] = "ANDROID_TABLET"] = 9; + values[valuesById[10] = "OHANA"] = 10; + values[valuesById[11] = "ALOHA"] = 11; + values[valuesById[12] = "CATALINA"] = 12; + values[valuesById[13] = "TCL_TV"] = 13; + values[valuesById[14] = "IOS_PHONE"] = 14; + values[valuesById[15] = "IOS_CATALYST"] = 15; + values[valuesById[16] = "ANDROID_PHONE"] = 16; + values[valuesById[17] = "ANDROID_AMBIGUOUS"] = 17; + return values; + })(); + + return DeviceProps; + })(); + + proto.DisappearingMode = (function() { + + /** + * Properties of a DisappearingMode. + * @memberof proto + * @interface IDisappearingMode + * @property {proto.DisappearingMode.Initiator|null} [initiator] DisappearingMode initiator + */ + + /** + * Constructs a new DisappearingMode. + * @memberof proto + * @classdesc Represents a DisappearingMode. + * @implements IDisappearingMode + * @constructor + * @param {proto.IDisappearingMode=} [properties] Properties to set + */ + function DisappearingMode(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DisappearingMode initiator. + * @member {proto.DisappearingMode.Initiator} initiator + * @memberof proto.DisappearingMode + * @instance + */ + DisappearingMode.prototype.initiator = 0; + + /** + * Creates a new DisappearingMode instance using the specified properties. + * @function create + * @memberof proto.DisappearingMode + * @static + * @param {proto.IDisappearingMode=} [properties] Properties to set + * @returns {proto.DisappearingMode} DisappearingMode instance + */ + DisappearingMode.create = function create(properties) { + return new DisappearingMode(properties); + }; + + /** + * Encodes the specified DisappearingMode message. Does not implicitly {@link proto.DisappearingMode.verify|verify} messages. + * @function encode + * @memberof proto.DisappearingMode + * @static + * @param {proto.IDisappearingMode} message DisappearingMode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisappearingMode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initiator != null && Object.hasOwnProperty.call(message, "initiator")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.initiator); + return writer; + }; + + /** + * Encodes the specified DisappearingMode message, length delimited. Does not implicitly {@link proto.DisappearingMode.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.DisappearingMode + * @static + * @param {proto.IDisappearingMode} message DisappearingMode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisappearingMode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisappearingMode message from the specified reader or buffer. + * @function decode + * @memberof proto.DisappearingMode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.DisappearingMode} DisappearingMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisappearingMode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.DisappearingMode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.initiator = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisappearingMode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.DisappearingMode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.DisappearingMode} DisappearingMode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisappearingMode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisappearingMode message. + * @function verify + * @memberof proto.DisappearingMode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisappearingMode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initiator != null && message.hasOwnProperty("initiator")) + switch (message.initiator) { + default: + return "initiator: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DisappearingMode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.DisappearingMode + * @static + * @param {Object.} object Plain object + * @returns {proto.DisappearingMode} DisappearingMode + */ + DisappearingMode.fromObject = function fromObject(object) { + if (object instanceof $root.proto.DisappearingMode) + return object; + var message = new $root.proto.DisappearingMode(); + switch (object.initiator) { + case "CHANGED_IN_CHAT": + case 0: + message.initiator = 0; + break; + case "INITIATED_BY_ME": + case 1: + message.initiator = 1; + break; + case "INITIATED_BY_OTHER": + case 2: + message.initiator = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DisappearingMode message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.DisappearingMode + * @static + * @param {proto.DisappearingMode} message DisappearingMode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisappearingMode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.initiator = options.enums === String ? "CHANGED_IN_CHAT" : 0; + if (message.initiator != null && message.hasOwnProperty("initiator")) + object.initiator = options.enums === String ? $root.proto.DisappearingMode.Initiator[message.initiator] : message.initiator; + return object; + }; + + /** + * Converts this DisappearingMode to JSON. + * @function toJSON + * @memberof proto.DisappearingMode + * @instance + * @returns {Object.} JSON object + */ + DisappearingMode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Initiator enum. + * @name proto.DisappearingMode.Initiator + * @enum {number} + * @property {number} CHANGED_IN_CHAT=0 CHANGED_IN_CHAT value + * @property {number} INITIATED_BY_ME=1 INITIATED_BY_ME value + * @property {number} INITIATED_BY_OTHER=2 INITIATED_BY_OTHER value + */ + DisappearingMode.Initiator = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CHANGED_IN_CHAT"] = 0; + values[valuesById[1] = "INITIATED_BY_ME"] = 1; + values[valuesById[2] = "INITIATED_BY_OTHER"] = 2; + return values; + })(); + + return DisappearingMode; + })(); + + proto.EphemeralSetting = (function() { + + /** + * Properties of an EphemeralSetting. + * @memberof proto + * @interface IEphemeralSetting + * @property {number|null} [duration] EphemeralSetting duration + * @property {number|Long|null} [timestamp] EphemeralSetting timestamp + */ + + /** + * Constructs a new EphemeralSetting. + * @memberof proto + * @classdesc Represents an EphemeralSetting. + * @implements IEphemeralSetting + * @constructor + * @param {proto.IEphemeralSetting=} [properties] Properties to set + */ + function EphemeralSetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EphemeralSetting duration. + * @member {number} duration + * @memberof proto.EphemeralSetting + * @instance + */ + EphemeralSetting.prototype.duration = 0; + + /** + * EphemeralSetting timestamp. + * @member {number|Long} timestamp + * @memberof proto.EphemeralSetting + * @instance + */ + EphemeralSetting.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new EphemeralSetting instance using the specified properties. + * @function create + * @memberof proto.EphemeralSetting + * @static + * @param {proto.IEphemeralSetting=} [properties] Properties to set + * @returns {proto.EphemeralSetting} EphemeralSetting instance + */ + EphemeralSetting.create = function create(properties) { + return new EphemeralSetting(properties); + }; + + /** + * Encodes the specified EphemeralSetting message. Does not implicitly {@link proto.EphemeralSetting.verify|verify} messages. + * @function encode + * @memberof proto.EphemeralSetting + * @static + * @param {proto.IEphemeralSetting} message EphemeralSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EphemeralSetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + writer.uint32(/* id 1, wireType 5 =*/13).sfixed32(message.duration); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 1 =*/17).sfixed64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified EphemeralSetting message, length delimited. Does not implicitly {@link proto.EphemeralSetting.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.EphemeralSetting + * @static + * @param {proto.IEphemeralSetting} message EphemeralSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EphemeralSetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EphemeralSetting message from the specified reader or buffer. + * @function decode + * @memberof proto.EphemeralSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.EphemeralSetting} EphemeralSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EphemeralSetting.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.EphemeralSetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.duration = reader.sfixed32(); + break; + case 2: + message.timestamp = reader.sfixed64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EphemeralSetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.EphemeralSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.EphemeralSetting} EphemeralSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EphemeralSetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EphemeralSetting message. + * @function verify + * @memberof proto.EphemeralSetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EphemeralSetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.duration != null && message.hasOwnProperty("duration")) + if (!$util.isInteger(message.duration)) + return "duration: integer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates an EphemeralSetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.EphemeralSetting + * @static + * @param {Object.} object Plain object + * @returns {proto.EphemeralSetting} EphemeralSetting + */ + EphemeralSetting.fromObject = function fromObject(object) { + if (object instanceof $root.proto.EphemeralSetting) + return object; + var message = new $root.proto.EphemeralSetting(); + if (object.duration != null) + message.duration = object.duration | 0; + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an EphemeralSetting message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.EphemeralSetting + * @static + * @param {proto.EphemeralSetting} message EphemeralSetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EphemeralSetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.duration = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.duration != null && message.hasOwnProperty("duration")) + object.duration = message.duration; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + return object; + }; + + /** + * Converts this EphemeralSetting to JSON. + * @function toJSON + * @memberof proto.EphemeralSetting + * @instance + * @returns {Object.} JSON object + */ + EphemeralSetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EphemeralSetting; + })(); + + proto.ExitCode = (function() { + + /** + * Properties of an ExitCode. + * @memberof proto + * @interface IExitCode + * @property {number|Long|null} [code] ExitCode code + * @property {string|null} [text] ExitCode text + */ + + /** + * Constructs a new ExitCode. + * @memberof proto + * @classdesc Represents an ExitCode. + * @implements IExitCode + * @constructor + * @param {proto.IExitCode=} [properties] Properties to set + */ + function ExitCode(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExitCode code. + * @member {number|Long} code + * @memberof proto.ExitCode + * @instance + */ + ExitCode.prototype.code = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ExitCode text. + * @member {string} text + * @memberof proto.ExitCode + * @instance + */ + ExitCode.prototype.text = ""; + + /** + * Creates a new ExitCode instance using the specified properties. + * @function create + * @memberof proto.ExitCode + * @static + * @param {proto.IExitCode=} [properties] Properties to set + * @returns {proto.ExitCode} ExitCode instance + */ + ExitCode.create = function create(properties) { + return new ExitCode(properties); + }; + + /** + * Encodes the specified ExitCode message. Does not implicitly {@link proto.ExitCode.verify|verify} messages. + * @function encode + * @memberof proto.ExitCode + * @static + * @param {proto.IExitCode} message ExitCode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExitCode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.code); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); + return writer; + }; + + /** + * Encodes the specified ExitCode message, length delimited. Does not implicitly {@link proto.ExitCode.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ExitCode + * @static + * @param {proto.IExitCode} message ExitCode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExitCode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExitCode message from the specified reader or buffer. + * @function decode + * @memberof proto.ExitCode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ExitCode} ExitCode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExitCode.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ExitCode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint64(); + break; + case 2: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExitCode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ExitCode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ExitCode} ExitCode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExitCode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExitCode message. + * @function verify + * @memberof proto.ExitCode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExitCode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code) && !(message.code && $util.isInteger(message.code.low) && $util.isInteger(message.code.high))) + return "code: integer|Long expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates an ExitCode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ExitCode + * @static + * @param {Object.} object Plain object + * @returns {proto.ExitCode} ExitCode + */ + ExitCode.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ExitCode) + return object; + var message = new $root.proto.ExitCode(); + if (object.code != null) + if ($util.Long) + (message.code = $util.Long.fromValue(object.code)).unsigned = true; + else if (typeof object.code === "string") + message.code = parseInt(object.code, 10); + else if (typeof object.code === "number") + message.code = object.code; + else if (typeof object.code === "object") + message.code = new $util.LongBits(object.code.low >>> 0, object.code.high >>> 0).toNumber(true); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from an ExitCode message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ExitCode + * @static + * @param {proto.ExitCode} message ExitCode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExitCode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.code = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.code = options.longs === String ? "0" : 0; + object.text = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + if (typeof message.code === "number") + object.code = options.longs === String ? String(message.code) : message.code; + else + object.code = options.longs === String ? $util.Long.prototype.toString.call(message.code) : options.longs === Number ? new $util.LongBits(message.code.low >>> 0, message.code.high >>> 0).toNumber(true) : message.code; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this ExitCode to JSON. + * @function toJSON + * @memberof proto.ExitCode + * @instance + * @returns {Object.} JSON object + */ + ExitCode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExitCode; + })(); + + proto.ExternalBlobReference = (function() { + + /** + * Properties of an ExternalBlobReference. + * @memberof proto + * @interface IExternalBlobReference + * @property {Uint8Array|null} [mediaKey] ExternalBlobReference mediaKey + * @property {string|null} [directPath] ExternalBlobReference directPath + * @property {string|null} [handle] ExternalBlobReference handle + * @property {number|Long|null} [fileSizeBytes] ExternalBlobReference fileSizeBytes + * @property {Uint8Array|null} [fileSha256] ExternalBlobReference fileSha256 + * @property {Uint8Array|null} [fileEncSha256] ExternalBlobReference fileEncSha256 + */ + + /** + * Constructs a new ExternalBlobReference. + * @memberof proto + * @classdesc Represents an ExternalBlobReference. + * @implements IExternalBlobReference + * @constructor + * @param {proto.IExternalBlobReference=} [properties] Properties to set + */ + function ExternalBlobReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExternalBlobReference mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.ExternalBlobReference + * @instance + */ + ExternalBlobReference.prototype.mediaKey = $util.newBuffer([]); + + /** + * ExternalBlobReference directPath. + * @member {string} directPath + * @memberof proto.ExternalBlobReference + * @instance + */ + ExternalBlobReference.prototype.directPath = ""; + + /** + * ExternalBlobReference handle. + * @member {string} handle + * @memberof proto.ExternalBlobReference + * @instance + */ + ExternalBlobReference.prototype.handle = ""; + + /** + * ExternalBlobReference fileSizeBytes. + * @member {number|Long} fileSizeBytes + * @memberof proto.ExternalBlobReference + * @instance + */ + ExternalBlobReference.prototype.fileSizeBytes = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ExternalBlobReference fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.ExternalBlobReference + * @instance + */ + ExternalBlobReference.prototype.fileSha256 = $util.newBuffer([]); + + /** + * ExternalBlobReference fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.ExternalBlobReference + * @instance + */ + ExternalBlobReference.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * Creates a new ExternalBlobReference instance using the specified properties. + * @function create + * @memberof proto.ExternalBlobReference + * @static + * @param {proto.IExternalBlobReference=} [properties] Properties to set + * @returns {proto.ExternalBlobReference} ExternalBlobReference instance + */ + ExternalBlobReference.create = function create(properties) { + return new ExternalBlobReference(properties); + }; + + /** + * Encodes the specified ExternalBlobReference message. Does not implicitly {@link proto.ExternalBlobReference.verify|verify} messages. + * @function encode + * @memberof proto.ExternalBlobReference + * @static + * @param {proto.IExternalBlobReference} message ExternalBlobReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalBlobReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.mediaKey); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.directPath); + if (message.handle != null && Object.hasOwnProperty.call(message, "handle")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.handle); + if (message.fileSizeBytes != null && Object.hasOwnProperty.call(message, "fileSizeBytes")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.fileSizeBytes); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.fileSha256); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.fileEncSha256); + return writer; + }; + + /** + * Encodes the specified ExternalBlobReference message, length delimited. Does not implicitly {@link proto.ExternalBlobReference.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ExternalBlobReference + * @static + * @param {proto.IExternalBlobReference} message ExternalBlobReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalBlobReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExternalBlobReference message from the specified reader or buffer. + * @function decode + * @memberof proto.ExternalBlobReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ExternalBlobReference} ExternalBlobReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalBlobReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ExternalBlobReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mediaKey = reader.bytes(); + break; + case 2: + message.directPath = reader.string(); + break; + case 3: + message.handle = reader.string(); + break; + case 4: + message.fileSizeBytes = reader.uint64(); + break; + case 5: + message.fileSha256 = reader.bytes(); + break; + case 6: + message.fileEncSha256 = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExternalBlobReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ExternalBlobReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ExternalBlobReference} ExternalBlobReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalBlobReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExternalBlobReference message. + * @function verify + * @memberof proto.ExternalBlobReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExternalBlobReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.handle != null && message.hasOwnProperty("handle")) + if (!$util.isString(message.handle)) + return "handle: string expected"; + if (message.fileSizeBytes != null && message.hasOwnProperty("fileSizeBytes")) + if (!$util.isInteger(message.fileSizeBytes) && !(message.fileSizeBytes && $util.isInteger(message.fileSizeBytes.low) && $util.isInteger(message.fileSizeBytes.high))) + return "fileSizeBytes: integer|Long expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + return null; + }; + + /** + * Creates an ExternalBlobReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ExternalBlobReference + * @static + * @param {Object.} object Plain object + * @returns {proto.ExternalBlobReference} ExternalBlobReference + */ + ExternalBlobReference.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ExternalBlobReference) + return object; + var message = new $root.proto.ExternalBlobReference(); + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.handle != null) + message.handle = String(object.handle); + if (object.fileSizeBytes != null) + if ($util.Long) + (message.fileSizeBytes = $util.Long.fromValue(object.fileSizeBytes)).unsigned = true; + else if (typeof object.fileSizeBytes === "string") + message.fileSizeBytes = parseInt(object.fileSizeBytes, 10); + else if (typeof object.fileSizeBytes === "number") + message.fileSizeBytes = object.fileSizeBytes; + else if (typeof object.fileSizeBytes === "object") + message.fileSizeBytes = new $util.LongBits(object.fileSizeBytes.low >>> 0, object.fileSizeBytes.high >>> 0).toNumber(true); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + return message; + }; + + /** + * Creates a plain object from an ExternalBlobReference message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ExternalBlobReference + * @static + * @param {proto.ExternalBlobReference} message ExternalBlobReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExternalBlobReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + object.directPath = ""; + object.handle = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileSizeBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileSizeBytes = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + } + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.handle != null && message.hasOwnProperty("handle")) + object.handle = message.handle; + if (message.fileSizeBytes != null && message.hasOwnProperty("fileSizeBytes")) + if (typeof message.fileSizeBytes === "number") + object.fileSizeBytes = options.longs === String ? String(message.fileSizeBytes) : message.fileSizeBytes; + else + object.fileSizeBytes = options.longs === String ? $util.Long.prototype.toString.call(message.fileSizeBytes) : options.longs === Number ? new $util.LongBits(message.fileSizeBytes.low >>> 0, message.fileSizeBytes.high >>> 0).toNumber(true) : message.fileSizeBytes; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + return object; + }; + + /** + * Converts this ExternalBlobReference to JSON. + * @function toJSON + * @memberof proto.ExternalBlobReference + * @instance + * @returns {Object.} JSON object + */ + ExternalBlobReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExternalBlobReference; + })(); + + proto.GlobalSettings = (function() { + + /** + * Properties of a GlobalSettings. + * @memberof proto + * @interface IGlobalSettings + * @property {proto.IWallpaperSettings|null} [lightThemeWallpaper] GlobalSettings lightThemeWallpaper + * @property {proto.MediaVisibility|null} [mediaVisibility] GlobalSettings mediaVisibility + * @property {proto.IWallpaperSettings|null} [darkThemeWallpaper] GlobalSettings darkThemeWallpaper + * @property {proto.IAutoDownloadSettings|null} [autoDownloadWiFi] GlobalSettings autoDownloadWiFi + * @property {proto.IAutoDownloadSettings|null} [autoDownloadCellular] GlobalSettings autoDownloadCellular + * @property {proto.IAutoDownloadSettings|null} [autoDownloadRoaming] GlobalSettings autoDownloadRoaming + * @property {boolean|null} [showIndividualNotificationsPreview] GlobalSettings showIndividualNotificationsPreview + * @property {boolean|null} [showGroupNotificationsPreview] GlobalSettings showGroupNotificationsPreview + * @property {number|null} [disappearingModeDuration] GlobalSettings disappearingModeDuration + * @property {number|Long|null} [disappearingModeTimestamp] GlobalSettings disappearingModeTimestamp + * @property {proto.IAvatarUserSettings|null} [avatarUserSettings] GlobalSettings avatarUserSettings + */ + + /** + * Constructs a new GlobalSettings. + * @memberof proto + * @classdesc Represents a GlobalSettings. + * @implements IGlobalSettings + * @constructor + * @param {proto.IGlobalSettings=} [properties] Properties to set + */ + function GlobalSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GlobalSettings lightThemeWallpaper. + * @member {proto.IWallpaperSettings|null|undefined} lightThemeWallpaper + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.lightThemeWallpaper = null; + + /** + * GlobalSettings mediaVisibility. + * @member {proto.MediaVisibility} mediaVisibility + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.mediaVisibility = 0; + + /** + * GlobalSettings darkThemeWallpaper. + * @member {proto.IWallpaperSettings|null|undefined} darkThemeWallpaper + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.darkThemeWallpaper = null; + + /** + * GlobalSettings autoDownloadWiFi. + * @member {proto.IAutoDownloadSettings|null|undefined} autoDownloadWiFi + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.autoDownloadWiFi = null; + + /** + * GlobalSettings autoDownloadCellular. + * @member {proto.IAutoDownloadSettings|null|undefined} autoDownloadCellular + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.autoDownloadCellular = null; + + /** + * GlobalSettings autoDownloadRoaming. + * @member {proto.IAutoDownloadSettings|null|undefined} autoDownloadRoaming + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.autoDownloadRoaming = null; + + /** + * GlobalSettings showIndividualNotificationsPreview. + * @member {boolean} showIndividualNotificationsPreview + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.showIndividualNotificationsPreview = false; + + /** + * GlobalSettings showGroupNotificationsPreview. + * @member {boolean} showGroupNotificationsPreview + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.showGroupNotificationsPreview = false; + + /** + * GlobalSettings disappearingModeDuration. + * @member {number} disappearingModeDuration + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.disappearingModeDuration = 0; + + /** + * GlobalSettings disappearingModeTimestamp. + * @member {number|Long} disappearingModeTimestamp + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.disappearingModeTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * GlobalSettings avatarUserSettings. + * @member {proto.IAvatarUserSettings|null|undefined} avatarUserSettings + * @memberof proto.GlobalSettings + * @instance + */ + GlobalSettings.prototype.avatarUserSettings = null; + + /** + * Creates a new GlobalSettings instance using the specified properties. + * @function create + * @memberof proto.GlobalSettings + * @static + * @param {proto.IGlobalSettings=} [properties] Properties to set + * @returns {proto.GlobalSettings} GlobalSettings instance + */ + GlobalSettings.create = function create(properties) { + return new GlobalSettings(properties); + }; + + /** + * Encodes the specified GlobalSettings message. Does not implicitly {@link proto.GlobalSettings.verify|verify} messages. + * @function encode + * @memberof proto.GlobalSettings + * @static + * @param {proto.IGlobalSettings} message GlobalSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlobalSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lightThemeWallpaper != null && Object.hasOwnProperty.call(message, "lightThemeWallpaper")) + $root.proto.WallpaperSettings.encode(message.lightThemeWallpaper, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mediaVisibility != null && Object.hasOwnProperty.call(message, "mediaVisibility")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.mediaVisibility); + if (message.darkThemeWallpaper != null && Object.hasOwnProperty.call(message, "darkThemeWallpaper")) + $root.proto.WallpaperSettings.encode(message.darkThemeWallpaper, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.autoDownloadWiFi != null && Object.hasOwnProperty.call(message, "autoDownloadWiFi")) + $root.proto.AutoDownloadSettings.encode(message.autoDownloadWiFi, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.autoDownloadCellular != null && Object.hasOwnProperty.call(message, "autoDownloadCellular")) + $root.proto.AutoDownloadSettings.encode(message.autoDownloadCellular, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.autoDownloadRoaming != null && Object.hasOwnProperty.call(message, "autoDownloadRoaming")) + $root.proto.AutoDownloadSettings.encode(message.autoDownloadRoaming, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.showIndividualNotificationsPreview != null && Object.hasOwnProperty.call(message, "showIndividualNotificationsPreview")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.showIndividualNotificationsPreview); + if (message.showGroupNotificationsPreview != null && Object.hasOwnProperty.call(message, "showGroupNotificationsPreview")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.showGroupNotificationsPreview); + if (message.disappearingModeDuration != null && Object.hasOwnProperty.call(message, "disappearingModeDuration")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.disappearingModeDuration); + if (message.disappearingModeTimestamp != null && Object.hasOwnProperty.call(message, "disappearingModeTimestamp")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.disappearingModeTimestamp); + if (message.avatarUserSettings != null && Object.hasOwnProperty.call(message, "avatarUserSettings")) + $root.proto.AvatarUserSettings.encode(message.avatarUserSettings, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GlobalSettings message, length delimited. Does not implicitly {@link proto.GlobalSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.GlobalSettings + * @static + * @param {proto.IGlobalSettings} message GlobalSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GlobalSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GlobalSettings message from the specified reader or buffer. + * @function decode + * @memberof proto.GlobalSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.GlobalSettings} GlobalSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlobalSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.GlobalSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lightThemeWallpaper = $root.proto.WallpaperSettings.decode(reader, reader.uint32()); + break; + case 2: + message.mediaVisibility = reader.int32(); + break; + case 3: + message.darkThemeWallpaper = $root.proto.WallpaperSettings.decode(reader, reader.uint32()); + break; + case 4: + message.autoDownloadWiFi = $root.proto.AutoDownloadSettings.decode(reader, reader.uint32()); + break; + case 5: + message.autoDownloadCellular = $root.proto.AutoDownloadSettings.decode(reader, reader.uint32()); + break; + case 6: + message.autoDownloadRoaming = $root.proto.AutoDownloadSettings.decode(reader, reader.uint32()); + break; + case 7: + message.showIndividualNotificationsPreview = reader.bool(); + break; + case 8: + message.showGroupNotificationsPreview = reader.bool(); + break; + case 9: + message.disappearingModeDuration = reader.int32(); + break; + case 10: + message.disappearingModeTimestamp = reader.int64(); + break; + case 11: + message.avatarUserSettings = $root.proto.AvatarUserSettings.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GlobalSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.GlobalSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.GlobalSettings} GlobalSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GlobalSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GlobalSettings message. + * @function verify + * @memberof proto.GlobalSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GlobalSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lightThemeWallpaper != null && message.hasOwnProperty("lightThemeWallpaper")) { + var error = $root.proto.WallpaperSettings.verify(message.lightThemeWallpaper); + if (error) + return "lightThemeWallpaper." + error; + } + if (message.mediaVisibility != null && message.hasOwnProperty("mediaVisibility")) + switch (message.mediaVisibility) { + default: + return "mediaVisibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.darkThemeWallpaper != null && message.hasOwnProperty("darkThemeWallpaper")) { + var error = $root.proto.WallpaperSettings.verify(message.darkThemeWallpaper); + if (error) + return "darkThemeWallpaper." + error; + } + if (message.autoDownloadWiFi != null && message.hasOwnProperty("autoDownloadWiFi")) { + var error = $root.proto.AutoDownloadSettings.verify(message.autoDownloadWiFi); + if (error) + return "autoDownloadWiFi." + error; + } + if (message.autoDownloadCellular != null && message.hasOwnProperty("autoDownloadCellular")) { + var error = $root.proto.AutoDownloadSettings.verify(message.autoDownloadCellular); + if (error) + return "autoDownloadCellular." + error; + } + if (message.autoDownloadRoaming != null && message.hasOwnProperty("autoDownloadRoaming")) { + var error = $root.proto.AutoDownloadSettings.verify(message.autoDownloadRoaming); + if (error) + return "autoDownloadRoaming." + error; + } + if (message.showIndividualNotificationsPreview != null && message.hasOwnProperty("showIndividualNotificationsPreview")) + if (typeof message.showIndividualNotificationsPreview !== "boolean") + return "showIndividualNotificationsPreview: boolean expected"; + if (message.showGroupNotificationsPreview != null && message.hasOwnProperty("showGroupNotificationsPreview")) + if (typeof message.showGroupNotificationsPreview !== "boolean") + return "showGroupNotificationsPreview: boolean expected"; + if (message.disappearingModeDuration != null && message.hasOwnProperty("disappearingModeDuration")) + if (!$util.isInteger(message.disappearingModeDuration)) + return "disappearingModeDuration: integer expected"; + if (message.disappearingModeTimestamp != null && message.hasOwnProperty("disappearingModeTimestamp")) + if (!$util.isInteger(message.disappearingModeTimestamp) && !(message.disappearingModeTimestamp && $util.isInteger(message.disappearingModeTimestamp.low) && $util.isInteger(message.disappearingModeTimestamp.high))) + return "disappearingModeTimestamp: integer|Long expected"; + if (message.avatarUserSettings != null && message.hasOwnProperty("avatarUserSettings")) { + var error = $root.proto.AvatarUserSettings.verify(message.avatarUserSettings); + if (error) + return "avatarUserSettings." + error; + } + return null; + }; + + /** + * Creates a GlobalSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.GlobalSettings + * @static + * @param {Object.} object Plain object + * @returns {proto.GlobalSettings} GlobalSettings + */ + GlobalSettings.fromObject = function fromObject(object) { + if (object instanceof $root.proto.GlobalSettings) + return object; + var message = new $root.proto.GlobalSettings(); + if (object.lightThemeWallpaper != null) { + if (typeof object.lightThemeWallpaper !== "object") + throw TypeError(".proto.GlobalSettings.lightThemeWallpaper: object expected"); + message.lightThemeWallpaper = $root.proto.WallpaperSettings.fromObject(object.lightThemeWallpaper); + } + switch (object.mediaVisibility) { + case "DEFAULT": + case 0: + message.mediaVisibility = 0; + break; + case "OFF": + case 1: + message.mediaVisibility = 1; + break; + case "ON": + case 2: + message.mediaVisibility = 2; + break; + } + if (object.darkThemeWallpaper != null) { + if (typeof object.darkThemeWallpaper !== "object") + throw TypeError(".proto.GlobalSettings.darkThemeWallpaper: object expected"); + message.darkThemeWallpaper = $root.proto.WallpaperSettings.fromObject(object.darkThemeWallpaper); + } + if (object.autoDownloadWiFi != null) { + if (typeof object.autoDownloadWiFi !== "object") + throw TypeError(".proto.GlobalSettings.autoDownloadWiFi: object expected"); + message.autoDownloadWiFi = $root.proto.AutoDownloadSettings.fromObject(object.autoDownloadWiFi); + } + if (object.autoDownloadCellular != null) { + if (typeof object.autoDownloadCellular !== "object") + throw TypeError(".proto.GlobalSettings.autoDownloadCellular: object expected"); + message.autoDownloadCellular = $root.proto.AutoDownloadSettings.fromObject(object.autoDownloadCellular); + } + if (object.autoDownloadRoaming != null) { + if (typeof object.autoDownloadRoaming !== "object") + throw TypeError(".proto.GlobalSettings.autoDownloadRoaming: object expected"); + message.autoDownloadRoaming = $root.proto.AutoDownloadSettings.fromObject(object.autoDownloadRoaming); + } + if (object.showIndividualNotificationsPreview != null) + message.showIndividualNotificationsPreview = Boolean(object.showIndividualNotificationsPreview); + if (object.showGroupNotificationsPreview != null) + message.showGroupNotificationsPreview = Boolean(object.showGroupNotificationsPreview); + if (object.disappearingModeDuration != null) + message.disappearingModeDuration = object.disappearingModeDuration | 0; + if (object.disappearingModeTimestamp != null) + if ($util.Long) + (message.disappearingModeTimestamp = $util.Long.fromValue(object.disappearingModeTimestamp)).unsigned = false; + else if (typeof object.disappearingModeTimestamp === "string") + message.disappearingModeTimestamp = parseInt(object.disappearingModeTimestamp, 10); + else if (typeof object.disappearingModeTimestamp === "number") + message.disappearingModeTimestamp = object.disappearingModeTimestamp; + else if (typeof object.disappearingModeTimestamp === "object") + message.disappearingModeTimestamp = new $util.LongBits(object.disappearingModeTimestamp.low >>> 0, object.disappearingModeTimestamp.high >>> 0).toNumber(); + if (object.avatarUserSettings != null) { + if (typeof object.avatarUserSettings !== "object") + throw TypeError(".proto.GlobalSettings.avatarUserSettings: object expected"); + message.avatarUserSettings = $root.proto.AvatarUserSettings.fromObject(object.avatarUserSettings); + } + return message; + }; + + /** + * Creates a plain object from a GlobalSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.GlobalSettings + * @static + * @param {proto.GlobalSettings} message GlobalSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GlobalSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.lightThemeWallpaper = null; + object.mediaVisibility = options.enums === String ? "DEFAULT" : 0; + object.darkThemeWallpaper = null; + object.autoDownloadWiFi = null; + object.autoDownloadCellular = null; + object.autoDownloadRoaming = null; + object.showIndividualNotificationsPreview = false; + object.showGroupNotificationsPreview = false; + object.disappearingModeDuration = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.disappearingModeTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.disappearingModeTimestamp = options.longs === String ? "0" : 0; + object.avatarUserSettings = null; + } + if (message.lightThemeWallpaper != null && message.hasOwnProperty("lightThemeWallpaper")) + object.lightThemeWallpaper = $root.proto.WallpaperSettings.toObject(message.lightThemeWallpaper, options); + if (message.mediaVisibility != null && message.hasOwnProperty("mediaVisibility")) + object.mediaVisibility = options.enums === String ? $root.proto.MediaVisibility[message.mediaVisibility] : message.mediaVisibility; + if (message.darkThemeWallpaper != null && message.hasOwnProperty("darkThemeWallpaper")) + object.darkThemeWallpaper = $root.proto.WallpaperSettings.toObject(message.darkThemeWallpaper, options); + if (message.autoDownloadWiFi != null && message.hasOwnProperty("autoDownloadWiFi")) + object.autoDownloadWiFi = $root.proto.AutoDownloadSettings.toObject(message.autoDownloadWiFi, options); + if (message.autoDownloadCellular != null && message.hasOwnProperty("autoDownloadCellular")) + object.autoDownloadCellular = $root.proto.AutoDownloadSettings.toObject(message.autoDownloadCellular, options); + if (message.autoDownloadRoaming != null && message.hasOwnProperty("autoDownloadRoaming")) + object.autoDownloadRoaming = $root.proto.AutoDownloadSettings.toObject(message.autoDownloadRoaming, options); + if (message.showIndividualNotificationsPreview != null && message.hasOwnProperty("showIndividualNotificationsPreview")) + object.showIndividualNotificationsPreview = message.showIndividualNotificationsPreview; + if (message.showGroupNotificationsPreview != null && message.hasOwnProperty("showGroupNotificationsPreview")) + object.showGroupNotificationsPreview = message.showGroupNotificationsPreview; + if (message.disappearingModeDuration != null && message.hasOwnProperty("disappearingModeDuration")) + object.disappearingModeDuration = message.disappearingModeDuration; + if (message.disappearingModeTimestamp != null && message.hasOwnProperty("disappearingModeTimestamp")) + if (typeof message.disappearingModeTimestamp === "number") + object.disappearingModeTimestamp = options.longs === String ? String(message.disappearingModeTimestamp) : message.disappearingModeTimestamp; + else + object.disappearingModeTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.disappearingModeTimestamp) : options.longs === Number ? new $util.LongBits(message.disappearingModeTimestamp.low >>> 0, message.disappearingModeTimestamp.high >>> 0).toNumber() : message.disappearingModeTimestamp; + if (message.avatarUserSettings != null && message.hasOwnProperty("avatarUserSettings")) + object.avatarUserSettings = $root.proto.AvatarUserSettings.toObject(message.avatarUserSettings, options); + return object; + }; + + /** + * Converts this GlobalSettings to JSON. + * @function toJSON + * @memberof proto.GlobalSettings + * @instance + * @returns {Object.} JSON object + */ + GlobalSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GlobalSettings; + })(); + + proto.GroupMention = (function() { + + /** + * Properties of a GroupMention. + * @memberof proto + * @interface IGroupMention + * @property {string|null} [groupJid] GroupMention groupJid + * @property {string|null} [groupSubject] GroupMention groupSubject + */ + + /** + * Constructs a new GroupMention. + * @memberof proto + * @classdesc Represents a GroupMention. + * @implements IGroupMention + * @constructor + * @param {proto.IGroupMention=} [properties] Properties to set + */ + function GroupMention(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GroupMention groupJid. + * @member {string} groupJid + * @memberof proto.GroupMention + * @instance + */ + GroupMention.prototype.groupJid = ""; + + /** + * GroupMention groupSubject. + * @member {string} groupSubject + * @memberof proto.GroupMention + * @instance + */ + GroupMention.prototype.groupSubject = ""; + + /** + * Creates a new GroupMention instance using the specified properties. + * @function create + * @memberof proto.GroupMention + * @static + * @param {proto.IGroupMention=} [properties] Properties to set + * @returns {proto.GroupMention} GroupMention instance + */ + GroupMention.create = function create(properties) { + return new GroupMention(properties); + }; + + /** + * Encodes the specified GroupMention message. Does not implicitly {@link proto.GroupMention.verify|verify} messages. + * @function encode + * @memberof proto.GroupMention + * @static + * @param {proto.IGroupMention} message GroupMention message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroupMention.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.groupJid != null && Object.hasOwnProperty.call(message, "groupJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.groupJid); + if (message.groupSubject != null && Object.hasOwnProperty.call(message, "groupSubject")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.groupSubject); + return writer; + }; + + /** + * Encodes the specified GroupMention message, length delimited. Does not implicitly {@link proto.GroupMention.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.GroupMention + * @static + * @param {proto.IGroupMention} message GroupMention message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroupMention.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GroupMention message from the specified reader or buffer. + * @function decode + * @memberof proto.GroupMention + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.GroupMention} GroupMention + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroupMention.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.GroupMention(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupJid = reader.string(); + break; + case 2: + message.groupSubject = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GroupMention message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.GroupMention + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.GroupMention} GroupMention + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroupMention.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GroupMention message. + * @function verify + * @memberof proto.GroupMention + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GroupMention.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.groupJid != null && message.hasOwnProperty("groupJid")) + if (!$util.isString(message.groupJid)) + return "groupJid: string expected"; + if (message.groupSubject != null && message.hasOwnProperty("groupSubject")) + if (!$util.isString(message.groupSubject)) + return "groupSubject: string expected"; + return null; + }; + + /** + * Creates a GroupMention message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.GroupMention + * @static + * @param {Object.} object Plain object + * @returns {proto.GroupMention} GroupMention + */ + GroupMention.fromObject = function fromObject(object) { + if (object instanceof $root.proto.GroupMention) + return object; + var message = new $root.proto.GroupMention(); + if (object.groupJid != null) + message.groupJid = String(object.groupJid); + if (object.groupSubject != null) + message.groupSubject = String(object.groupSubject); + return message; + }; + + /** + * Creates a plain object from a GroupMention message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.GroupMention + * @static + * @param {proto.GroupMention} message GroupMention + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GroupMention.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.groupJid = ""; + object.groupSubject = ""; + } + if (message.groupJid != null && message.hasOwnProperty("groupJid")) + object.groupJid = message.groupJid; + if (message.groupSubject != null && message.hasOwnProperty("groupSubject")) + object.groupSubject = message.groupSubject; + return object; + }; + + /** + * Converts this GroupMention to JSON. + * @function toJSON + * @memberof proto.GroupMention + * @instance + * @returns {Object.} JSON object + */ + GroupMention.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GroupMention; + })(); + + proto.GroupParticipant = (function() { + + /** + * Properties of a GroupParticipant. + * @memberof proto + * @interface IGroupParticipant + * @property {string} userJid GroupParticipant userJid + * @property {proto.GroupParticipant.Rank|null} [rank] GroupParticipant rank + */ + + /** + * Constructs a new GroupParticipant. + * @memberof proto + * @classdesc Represents a GroupParticipant. + * @implements IGroupParticipant + * @constructor + * @param {proto.IGroupParticipant=} [properties] Properties to set + */ + function GroupParticipant(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GroupParticipant userJid. + * @member {string} userJid + * @memberof proto.GroupParticipant + * @instance + */ + GroupParticipant.prototype.userJid = ""; + + /** + * GroupParticipant rank. + * @member {proto.GroupParticipant.Rank} rank + * @memberof proto.GroupParticipant + * @instance + */ + GroupParticipant.prototype.rank = 0; + + /** + * Creates a new GroupParticipant instance using the specified properties. + * @function create + * @memberof proto.GroupParticipant + * @static + * @param {proto.IGroupParticipant=} [properties] Properties to set + * @returns {proto.GroupParticipant} GroupParticipant instance + */ + GroupParticipant.create = function create(properties) { + return new GroupParticipant(properties); + }; + + /** + * Encodes the specified GroupParticipant message. Does not implicitly {@link proto.GroupParticipant.verify|verify} messages. + * @function encode + * @memberof proto.GroupParticipant + * @static + * @param {proto.IGroupParticipant} message GroupParticipant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroupParticipant.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userJid); + if (message.rank != null && Object.hasOwnProperty.call(message, "rank")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rank); + return writer; + }; + + /** + * Encodes the specified GroupParticipant message, length delimited. Does not implicitly {@link proto.GroupParticipant.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.GroupParticipant + * @static + * @param {proto.IGroupParticipant} message GroupParticipant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroupParticipant.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GroupParticipant message from the specified reader or buffer. + * @function decode + * @memberof proto.GroupParticipant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.GroupParticipant} GroupParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroupParticipant.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.GroupParticipant(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userJid = reader.string(); + break; + case 2: + message.rank = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("userJid")) + throw $util.ProtocolError("missing required 'userJid'", { instance: message }); + return message; + }; + + /** + * Decodes a GroupParticipant message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.GroupParticipant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.GroupParticipant} GroupParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroupParticipant.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GroupParticipant message. + * @function verify + * @memberof proto.GroupParticipant + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GroupParticipant.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.userJid)) + return "userJid: string expected"; + if (message.rank != null && message.hasOwnProperty("rank")) + switch (message.rank) { + default: + return "rank: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a GroupParticipant message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.GroupParticipant + * @static + * @param {Object.} object Plain object + * @returns {proto.GroupParticipant} GroupParticipant + */ + GroupParticipant.fromObject = function fromObject(object) { + if (object instanceof $root.proto.GroupParticipant) + return object; + var message = new $root.proto.GroupParticipant(); + if (object.userJid != null) + message.userJid = String(object.userJid); + switch (object.rank) { + case "REGULAR": + case 0: + message.rank = 0; + break; + case "ADMIN": + case 1: + message.rank = 1; + break; + case "SUPERADMIN": + case 2: + message.rank = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a GroupParticipant message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.GroupParticipant + * @static + * @param {proto.GroupParticipant} message GroupParticipant + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GroupParticipant.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userJid = ""; + object.rank = options.enums === String ? "REGULAR" : 0; + } + if (message.userJid != null && message.hasOwnProperty("userJid")) + object.userJid = message.userJid; + if (message.rank != null && message.hasOwnProperty("rank")) + object.rank = options.enums === String ? $root.proto.GroupParticipant.Rank[message.rank] : message.rank; + return object; + }; + + /** + * Converts this GroupParticipant to JSON. + * @function toJSON + * @memberof proto.GroupParticipant + * @instance + * @returns {Object.} JSON object + */ + GroupParticipant.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Rank enum. + * @name proto.GroupParticipant.Rank + * @enum {number} + * @property {number} REGULAR=0 REGULAR value + * @property {number} ADMIN=1 ADMIN value + * @property {number} SUPERADMIN=2 SUPERADMIN value + */ + GroupParticipant.Rank = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REGULAR"] = 0; + values[valuesById[1] = "ADMIN"] = 1; + values[valuesById[2] = "SUPERADMIN"] = 2; + return values; + })(); + + return GroupParticipant; + })(); + + proto.HandshakeMessage = (function() { + + /** + * Properties of a HandshakeMessage. + * @memberof proto + * @interface IHandshakeMessage + * @property {proto.HandshakeMessage.IClientHello|null} [clientHello] HandshakeMessage clientHello + * @property {proto.HandshakeMessage.IServerHello|null} [serverHello] HandshakeMessage serverHello + * @property {proto.HandshakeMessage.IClientFinish|null} [clientFinish] HandshakeMessage clientFinish + */ + + /** + * Constructs a new HandshakeMessage. + * @memberof proto + * @classdesc Represents a HandshakeMessage. + * @implements IHandshakeMessage + * @constructor + * @param {proto.IHandshakeMessage=} [properties] Properties to set + */ + function HandshakeMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HandshakeMessage clientHello. + * @member {proto.HandshakeMessage.IClientHello|null|undefined} clientHello + * @memberof proto.HandshakeMessage + * @instance + */ + HandshakeMessage.prototype.clientHello = null; + + /** + * HandshakeMessage serverHello. + * @member {proto.HandshakeMessage.IServerHello|null|undefined} serverHello + * @memberof proto.HandshakeMessage + * @instance + */ + HandshakeMessage.prototype.serverHello = null; + + /** + * HandshakeMessage clientFinish. + * @member {proto.HandshakeMessage.IClientFinish|null|undefined} clientFinish + * @memberof proto.HandshakeMessage + * @instance + */ + HandshakeMessage.prototype.clientFinish = null; + + /** + * Creates a new HandshakeMessage instance using the specified properties. + * @function create + * @memberof proto.HandshakeMessage + * @static + * @param {proto.IHandshakeMessage=} [properties] Properties to set + * @returns {proto.HandshakeMessage} HandshakeMessage instance + */ + HandshakeMessage.create = function create(properties) { + return new HandshakeMessage(properties); + }; + + /** + * Encodes the specified HandshakeMessage message. Does not implicitly {@link proto.HandshakeMessage.verify|verify} messages. + * @function encode + * @memberof proto.HandshakeMessage + * @static + * @param {proto.IHandshakeMessage} message HandshakeMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HandshakeMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clientHello != null && Object.hasOwnProperty.call(message, "clientHello")) + $root.proto.HandshakeMessage.ClientHello.encode(message.clientHello, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.serverHello != null && Object.hasOwnProperty.call(message, "serverHello")) + $root.proto.HandshakeMessage.ServerHello.encode(message.serverHello, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.clientFinish != null && Object.hasOwnProperty.call(message, "clientFinish")) + $root.proto.HandshakeMessage.ClientFinish.encode(message.clientFinish, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HandshakeMessage message, length delimited. Does not implicitly {@link proto.HandshakeMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HandshakeMessage + * @static + * @param {proto.IHandshakeMessage} message HandshakeMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HandshakeMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HandshakeMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.HandshakeMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HandshakeMessage} HandshakeMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HandshakeMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HandshakeMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.clientHello = $root.proto.HandshakeMessage.ClientHello.decode(reader, reader.uint32()); + break; + case 3: + message.serverHello = $root.proto.HandshakeMessage.ServerHello.decode(reader, reader.uint32()); + break; + case 4: + message.clientFinish = $root.proto.HandshakeMessage.ClientFinish.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HandshakeMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HandshakeMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HandshakeMessage} HandshakeMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HandshakeMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HandshakeMessage message. + * @function verify + * @memberof proto.HandshakeMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HandshakeMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clientHello != null && message.hasOwnProperty("clientHello")) { + var error = $root.proto.HandshakeMessage.ClientHello.verify(message.clientHello); + if (error) + return "clientHello." + error; + } + if (message.serverHello != null && message.hasOwnProperty("serverHello")) { + var error = $root.proto.HandshakeMessage.ServerHello.verify(message.serverHello); + if (error) + return "serverHello." + error; + } + if (message.clientFinish != null && message.hasOwnProperty("clientFinish")) { + var error = $root.proto.HandshakeMessage.ClientFinish.verify(message.clientFinish); + if (error) + return "clientFinish." + error; + } + return null; + }; + + /** + * Creates a HandshakeMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HandshakeMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.HandshakeMessage} HandshakeMessage + */ + HandshakeMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HandshakeMessage) + return object; + var message = new $root.proto.HandshakeMessage(); + if (object.clientHello != null) { + if (typeof object.clientHello !== "object") + throw TypeError(".proto.HandshakeMessage.clientHello: object expected"); + message.clientHello = $root.proto.HandshakeMessage.ClientHello.fromObject(object.clientHello); + } + if (object.serverHello != null) { + if (typeof object.serverHello !== "object") + throw TypeError(".proto.HandshakeMessage.serverHello: object expected"); + message.serverHello = $root.proto.HandshakeMessage.ServerHello.fromObject(object.serverHello); + } + if (object.clientFinish != null) { + if (typeof object.clientFinish !== "object") + throw TypeError(".proto.HandshakeMessage.clientFinish: object expected"); + message.clientFinish = $root.proto.HandshakeMessage.ClientFinish.fromObject(object.clientFinish); + } + return message; + }; + + /** + * Creates a plain object from a HandshakeMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HandshakeMessage + * @static + * @param {proto.HandshakeMessage} message HandshakeMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HandshakeMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.clientHello = null; + object.serverHello = null; + object.clientFinish = null; + } + if (message.clientHello != null && message.hasOwnProperty("clientHello")) + object.clientHello = $root.proto.HandshakeMessage.ClientHello.toObject(message.clientHello, options); + if (message.serverHello != null && message.hasOwnProperty("serverHello")) + object.serverHello = $root.proto.HandshakeMessage.ServerHello.toObject(message.serverHello, options); + if (message.clientFinish != null && message.hasOwnProperty("clientFinish")) + object.clientFinish = $root.proto.HandshakeMessage.ClientFinish.toObject(message.clientFinish, options); + return object; + }; + + /** + * Converts this HandshakeMessage to JSON. + * @function toJSON + * @memberof proto.HandshakeMessage + * @instance + * @returns {Object.} JSON object + */ + HandshakeMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + HandshakeMessage.ClientFinish = (function() { + + /** + * Properties of a ClientFinish. + * @memberof proto.HandshakeMessage + * @interface IClientFinish + * @property {Uint8Array|null} ["static"] ClientFinish static + * @property {Uint8Array|null} [payload] ClientFinish payload + */ + + /** + * Constructs a new ClientFinish. + * @memberof proto.HandshakeMessage + * @classdesc Represents a ClientFinish. + * @implements IClientFinish + * @constructor + * @param {proto.HandshakeMessage.IClientFinish=} [properties] Properties to set + */ + function ClientFinish(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientFinish static. + * @member {Uint8Array} static + * @memberof proto.HandshakeMessage.ClientFinish + * @instance + */ + ClientFinish.prototype["static"] = $util.newBuffer([]); + + /** + * ClientFinish payload. + * @member {Uint8Array} payload + * @memberof proto.HandshakeMessage.ClientFinish + * @instance + */ + ClientFinish.prototype.payload = $util.newBuffer([]); + + /** + * Creates a new ClientFinish instance using the specified properties. + * @function create + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {proto.HandshakeMessage.IClientFinish=} [properties] Properties to set + * @returns {proto.HandshakeMessage.ClientFinish} ClientFinish instance + */ + ClientFinish.create = function create(properties) { + return new ClientFinish(properties); + }; + + /** + * Encodes the specified ClientFinish message. Does not implicitly {@link proto.HandshakeMessage.ClientFinish.verify|verify} messages. + * @function encode + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {proto.HandshakeMessage.IClientFinish} message ClientFinish message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientFinish.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["static"] != null && Object.hasOwnProperty.call(message, "static")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message["static"]); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.payload); + return writer; + }; + + /** + * Encodes the specified ClientFinish message, length delimited. Does not implicitly {@link proto.HandshakeMessage.ClientFinish.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {proto.HandshakeMessage.IClientFinish} message ClientFinish message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientFinish.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientFinish message from the specified reader or buffer. + * @function decode + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HandshakeMessage.ClientFinish} ClientFinish + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientFinish.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HandshakeMessage.ClientFinish(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["static"] = reader.bytes(); + break; + case 2: + message.payload = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientFinish message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HandshakeMessage.ClientFinish} ClientFinish + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientFinish.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientFinish message. + * @function verify + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientFinish.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["static"] != null && message.hasOwnProperty("static")) + if (!(message["static"] && typeof message["static"].length === "number" || $util.isString(message["static"]))) + return "static: buffer expected"; + if (message.payload != null && message.hasOwnProperty("payload")) + if (!(message.payload && typeof message.payload.length === "number" || $util.isString(message.payload))) + return "payload: buffer expected"; + return null; + }; + + /** + * Creates a ClientFinish message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {Object.} object Plain object + * @returns {proto.HandshakeMessage.ClientFinish} ClientFinish + */ + ClientFinish.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HandshakeMessage.ClientFinish) + return object; + var message = new $root.proto.HandshakeMessage.ClientFinish(); + if (object["static"] != null) + if (typeof object["static"] === "string") + $util.base64.decode(object["static"], message["static"] = $util.newBuffer($util.base64.length(object["static"])), 0); + else if (object["static"].length) + message["static"] = object["static"]; + if (object.payload != null) + if (typeof object.payload === "string") + $util.base64.decode(object.payload, message.payload = $util.newBuffer($util.base64.length(object.payload)), 0); + else if (object.payload.length) + message.payload = object.payload; + return message; + }; + + /** + * Creates a plain object from a ClientFinish message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HandshakeMessage.ClientFinish + * @static + * @param {proto.HandshakeMessage.ClientFinish} message ClientFinish + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientFinish.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object["static"] = ""; + else { + object["static"] = []; + if (options.bytes !== Array) + object["static"] = $util.newBuffer(object["static"]); + } + if (options.bytes === String) + object.payload = ""; + else { + object.payload = []; + if (options.bytes !== Array) + object.payload = $util.newBuffer(object.payload); + } + } + if (message["static"] != null && message.hasOwnProperty("static")) + object["static"] = options.bytes === String ? $util.base64.encode(message["static"], 0, message["static"].length) : options.bytes === Array ? Array.prototype.slice.call(message["static"]) : message["static"]; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = options.bytes === String ? $util.base64.encode(message.payload, 0, message.payload.length) : options.bytes === Array ? Array.prototype.slice.call(message.payload) : message.payload; + return object; + }; + + /** + * Converts this ClientFinish to JSON. + * @function toJSON + * @memberof proto.HandshakeMessage.ClientFinish + * @instance + * @returns {Object.} JSON object + */ + ClientFinish.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientFinish; + })(); + + HandshakeMessage.ClientHello = (function() { + + /** + * Properties of a ClientHello. + * @memberof proto.HandshakeMessage + * @interface IClientHello + * @property {Uint8Array|null} [ephemeral] ClientHello ephemeral + * @property {Uint8Array|null} ["static"] ClientHello static + * @property {Uint8Array|null} [payload] ClientHello payload + */ + + /** + * Constructs a new ClientHello. + * @memberof proto.HandshakeMessage + * @classdesc Represents a ClientHello. + * @implements IClientHello + * @constructor + * @param {proto.HandshakeMessage.IClientHello=} [properties] Properties to set + */ + function ClientHello(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientHello ephemeral. + * @member {Uint8Array} ephemeral + * @memberof proto.HandshakeMessage.ClientHello + * @instance + */ + ClientHello.prototype.ephemeral = $util.newBuffer([]); + + /** + * ClientHello static. + * @member {Uint8Array} static + * @memberof proto.HandshakeMessage.ClientHello + * @instance + */ + ClientHello.prototype["static"] = $util.newBuffer([]); + + /** + * ClientHello payload. + * @member {Uint8Array} payload + * @memberof proto.HandshakeMessage.ClientHello + * @instance + */ + ClientHello.prototype.payload = $util.newBuffer([]); + + /** + * Creates a new ClientHello instance using the specified properties. + * @function create + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {proto.HandshakeMessage.IClientHello=} [properties] Properties to set + * @returns {proto.HandshakeMessage.ClientHello} ClientHello instance + */ + ClientHello.create = function create(properties) { + return new ClientHello(properties); + }; + + /** + * Encodes the specified ClientHello message. Does not implicitly {@link proto.HandshakeMessage.ClientHello.verify|verify} messages. + * @function encode + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {proto.HandshakeMessage.IClientHello} message ClientHello message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientHello.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ephemeral != null && Object.hasOwnProperty.call(message, "ephemeral")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ephemeral); + if (message["static"] != null && Object.hasOwnProperty.call(message, "static")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message["static"]); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.payload); + return writer; + }; + + /** + * Encodes the specified ClientHello message, length delimited. Does not implicitly {@link proto.HandshakeMessage.ClientHello.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {proto.HandshakeMessage.IClientHello} message ClientHello message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientHello.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientHello message from the specified reader or buffer. + * @function decode + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HandshakeMessage.ClientHello} ClientHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientHello.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HandshakeMessage.ClientHello(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ephemeral = reader.bytes(); + break; + case 2: + message["static"] = reader.bytes(); + break; + case 3: + message.payload = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientHello message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HandshakeMessage.ClientHello} ClientHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientHello.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientHello message. + * @function verify + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientHello.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ephemeral != null && message.hasOwnProperty("ephemeral")) + if (!(message.ephemeral && typeof message.ephemeral.length === "number" || $util.isString(message.ephemeral))) + return "ephemeral: buffer expected"; + if (message["static"] != null && message.hasOwnProperty("static")) + if (!(message["static"] && typeof message["static"].length === "number" || $util.isString(message["static"]))) + return "static: buffer expected"; + if (message.payload != null && message.hasOwnProperty("payload")) + if (!(message.payload && typeof message.payload.length === "number" || $util.isString(message.payload))) + return "payload: buffer expected"; + return null; + }; + + /** + * Creates a ClientHello message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {Object.} object Plain object + * @returns {proto.HandshakeMessage.ClientHello} ClientHello + */ + ClientHello.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HandshakeMessage.ClientHello) + return object; + var message = new $root.proto.HandshakeMessage.ClientHello(); + if (object.ephemeral != null) + if (typeof object.ephemeral === "string") + $util.base64.decode(object.ephemeral, message.ephemeral = $util.newBuffer($util.base64.length(object.ephemeral)), 0); + else if (object.ephemeral.length) + message.ephemeral = object.ephemeral; + if (object["static"] != null) + if (typeof object["static"] === "string") + $util.base64.decode(object["static"], message["static"] = $util.newBuffer($util.base64.length(object["static"])), 0); + else if (object["static"].length) + message["static"] = object["static"]; + if (object.payload != null) + if (typeof object.payload === "string") + $util.base64.decode(object.payload, message.payload = $util.newBuffer($util.base64.length(object.payload)), 0); + else if (object.payload.length) + message.payload = object.payload; + return message; + }; + + /** + * Creates a plain object from a ClientHello message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HandshakeMessage.ClientHello + * @static + * @param {proto.HandshakeMessage.ClientHello} message ClientHello + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientHello.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.ephemeral = ""; + else { + object.ephemeral = []; + if (options.bytes !== Array) + object.ephemeral = $util.newBuffer(object.ephemeral); + } + if (options.bytes === String) + object["static"] = ""; + else { + object["static"] = []; + if (options.bytes !== Array) + object["static"] = $util.newBuffer(object["static"]); + } + if (options.bytes === String) + object.payload = ""; + else { + object.payload = []; + if (options.bytes !== Array) + object.payload = $util.newBuffer(object.payload); + } + } + if (message.ephemeral != null && message.hasOwnProperty("ephemeral")) + object.ephemeral = options.bytes === String ? $util.base64.encode(message.ephemeral, 0, message.ephemeral.length) : options.bytes === Array ? Array.prototype.slice.call(message.ephemeral) : message.ephemeral; + if (message["static"] != null && message.hasOwnProperty("static")) + object["static"] = options.bytes === String ? $util.base64.encode(message["static"], 0, message["static"].length) : options.bytes === Array ? Array.prototype.slice.call(message["static"]) : message["static"]; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = options.bytes === String ? $util.base64.encode(message.payload, 0, message.payload.length) : options.bytes === Array ? Array.prototype.slice.call(message.payload) : message.payload; + return object; + }; + + /** + * Converts this ClientHello to JSON. + * @function toJSON + * @memberof proto.HandshakeMessage.ClientHello + * @instance + * @returns {Object.} JSON object + */ + ClientHello.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClientHello; + })(); + + HandshakeMessage.ServerHello = (function() { + + /** + * Properties of a ServerHello. + * @memberof proto.HandshakeMessage + * @interface IServerHello + * @property {Uint8Array|null} [ephemeral] ServerHello ephemeral + * @property {Uint8Array|null} ["static"] ServerHello static + * @property {Uint8Array|null} [payload] ServerHello payload + */ + + /** + * Constructs a new ServerHello. + * @memberof proto.HandshakeMessage + * @classdesc Represents a ServerHello. + * @implements IServerHello + * @constructor + * @param {proto.HandshakeMessage.IServerHello=} [properties] Properties to set + */ + function ServerHello(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServerHello ephemeral. + * @member {Uint8Array} ephemeral + * @memberof proto.HandshakeMessage.ServerHello + * @instance + */ + ServerHello.prototype.ephemeral = $util.newBuffer([]); + + /** + * ServerHello static. + * @member {Uint8Array} static + * @memberof proto.HandshakeMessage.ServerHello + * @instance + */ + ServerHello.prototype["static"] = $util.newBuffer([]); + + /** + * ServerHello payload. + * @member {Uint8Array} payload + * @memberof proto.HandshakeMessage.ServerHello + * @instance + */ + ServerHello.prototype.payload = $util.newBuffer([]); + + /** + * Creates a new ServerHello instance using the specified properties. + * @function create + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {proto.HandshakeMessage.IServerHello=} [properties] Properties to set + * @returns {proto.HandshakeMessage.ServerHello} ServerHello instance + */ + ServerHello.create = function create(properties) { + return new ServerHello(properties); + }; + + /** + * Encodes the specified ServerHello message. Does not implicitly {@link proto.HandshakeMessage.ServerHello.verify|verify} messages. + * @function encode + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {proto.HandshakeMessage.IServerHello} message ServerHello message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServerHello.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ephemeral != null && Object.hasOwnProperty.call(message, "ephemeral")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.ephemeral); + if (message["static"] != null && Object.hasOwnProperty.call(message, "static")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message["static"]); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.payload); + return writer; + }; + + /** + * Encodes the specified ServerHello message, length delimited. Does not implicitly {@link proto.HandshakeMessage.ServerHello.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {proto.HandshakeMessage.IServerHello} message ServerHello message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServerHello.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServerHello message from the specified reader or buffer. + * @function decode + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HandshakeMessage.ServerHello} ServerHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServerHello.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HandshakeMessage.ServerHello(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ephemeral = reader.bytes(); + break; + case 2: + message["static"] = reader.bytes(); + break; + case 3: + message.payload = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServerHello message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HandshakeMessage.ServerHello} ServerHello + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServerHello.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServerHello message. + * @function verify + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServerHello.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ephemeral != null && message.hasOwnProperty("ephemeral")) + if (!(message.ephemeral && typeof message.ephemeral.length === "number" || $util.isString(message.ephemeral))) + return "ephemeral: buffer expected"; + if (message["static"] != null && message.hasOwnProperty("static")) + if (!(message["static"] && typeof message["static"].length === "number" || $util.isString(message["static"]))) + return "static: buffer expected"; + if (message.payload != null && message.hasOwnProperty("payload")) + if (!(message.payload && typeof message.payload.length === "number" || $util.isString(message.payload))) + return "payload: buffer expected"; + return null; + }; + + /** + * Creates a ServerHello message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {Object.} object Plain object + * @returns {proto.HandshakeMessage.ServerHello} ServerHello + */ + ServerHello.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HandshakeMessage.ServerHello) + return object; + var message = new $root.proto.HandshakeMessage.ServerHello(); + if (object.ephemeral != null) + if (typeof object.ephemeral === "string") + $util.base64.decode(object.ephemeral, message.ephemeral = $util.newBuffer($util.base64.length(object.ephemeral)), 0); + else if (object.ephemeral.length) + message.ephemeral = object.ephemeral; + if (object["static"] != null) + if (typeof object["static"] === "string") + $util.base64.decode(object["static"], message["static"] = $util.newBuffer($util.base64.length(object["static"])), 0); + else if (object["static"].length) + message["static"] = object["static"]; + if (object.payload != null) + if (typeof object.payload === "string") + $util.base64.decode(object.payload, message.payload = $util.newBuffer($util.base64.length(object.payload)), 0); + else if (object.payload.length) + message.payload = object.payload; + return message; + }; + + /** + * Creates a plain object from a ServerHello message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HandshakeMessage.ServerHello + * @static + * @param {proto.HandshakeMessage.ServerHello} message ServerHello + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServerHello.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.ephemeral = ""; + else { + object.ephemeral = []; + if (options.bytes !== Array) + object.ephemeral = $util.newBuffer(object.ephemeral); + } + if (options.bytes === String) + object["static"] = ""; + else { + object["static"] = []; + if (options.bytes !== Array) + object["static"] = $util.newBuffer(object["static"]); + } + if (options.bytes === String) + object.payload = ""; + else { + object.payload = []; + if (options.bytes !== Array) + object.payload = $util.newBuffer(object.payload); + } + } + if (message.ephemeral != null && message.hasOwnProperty("ephemeral")) + object.ephemeral = options.bytes === String ? $util.base64.encode(message.ephemeral, 0, message.ephemeral.length) : options.bytes === Array ? Array.prototype.slice.call(message.ephemeral) : message.ephemeral; + if (message["static"] != null && message.hasOwnProperty("static")) + object["static"] = options.bytes === String ? $util.base64.encode(message["static"], 0, message["static"].length) : options.bytes === Array ? Array.prototype.slice.call(message["static"]) : message["static"]; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = options.bytes === String ? $util.base64.encode(message.payload, 0, message.payload.length) : options.bytes === Array ? Array.prototype.slice.call(message.payload) : message.payload; + return object; + }; + + /** + * Converts this ServerHello to JSON. + * @function toJSON + * @memberof proto.HandshakeMessage.ServerHello + * @instance + * @returns {Object.} JSON object + */ + ServerHello.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServerHello; + })(); + + return HandshakeMessage; + })(); + + proto.HistorySync = (function() { + + /** + * Properties of a HistorySync. + * @memberof proto + * @interface IHistorySync + * @property {proto.HistorySync.HistorySyncType} syncType HistorySync syncType + * @property {Array.|null} [conversations] HistorySync conversations + * @property {Array.|null} [statusV3Messages] HistorySync statusV3Messages + * @property {number|null} [chunkOrder] HistorySync chunkOrder + * @property {number|null} [progress] HistorySync progress + * @property {Array.|null} [pushnames] HistorySync pushnames + * @property {proto.IGlobalSettings|null} [globalSettings] HistorySync globalSettings + * @property {Uint8Array|null} [threadIdUserSecret] HistorySync threadIdUserSecret + * @property {number|null} [threadDsTimeframeOffset] HistorySync threadDsTimeframeOffset + * @property {Array.|null} [recentStickers] HistorySync recentStickers + * @property {Array.|null} [pastParticipants] HistorySync pastParticipants + */ + + /** + * Constructs a new HistorySync. + * @memberof proto + * @classdesc Represents a HistorySync. + * @implements IHistorySync + * @constructor + * @param {proto.IHistorySync=} [properties] Properties to set + */ + function HistorySync(properties) { + this.conversations = []; + this.statusV3Messages = []; + this.pushnames = []; + this.recentStickers = []; + this.pastParticipants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HistorySync syncType. + * @member {proto.HistorySync.HistorySyncType} syncType + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.syncType = 0; + + /** + * HistorySync conversations. + * @member {Array.} conversations + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.conversations = $util.emptyArray; + + /** + * HistorySync statusV3Messages. + * @member {Array.} statusV3Messages + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.statusV3Messages = $util.emptyArray; + + /** + * HistorySync chunkOrder. + * @member {number} chunkOrder + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.chunkOrder = 0; + + /** + * HistorySync progress. + * @member {number} progress + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.progress = 0; + + /** + * HistorySync pushnames. + * @member {Array.} pushnames + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.pushnames = $util.emptyArray; + + /** + * HistorySync globalSettings. + * @member {proto.IGlobalSettings|null|undefined} globalSettings + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.globalSettings = null; + + /** + * HistorySync threadIdUserSecret. + * @member {Uint8Array} threadIdUserSecret + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.threadIdUserSecret = $util.newBuffer([]); + + /** + * HistorySync threadDsTimeframeOffset. + * @member {number} threadDsTimeframeOffset + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.threadDsTimeframeOffset = 0; + + /** + * HistorySync recentStickers. + * @member {Array.} recentStickers + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.recentStickers = $util.emptyArray; + + /** + * HistorySync pastParticipants. + * @member {Array.} pastParticipants + * @memberof proto.HistorySync + * @instance + */ + HistorySync.prototype.pastParticipants = $util.emptyArray; + + /** + * Creates a new HistorySync instance using the specified properties. + * @function create + * @memberof proto.HistorySync + * @static + * @param {proto.IHistorySync=} [properties] Properties to set + * @returns {proto.HistorySync} HistorySync instance + */ + HistorySync.create = function create(properties) { + return new HistorySync(properties); + }; + + /** + * Encodes the specified HistorySync message. Does not implicitly {@link proto.HistorySync.verify|verify} messages. + * @function encode + * @memberof proto.HistorySync + * @static + * @param {proto.IHistorySync} message HistorySync message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySync.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.syncType); + if (message.conversations != null && message.conversations.length) + for (var i = 0; i < message.conversations.length; ++i) + $root.proto.Conversation.encode(message.conversations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.statusV3Messages != null && message.statusV3Messages.length) + for (var i = 0; i < message.statusV3Messages.length; ++i) + $root.proto.WebMessageInfo.encode(message.statusV3Messages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.chunkOrder != null && Object.hasOwnProperty.call(message, "chunkOrder")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.chunkOrder); + if (message.progress != null && Object.hasOwnProperty.call(message, "progress")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.progress); + if (message.pushnames != null && message.pushnames.length) + for (var i = 0; i < message.pushnames.length; ++i) + $root.proto.Pushname.encode(message.pushnames[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.globalSettings != null && Object.hasOwnProperty.call(message, "globalSettings")) + $root.proto.GlobalSettings.encode(message.globalSettings, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.threadIdUserSecret != null && Object.hasOwnProperty.call(message, "threadIdUserSecret")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.threadIdUserSecret); + if (message.threadDsTimeframeOffset != null && Object.hasOwnProperty.call(message, "threadDsTimeframeOffset")) + writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.threadDsTimeframeOffset); + if (message.recentStickers != null && message.recentStickers.length) + for (var i = 0; i < message.recentStickers.length; ++i) + $root.proto.StickerMetadata.encode(message.recentStickers[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.pastParticipants != null && message.pastParticipants.length) + for (var i = 0; i < message.pastParticipants.length; ++i) + $root.proto.PastParticipants.encode(message.pastParticipants[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HistorySync message, length delimited. Does not implicitly {@link proto.HistorySync.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HistorySync + * @static + * @param {proto.IHistorySync} message HistorySync message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySync.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HistorySync message from the specified reader or buffer. + * @function decode + * @memberof proto.HistorySync + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HistorySync} HistorySync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySync.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HistorySync(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.syncType = reader.int32(); + break; + case 2: + if (!(message.conversations && message.conversations.length)) + message.conversations = []; + message.conversations.push($root.proto.Conversation.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.statusV3Messages && message.statusV3Messages.length)) + message.statusV3Messages = []; + message.statusV3Messages.push($root.proto.WebMessageInfo.decode(reader, reader.uint32())); + break; + case 5: + message.chunkOrder = reader.uint32(); + break; + case 6: + message.progress = reader.uint32(); + break; + case 7: + if (!(message.pushnames && message.pushnames.length)) + message.pushnames = []; + message.pushnames.push($root.proto.Pushname.decode(reader, reader.uint32())); + break; + case 8: + message.globalSettings = $root.proto.GlobalSettings.decode(reader, reader.uint32()); + break; + case 9: + message.threadIdUserSecret = reader.bytes(); + break; + case 10: + message.threadDsTimeframeOffset = reader.uint32(); + break; + case 11: + if (!(message.recentStickers && message.recentStickers.length)) + message.recentStickers = []; + message.recentStickers.push($root.proto.StickerMetadata.decode(reader, reader.uint32())); + break; + case 12: + if (!(message.pastParticipants && message.pastParticipants.length)) + message.pastParticipants = []; + message.pastParticipants.push($root.proto.PastParticipants.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("syncType")) + throw $util.ProtocolError("missing required 'syncType'", { instance: message }); + return message; + }; + + /** + * Decodes a HistorySync message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HistorySync + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HistorySync} HistorySync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySync.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HistorySync message. + * @function verify + * @memberof proto.HistorySync + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HistorySync.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + switch (message.syncType) { + default: + return "syncType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.conversations != null && message.hasOwnProperty("conversations")) { + if (!Array.isArray(message.conversations)) + return "conversations: array expected"; + for (var i = 0; i < message.conversations.length; ++i) { + var error = $root.proto.Conversation.verify(message.conversations[i]); + if (error) + return "conversations." + error; + } + } + if (message.statusV3Messages != null && message.hasOwnProperty("statusV3Messages")) { + if (!Array.isArray(message.statusV3Messages)) + return "statusV3Messages: array expected"; + for (var i = 0; i < message.statusV3Messages.length; ++i) { + var error = $root.proto.WebMessageInfo.verify(message.statusV3Messages[i]); + if (error) + return "statusV3Messages." + error; + } + } + if (message.chunkOrder != null && message.hasOwnProperty("chunkOrder")) + if (!$util.isInteger(message.chunkOrder)) + return "chunkOrder: integer expected"; + if (message.progress != null && message.hasOwnProperty("progress")) + if (!$util.isInteger(message.progress)) + return "progress: integer expected"; + if (message.pushnames != null && message.hasOwnProperty("pushnames")) { + if (!Array.isArray(message.pushnames)) + return "pushnames: array expected"; + for (var i = 0; i < message.pushnames.length; ++i) { + var error = $root.proto.Pushname.verify(message.pushnames[i]); + if (error) + return "pushnames." + error; + } + } + if (message.globalSettings != null && message.hasOwnProperty("globalSettings")) { + var error = $root.proto.GlobalSettings.verify(message.globalSettings); + if (error) + return "globalSettings." + error; + } + if (message.threadIdUserSecret != null && message.hasOwnProperty("threadIdUserSecret")) + if (!(message.threadIdUserSecret && typeof message.threadIdUserSecret.length === "number" || $util.isString(message.threadIdUserSecret))) + return "threadIdUserSecret: buffer expected"; + if (message.threadDsTimeframeOffset != null && message.hasOwnProperty("threadDsTimeframeOffset")) + if (!$util.isInteger(message.threadDsTimeframeOffset)) + return "threadDsTimeframeOffset: integer expected"; + if (message.recentStickers != null && message.hasOwnProperty("recentStickers")) { + if (!Array.isArray(message.recentStickers)) + return "recentStickers: array expected"; + for (var i = 0; i < message.recentStickers.length; ++i) { + var error = $root.proto.StickerMetadata.verify(message.recentStickers[i]); + if (error) + return "recentStickers." + error; + } + } + if (message.pastParticipants != null && message.hasOwnProperty("pastParticipants")) { + if (!Array.isArray(message.pastParticipants)) + return "pastParticipants: array expected"; + for (var i = 0; i < message.pastParticipants.length; ++i) { + var error = $root.proto.PastParticipants.verify(message.pastParticipants[i]); + if (error) + return "pastParticipants." + error; + } + } + return null; + }; + + /** + * Creates a HistorySync message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HistorySync + * @static + * @param {Object.} object Plain object + * @returns {proto.HistorySync} HistorySync + */ + HistorySync.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HistorySync) + return object; + var message = new $root.proto.HistorySync(); + switch (object.syncType) { + case "INITIAL_BOOTSTRAP": + case 0: + message.syncType = 0; + break; + case "INITIAL_STATUS_V3": + case 1: + message.syncType = 1; + break; + case "FULL": + case 2: + message.syncType = 2; + break; + case "RECENT": + case 3: + message.syncType = 3; + break; + case "PUSH_NAME": + case 4: + message.syncType = 4; + break; + case "NON_BLOCKING_DATA": + case 5: + message.syncType = 5; + break; + case "ON_DEMAND": + case 6: + message.syncType = 6; + break; + } + if (object.conversations) { + if (!Array.isArray(object.conversations)) + throw TypeError(".proto.HistorySync.conversations: array expected"); + message.conversations = []; + for (var i = 0; i < object.conversations.length; ++i) { + if (typeof object.conversations[i] !== "object") + throw TypeError(".proto.HistorySync.conversations: object expected"); + message.conversations[i] = $root.proto.Conversation.fromObject(object.conversations[i]); + } + } + if (object.statusV3Messages) { + if (!Array.isArray(object.statusV3Messages)) + throw TypeError(".proto.HistorySync.statusV3Messages: array expected"); + message.statusV3Messages = []; + for (var i = 0; i < object.statusV3Messages.length; ++i) { + if (typeof object.statusV3Messages[i] !== "object") + throw TypeError(".proto.HistorySync.statusV3Messages: object expected"); + message.statusV3Messages[i] = $root.proto.WebMessageInfo.fromObject(object.statusV3Messages[i]); + } + } + if (object.chunkOrder != null) + message.chunkOrder = object.chunkOrder >>> 0; + if (object.progress != null) + message.progress = object.progress >>> 0; + if (object.pushnames) { + if (!Array.isArray(object.pushnames)) + throw TypeError(".proto.HistorySync.pushnames: array expected"); + message.pushnames = []; + for (var i = 0; i < object.pushnames.length; ++i) { + if (typeof object.pushnames[i] !== "object") + throw TypeError(".proto.HistorySync.pushnames: object expected"); + message.pushnames[i] = $root.proto.Pushname.fromObject(object.pushnames[i]); + } + } + if (object.globalSettings != null) { + if (typeof object.globalSettings !== "object") + throw TypeError(".proto.HistorySync.globalSettings: object expected"); + message.globalSettings = $root.proto.GlobalSettings.fromObject(object.globalSettings); + } + if (object.threadIdUserSecret != null) + if (typeof object.threadIdUserSecret === "string") + $util.base64.decode(object.threadIdUserSecret, message.threadIdUserSecret = $util.newBuffer($util.base64.length(object.threadIdUserSecret)), 0); + else if (object.threadIdUserSecret.length) + message.threadIdUserSecret = object.threadIdUserSecret; + if (object.threadDsTimeframeOffset != null) + message.threadDsTimeframeOffset = object.threadDsTimeframeOffset >>> 0; + if (object.recentStickers) { + if (!Array.isArray(object.recentStickers)) + throw TypeError(".proto.HistorySync.recentStickers: array expected"); + message.recentStickers = []; + for (var i = 0; i < object.recentStickers.length; ++i) { + if (typeof object.recentStickers[i] !== "object") + throw TypeError(".proto.HistorySync.recentStickers: object expected"); + message.recentStickers[i] = $root.proto.StickerMetadata.fromObject(object.recentStickers[i]); + } + } + if (object.pastParticipants) { + if (!Array.isArray(object.pastParticipants)) + throw TypeError(".proto.HistorySync.pastParticipants: array expected"); + message.pastParticipants = []; + for (var i = 0; i < object.pastParticipants.length; ++i) { + if (typeof object.pastParticipants[i] !== "object") + throw TypeError(".proto.HistorySync.pastParticipants: object expected"); + message.pastParticipants[i] = $root.proto.PastParticipants.fromObject(object.pastParticipants[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HistorySync message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HistorySync + * @static + * @param {proto.HistorySync} message HistorySync + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HistorySync.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.conversations = []; + object.statusV3Messages = []; + object.pushnames = []; + object.recentStickers = []; + object.pastParticipants = []; + } + if (options.defaults) { + object.syncType = options.enums === String ? "INITIAL_BOOTSTRAP" : 0; + object.chunkOrder = 0; + object.progress = 0; + object.globalSettings = null; + if (options.bytes === String) + object.threadIdUserSecret = ""; + else { + object.threadIdUserSecret = []; + if (options.bytes !== Array) + object.threadIdUserSecret = $util.newBuffer(object.threadIdUserSecret); + } + object.threadDsTimeframeOffset = 0; + } + if (message.syncType != null && message.hasOwnProperty("syncType")) + object.syncType = options.enums === String ? $root.proto.HistorySync.HistorySyncType[message.syncType] : message.syncType; + if (message.conversations && message.conversations.length) { + object.conversations = []; + for (var j = 0; j < message.conversations.length; ++j) + object.conversations[j] = $root.proto.Conversation.toObject(message.conversations[j], options); + } + if (message.statusV3Messages && message.statusV3Messages.length) { + object.statusV3Messages = []; + for (var j = 0; j < message.statusV3Messages.length; ++j) + object.statusV3Messages[j] = $root.proto.WebMessageInfo.toObject(message.statusV3Messages[j], options); + } + if (message.chunkOrder != null && message.hasOwnProperty("chunkOrder")) + object.chunkOrder = message.chunkOrder; + if (message.progress != null && message.hasOwnProperty("progress")) + object.progress = message.progress; + if (message.pushnames && message.pushnames.length) { + object.pushnames = []; + for (var j = 0; j < message.pushnames.length; ++j) + object.pushnames[j] = $root.proto.Pushname.toObject(message.pushnames[j], options); + } + if (message.globalSettings != null && message.hasOwnProperty("globalSettings")) + object.globalSettings = $root.proto.GlobalSettings.toObject(message.globalSettings, options); + if (message.threadIdUserSecret != null && message.hasOwnProperty("threadIdUserSecret")) + object.threadIdUserSecret = options.bytes === String ? $util.base64.encode(message.threadIdUserSecret, 0, message.threadIdUserSecret.length) : options.bytes === Array ? Array.prototype.slice.call(message.threadIdUserSecret) : message.threadIdUserSecret; + if (message.threadDsTimeframeOffset != null && message.hasOwnProperty("threadDsTimeframeOffset")) + object.threadDsTimeframeOffset = message.threadDsTimeframeOffset; + if (message.recentStickers && message.recentStickers.length) { + object.recentStickers = []; + for (var j = 0; j < message.recentStickers.length; ++j) + object.recentStickers[j] = $root.proto.StickerMetadata.toObject(message.recentStickers[j], options); + } + if (message.pastParticipants && message.pastParticipants.length) { + object.pastParticipants = []; + for (var j = 0; j < message.pastParticipants.length; ++j) + object.pastParticipants[j] = $root.proto.PastParticipants.toObject(message.pastParticipants[j], options); + } + return object; + }; + + /** + * Converts this HistorySync to JSON. + * @function toJSON + * @memberof proto.HistorySync + * @instance + * @returns {Object.} JSON object + */ + HistorySync.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * HistorySyncType enum. + * @name proto.HistorySync.HistorySyncType + * @enum {number} + * @property {number} INITIAL_BOOTSTRAP=0 INITIAL_BOOTSTRAP value + * @property {number} INITIAL_STATUS_V3=1 INITIAL_STATUS_V3 value + * @property {number} FULL=2 FULL value + * @property {number} RECENT=3 RECENT value + * @property {number} PUSH_NAME=4 PUSH_NAME value + * @property {number} NON_BLOCKING_DATA=5 NON_BLOCKING_DATA value + * @property {number} ON_DEMAND=6 ON_DEMAND value + */ + HistorySync.HistorySyncType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INITIAL_BOOTSTRAP"] = 0; + values[valuesById[1] = "INITIAL_STATUS_V3"] = 1; + values[valuesById[2] = "FULL"] = 2; + values[valuesById[3] = "RECENT"] = 3; + values[valuesById[4] = "PUSH_NAME"] = 4; + values[valuesById[5] = "NON_BLOCKING_DATA"] = 5; + values[valuesById[6] = "ON_DEMAND"] = 6; + return values; + })(); + + return HistorySync; + })(); + + proto.HistorySyncMsg = (function() { + + /** + * Properties of a HistorySyncMsg. + * @memberof proto + * @interface IHistorySyncMsg + * @property {proto.IWebMessageInfo|null} [message] HistorySyncMsg message + * @property {number|Long|null} [msgOrderId] HistorySyncMsg msgOrderId + */ + + /** + * Constructs a new HistorySyncMsg. + * @memberof proto + * @classdesc Represents a HistorySyncMsg. + * @implements IHistorySyncMsg + * @constructor + * @param {proto.IHistorySyncMsg=} [properties] Properties to set + */ + function HistorySyncMsg(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HistorySyncMsg message. + * @member {proto.IWebMessageInfo|null|undefined} message + * @memberof proto.HistorySyncMsg + * @instance + */ + HistorySyncMsg.prototype.message = null; + + /** + * HistorySyncMsg msgOrderId. + * @member {number|Long} msgOrderId + * @memberof proto.HistorySyncMsg + * @instance + */ + HistorySyncMsg.prototype.msgOrderId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new HistorySyncMsg instance using the specified properties. + * @function create + * @memberof proto.HistorySyncMsg + * @static + * @param {proto.IHistorySyncMsg=} [properties] Properties to set + * @returns {proto.HistorySyncMsg} HistorySyncMsg instance + */ + HistorySyncMsg.create = function create(properties) { + return new HistorySyncMsg(properties); + }; + + /** + * Encodes the specified HistorySyncMsg message. Does not implicitly {@link proto.HistorySyncMsg.verify|verify} messages. + * @function encode + * @memberof proto.HistorySyncMsg + * @static + * @param {proto.IHistorySyncMsg} message HistorySyncMsg message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncMsg.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.proto.WebMessageInfo.encode(message.message, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.msgOrderId != null && Object.hasOwnProperty.call(message, "msgOrderId")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.msgOrderId); + return writer; + }; + + /** + * Encodes the specified HistorySyncMsg message, length delimited. Does not implicitly {@link proto.HistorySyncMsg.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HistorySyncMsg + * @static + * @param {proto.IHistorySyncMsg} message HistorySyncMsg message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncMsg.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HistorySyncMsg message from the specified reader or buffer. + * @function decode + * @memberof proto.HistorySyncMsg + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HistorySyncMsg} HistorySyncMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncMsg.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HistorySyncMsg(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = $root.proto.WebMessageInfo.decode(reader, reader.uint32()); + break; + case 2: + message.msgOrderId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HistorySyncMsg message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HistorySyncMsg + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HistorySyncMsg} HistorySyncMsg + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncMsg.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HistorySyncMsg message. + * @function verify + * @memberof proto.HistorySyncMsg + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HistorySyncMsg.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.proto.WebMessageInfo.verify(message.message); + if (error) + return "message." + error; + } + if (message.msgOrderId != null && message.hasOwnProperty("msgOrderId")) + if (!$util.isInteger(message.msgOrderId) && !(message.msgOrderId && $util.isInteger(message.msgOrderId.low) && $util.isInteger(message.msgOrderId.high))) + return "msgOrderId: integer|Long expected"; + return null; + }; + + /** + * Creates a HistorySyncMsg message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HistorySyncMsg + * @static + * @param {Object.} object Plain object + * @returns {proto.HistorySyncMsg} HistorySyncMsg + */ + HistorySyncMsg.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HistorySyncMsg) + return object; + var message = new $root.proto.HistorySyncMsg(); + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".proto.HistorySyncMsg.message: object expected"); + message.message = $root.proto.WebMessageInfo.fromObject(object.message); + } + if (object.msgOrderId != null) + if ($util.Long) + (message.msgOrderId = $util.Long.fromValue(object.msgOrderId)).unsigned = true; + else if (typeof object.msgOrderId === "string") + message.msgOrderId = parseInt(object.msgOrderId, 10); + else if (typeof object.msgOrderId === "number") + message.msgOrderId = object.msgOrderId; + else if (typeof object.msgOrderId === "object") + message.msgOrderId = new $util.LongBits(object.msgOrderId.low >>> 0, object.msgOrderId.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a HistorySyncMsg message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HistorySyncMsg + * @static + * @param {proto.HistorySyncMsg} message HistorySyncMsg + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HistorySyncMsg.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.message = null; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.msgOrderId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.msgOrderId = options.longs === String ? "0" : 0; + } + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.proto.WebMessageInfo.toObject(message.message, options); + if (message.msgOrderId != null && message.hasOwnProperty("msgOrderId")) + if (typeof message.msgOrderId === "number") + object.msgOrderId = options.longs === String ? String(message.msgOrderId) : message.msgOrderId; + else + object.msgOrderId = options.longs === String ? $util.Long.prototype.toString.call(message.msgOrderId) : options.longs === Number ? new $util.LongBits(message.msgOrderId.low >>> 0, message.msgOrderId.high >>> 0).toNumber(true) : message.msgOrderId; + return object; + }; + + /** + * Converts this HistorySyncMsg to JSON. + * @function toJSON + * @memberof proto.HistorySyncMsg + * @instance + * @returns {Object.} JSON object + */ + HistorySyncMsg.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HistorySyncMsg; + })(); + + proto.HydratedTemplateButton = (function() { + + /** + * Properties of a HydratedTemplateButton. + * @memberof proto + * @interface IHydratedTemplateButton + * @property {number|null} [index] HydratedTemplateButton index + * @property {proto.HydratedTemplateButton.IHydratedQuickReplyButton|null} [quickReplyButton] HydratedTemplateButton quickReplyButton + * @property {proto.HydratedTemplateButton.IHydratedURLButton|null} [urlButton] HydratedTemplateButton urlButton + * @property {proto.HydratedTemplateButton.IHydratedCallButton|null} [callButton] HydratedTemplateButton callButton + */ + + /** + * Constructs a new HydratedTemplateButton. + * @memberof proto + * @classdesc Represents a HydratedTemplateButton. + * @implements IHydratedTemplateButton + * @constructor + * @param {proto.IHydratedTemplateButton=} [properties] Properties to set + */ + function HydratedTemplateButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HydratedTemplateButton index. + * @member {number} index + * @memberof proto.HydratedTemplateButton + * @instance + */ + HydratedTemplateButton.prototype.index = 0; + + /** + * HydratedTemplateButton quickReplyButton. + * @member {proto.HydratedTemplateButton.IHydratedQuickReplyButton|null|undefined} quickReplyButton + * @memberof proto.HydratedTemplateButton + * @instance + */ + HydratedTemplateButton.prototype.quickReplyButton = null; + + /** + * HydratedTemplateButton urlButton. + * @member {proto.HydratedTemplateButton.IHydratedURLButton|null|undefined} urlButton + * @memberof proto.HydratedTemplateButton + * @instance + */ + HydratedTemplateButton.prototype.urlButton = null; + + /** + * HydratedTemplateButton callButton. + * @member {proto.HydratedTemplateButton.IHydratedCallButton|null|undefined} callButton + * @memberof proto.HydratedTemplateButton + * @instance + */ + HydratedTemplateButton.prototype.callButton = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HydratedTemplateButton hydratedButton. + * @member {"quickReplyButton"|"urlButton"|"callButton"|undefined} hydratedButton + * @memberof proto.HydratedTemplateButton + * @instance + */ + Object.defineProperty(HydratedTemplateButton.prototype, "hydratedButton", { + get: $util.oneOfGetter($oneOfFields = ["quickReplyButton", "urlButton", "callButton"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HydratedTemplateButton instance using the specified properties. + * @function create + * @memberof proto.HydratedTemplateButton + * @static + * @param {proto.IHydratedTemplateButton=} [properties] Properties to set + * @returns {proto.HydratedTemplateButton} HydratedTemplateButton instance + */ + HydratedTemplateButton.create = function create(properties) { + return new HydratedTemplateButton(properties); + }; + + /** + * Encodes the specified HydratedTemplateButton message. Does not implicitly {@link proto.HydratedTemplateButton.verify|verify} messages. + * @function encode + * @memberof proto.HydratedTemplateButton + * @static + * @param {proto.IHydratedTemplateButton} message HydratedTemplateButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedTemplateButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.quickReplyButton != null && Object.hasOwnProperty.call(message, "quickReplyButton")) + $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.encode(message.quickReplyButton, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.urlButton != null && Object.hasOwnProperty.call(message, "urlButton")) + $root.proto.HydratedTemplateButton.HydratedURLButton.encode(message.urlButton, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.callButton != null && Object.hasOwnProperty.call(message, "callButton")) + $root.proto.HydratedTemplateButton.HydratedCallButton.encode(message.callButton, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.index); + return writer; + }; + + /** + * Encodes the specified HydratedTemplateButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HydratedTemplateButton + * @static + * @param {proto.IHydratedTemplateButton} message HydratedTemplateButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedTemplateButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HydratedTemplateButton message from the specified reader or buffer. + * @function decode + * @memberof proto.HydratedTemplateButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HydratedTemplateButton} HydratedTemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedTemplateButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HydratedTemplateButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.index = reader.uint32(); + break; + case 1: + message.quickReplyButton = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.decode(reader, reader.uint32()); + break; + case 2: + message.urlButton = $root.proto.HydratedTemplateButton.HydratedURLButton.decode(reader, reader.uint32()); + break; + case 3: + message.callButton = $root.proto.HydratedTemplateButton.HydratedCallButton.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HydratedTemplateButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HydratedTemplateButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HydratedTemplateButton} HydratedTemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedTemplateButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HydratedTemplateButton message. + * @function verify + * @memberof proto.HydratedTemplateButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HydratedTemplateButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.quickReplyButton != null && message.hasOwnProperty("quickReplyButton")) { + properties.hydratedButton = 1; + { + var error = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.verify(message.quickReplyButton); + if (error) + return "quickReplyButton." + error; + } + } + if (message.urlButton != null && message.hasOwnProperty("urlButton")) { + if (properties.hydratedButton === 1) + return "hydratedButton: multiple values"; + properties.hydratedButton = 1; + { + var error = $root.proto.HydratedTemplateButton.HydratedURLButton.verify(message.urlButton); + if (error) + return "urlButton." + error; + } + } + if (message.callButton != null && message.hasOwnProperty("callButton")) { + if (properties.hydratedButton === 1) + return "hydratedButton: multiple values"; + properties.hydratedButton = 1; + { + var error = $root.proto.HydratedTemplateButton.HydratedCallButton.verify(message.callButton); + if (error) + return "callButton." + error; + } + } + return null; + }; + + /** + * Creates a HydratedTemplateButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HydratedTemplateButton + * @static + * @param {Object.} object Plain object + * @returns {proto.HydratedTemplateButton} HydratedTemplateButton + */ + HydratedTemplateButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HydratedTemplateButton) + return object; + var message = new $root.proto.HydratedTemplateButton(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.quickReplyButton != null) { + if (typeof object.quickReplyButton !== "object") + throw TypeError(".proto.HydratedTemplateButton.quickReplyButton: object expected"); + message.quickReplyButton = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.fromObject(object.quickReplyButton); + } + if (object.urlButton != null) { + if (typeof object.urlButton !== "object") + throw TypeError(".proto.HydratedTemplateButton.urlButton: object expected"); + message.urlButton = $root.proto.HydratedTemplateButton.HydratedURLButton.fromObject(object.urlButton); + } + if (object.callButton != null) { + if (typeof object.callButton !== "object") + throw TypeError(".proto.HydratedTemplateButton.callButton: object expected"); + message.callButton = $root.proto.HydratedTemplateButton.HydratedCallButton.fromObject(object.callButton); + } + return message; + }; + + /** + * Creates a plain object from a HydratedTemplateButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HydratedTemplateButton + * @static + * @param {proto.HydratedTemplateButton} message HydratedTemplateButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HydratedTemplateButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.index = 0; + if (message.quickReplyButton != null && message.hasOwnProperty("quickReplyButton")) { + object.quickReplyButton = $root.proto.HydratedTemplateButton.HydratedQuickReplyButton.toObject(message.quickReplyButton, options); + if (options.oneofs) + object.hydratedButton = "quickReplyButton"; + } + if (message.urlButton != null && message.hasOwnProperty("urlButton")) { + object.urlButton = $root.proto.HydratedTemplateButton.HydratedURLButton.toObject(message.urlButton, options); + if (options.oneofs) + object.hydratedButton = "urlButton"; + } + if (message.callButton != null && message.hasOwnProperty("callButton")) { + object.callButton = $root.proto.HydratedTemplateButton.HydratedCallButton.toObject(message.callButton, options); + if (options.oneofs) + object.hydratedButton = "callButton"; + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + return object; + }; + + /** + * Converts this HydratedTemplateButton to JSON. + * @function toJSON + * @memberof proto.HydratedTemplateButton + * @instance + * @returns {Object.} JSON object + */ + HydratedTemplateButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + HydratedTemplateButton.HydratedCallButton = (function() { + + /** + * Properties of a HydratedCallButton. + * @memberof proto.HydratedTemplateButton + * @interface IHydratedCallButton + * @property {string|null} [displayText] HydratedCallButton displayText + * @property {string|null} [phoneNumber] HydratedCallButton phoneNumber + */ + + /** + * Constructs a new HydratedCallButton. + * @memberof proto.HydratedTemplateButton + * @classdesc Represents a HydratedCallButton. + * @implements IHydratedCallButton + * @constructor + * @param {proto.HydratedTemplateButton.IHydratedCallButton=} [properties] Properties to set + */ + function HydratedCallButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HydratedCallButton displayText. + * @member {string} displayText + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @instance + */ + HydratedCallButton.prototype.displayText = ""; + + /** + * HydratedCallButton phoneNumber. + * @member {string} phoneNumber + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @instance + */ + HydratedCallButton.prototype.phoneNumber = ""; + + /** + * Creates a new HydratedCallButton instance using the specified properties. + * @function create + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedCallButton=} [properties] Properties to set + * @returns {proto.HydratedTemplateButton.HydratedCallButton} HydratedCallButton instance + */ + HydratedCallButton.create = function create(properties) { + return new HydratedCallButton(properties); + }; + + /** + * Encodes the specified HydratedCallButton message. Does not implicitly {@link proto.HydratedTemplateButton.HydratedCallButton.verify|verify} messages. + * @function encode + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedCallButton} message HydratedCallButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedCallButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayText); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.phoneNumber); + return writer; + }; + + /** + * Encodes the specified HydratedCallButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.HydratedCallButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedCallButton} message HydratedCallButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedCallButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HydratedCallButton message from the specified reader or buffer. + * @function decode + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HydratedTemplateButton.HydratedCallButton} HydratedCallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedCallButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HydratedTemplateButton.HydratedCallButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = reader.string(); + break; + case 2: + message.phoneNumber = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HydratedCallButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HydratedTemplateButton.HydratedCallButton} HydratedCallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedCallButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HydratedCallButton message. + * @function verify + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HydratedCallButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) + if (!$util.isString(message.displayText)) + return "displayText: string expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + return null; + }; + + /** + * Creates a HydratedCallButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {Object.} object Plain object + * @returns {proto.HydratedTemplateButton.HydratedCallButton} HydratedCallButton + */ + HydratedCallButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HydratedTemplateButton.HydratedCallButton) + return object; + var message = new $root.proto.HydratedTemplateButton.HydratedCallButton(); + if (object.displayText != null) + message.displayText = String(object.displayText); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + return message; + }; + + /** + * Creates a plain object from a HydratedCallButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @static + * @param {proto.HydratedTemplateButton.HydratedCallButton} message HydratedCallButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HydratedCallButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayText = ""; + object.phoneNumber = ""; + } + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = message.displayText; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = message.phoneNumber; + return object; + }; + + /** + * Converts this HydratedCallButton to JSON. + * @function toJSON + * @memberof proto.HydratedTemplateButton.HydratedCallButton + * @instance + * @returns {Object.} JSON object + */ + HydratedCallButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HydratedCallButton; + })(); + + HydratedTemplateButton.HydratedQuickReplyButton = (function() { + + /** + * Properties of a HydratedQuickReplyButton. + * @memberof proto.HydratedTemplateButton + * @interface IHydratedQuickReplyButton + * @property {string|null} [displayText] HydratedQuickReplyButton displayText + * @property {string|null} [id] HydratedQuickReplyButton id + */ + + /** + * Constructs a new HydratedQuickReplyButton. + * @memberof proto.HydratedTemplateButton + * @classdesc Represents a HydratedQuickReplyButton. + * @implements IHydratedQuickReplyButton + * @constructor + * @param {proto.HydratedTemplateButton.IHydratedQuickReplyButton=} [properties] Properties to set + */ + function HydratedQuickReplyButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HydratedQuickReplyButton displayText. + * @member {string} displayText + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @instance + */ + HydratedQuickReplyButton.prototype.displayText = ""; + + /** + * HydratedQuickReplyButton id. + * @member {string} id + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @instance + */ + HydratedQuickReplyButton.prototype.id = ""; + + /** + * Creates a new HydratedQuickReplyButton instance using the specified properties. + * @function create + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedQuickReplyButton=} [properties] Properties to set + * @returns {proto.HydratedTemplateButton.HydratedQuickReplyButton} HydratedQuickReplyButton instance + */ + HydratedQuickReplyButton.create = function create(properties) { + return new HydratedQuickReplyButton(properties); + }; + + /** + * Encodes the specified HydratedQuickReplyButton message. Does not implicitly {@link proto.HydratedTemplateButton.HydratedQuickReplyButton.verify|verify} messages. + * @function encode + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedQuickReplyButton} message HydratedQuickReplyButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedQuickReplyButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayText); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + return writer; + }; + + /** + * Encodes the specified HydratedQuickReplyButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.HydratedQuickReplyButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedQuickReplyButton} message HydratedQuickReplyButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedQuickReplyButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HydratedQuickReplyButton message from the specified reader or buffer. + * @function decode + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HydratedTemplateButton.HydratedQuickReplyButton} HydratedQuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedQuickReplyButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HydratedTemplateButton.HydratedQuickReplyButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HydratedQuickReplyButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HydratedTemplateButton.HydratedQuickReplyButton} HydratedQuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedQuickReplyButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HydratedQuickReplyButton message. + * @function verify + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HydratedQuickReplyButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) + if (!$util.isString(message.displayText)) + return "displayText: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + return null; + }; + + /** + * Creates a HydratedQuickReplyButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {Object.} object Plain object + * @returns {proto.HydratedTemplateButton.HydratedQuickReplyButton} HydratedQuickReplyButton + */ + HydratedQuickReplyButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HydratedTemplateButton.HydratedQuickReplyButton) + return object; + var message = new $root.proto.HydratedTemplateButton.HydratedQuickReplyButton(); + if (object.displayText != null) + message.displayText = String(object.displayText); + if (object.id != null) + message.id = String(object.id); + return message; + }; + + /** + * Creates a plain object from a HydratedQuickReplyButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @static + * @param {proto.HydratedTemplateButton.HydratedQuickReplyButton} message HydratedQuickReplyButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HydratedQuickReplyButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayText = ""; + object.id = ""; + } + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = message.displayText; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + return object; + }; + + /** + * Converts this HydratedQuickReplyButton to JSON. + * @function toJSON + * @memberof proto.HydratedTemplateButton.HydratedQuickReplyButton + * @instance + * @returns {Object.} JSON object + */ + HydratedQuickReplyButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HydratedQuickReplyButton; + })(); + + HydratedTemplateButton.HydratedURLButton = (function() { + + /** + * Properties of a HydratedURLButton. + * @memberof proto.HydratedTemplateButton + * @interface IHydratedURLButton + * @property {string|null} [displayText] HydratedURLButton displayText + * @property {string|null} [url] HydratedURLButton url + */ + + /** + * Constructs a new HydratedURLButton. + * @memberof proto.HydratedTemplateButton + * @classdesc Represents a HydratedURLButton. + * @implements IHydratedURLButton + * @constructor + * @param {proto.HydratedTemplateButton.IHydratedURLButton=} [properties] Properties to set + */ + function HydratedURLButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HydratedURLButton displayText. + * @member {string} displayText + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @instance + */ + HydratedURLButton.prototype.displayText = ""; + + /** + * HydratedURLButton url. + * @member {string} url + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @instance + */ + HydratedURLButton.prototype.url = ""; + + /** + * Creates a new HydratedURLButton instance using the specified properties. + * @function create + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedURLButton=} [properties] Properties to set + * @returns {proto.HydratedTemplateButton.HydratedURLButton} HydratedURLButton instance + */ + HydratedURLButton.create = function create(properties) { + return new HydratedURLButton(properties); + }; + + /** + * Encodes the specified HydratedURLButton message. Does not implicitly {@link proto.HydratedTemplateButton.HydratedURLButton.verify|verify} messages. + * @function encode + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedURLButton} message HydratedURLButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedURLButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayText); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.url); + return writer; + }; + + /** + * Encodes the specified HydratedURLButton message, length delimited. Does not implicitly {@link proto.HydratedTemplateButton.HydratedURLButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {proto.HydratedTemplateButton.IHydratedURLButton} message HydratedURLButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedURLButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HydratedURLButton message from the specified reader or buffer. + * @function decode + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.HydratedTemplateButton.HydratedURLButton} HydratedURLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedURLButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.HydratedTemplateButton.HydratedURLButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = reader.string(); + break; + case 2: + message.url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HydratedURLButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.HydratedTemplateButton.HydratedURLButton} HydratedURLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedURLButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HydratedURLButton message. + * @function verify + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HydratedURLButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) + if (!$util.isString(message.displayText)) + return "displayText: string expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + return null; + }; + + /** + * Creates a HydratedURLButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {Object.} object Plain object + * @returns {proto.HydratedTemplateButton.HydratedURLButton} HydratedURLButton + */ + HydratedURLButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.HydratedTemplateButton.HydratedURLButton) + return object; + var message = new $root.proto.HydratedTemplateButton.HydratedURLButton(); + if (object.displayText != null) + message.displayText = String(object.displayText); + if (object.url != null) + message.url = String(object.url); + return message; + }; + + /** + * Creates a plain object from a HydratedURLButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @static + * @param {proto.HydratedTemplateButton.HydratedURLButton} message HydratedURLButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HydratedURLButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayText = ""; + object.url = ""; + } + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = message.displayText; + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + return object; + }; + + /** + * Converts this HydratedURLButton to JSON. + * @function toJSON + * @memberof proto.HydratedTemplateButton.HydratedURLButton + * @instance + * @returns {Object.} JSON object + */ + HydratedURLButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HydratedURLButton; + })(); + + return HydratedTemplateButton; + })(); + + proto.IdentityKeyPairStructure = (function() { + + /** + * Properties of an IdentityKeyPairStructure. + * @memberof proto + * @interface IIdentityKeyPairStructure + * @property {Uint8Array|null} [publicKey] IdentityKeyPairStructure publicKey + * @property {Uint8Array|null} [privateKey] IdentityKeyPairStructure privateKey + */ + + /** + * Constructs a new IdentityKeyPairStructure. + * @memberof proto + * @classdesc Represents an IdentityKeyPairStructure. + * @implements IIdentityKeyPairStructure + * @constructor + * @param {proto.IIdentityKeyPairStructure=} [properties] Properties to set + */ + function IdentityKeyPairStructure(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IdentityKeyPairStructure publicKey. + * @member {Uint8Array} publicKey + * @memberof proto.IdentityKeyPairStructure + * @instance + */ + IdentityKeyPairStructure.prototype.publicKey = $util.newBuffer([]); + + /** + * IdentityKeyPairStructure privateKey. + * @member {Uint8Array} privateKey + * @memberof proto.IdentityKeyPairStructure + * @instance + */ + IdentityKeyPairStructure.prototype.privateKey = $util.newBuffer([]); + + /** + * Creates a new IdentityKeyPairStructure instance using the specified properties. + * @function create + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {proto.IIdentityKeyPairStructure=} [properties] Properties to set + * @returns {proto.IdentityKeyPairStructure} IdentityKeyPairStructure instance + */ + IdentityKeyPairStructure.create = function create(properties) { + return new IdentityKeyPairStructure(properties); + }; + + /** + * Encodes the specified IdentityKeyPairStructure message. Does not implicitly {@link proto.IdentityKeyPairStructure.verify|verify} messages. + * @function encode + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {proto.IIdentityKeyPairStructure} message IdentityKeyPairStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentityKeyPairStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.publicKey); + if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.privateKey); + return writer; + }; + + /** + * Encodes the specified IdentityKeyPairStructure message, length delimited. Does not implicitly {@link proto.IdentityKeyPairStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {proto.IIdentityKeyPairStructure} message IdentityKeyPairStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IdentityKeyPairStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IdentityKeyPairStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.IdentityKeyPairStructure} IdentityKeyPairStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentityKeyPairStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.IdentityKeyPairStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = reader.bytes(); + break; + case 2: + message.privateKey = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IdentityKeyPairStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.IdentityKeyPairStructure} IdentityKeyPairStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IdentityKeyPairStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IdentityKeyPairStructure message. + * @function verify + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IdentityKeyPairStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!(message.publicKey && typeof message.publicKey.length === "number" || $util.isString(message.publicKey))) + return "publicKey: buffer expected"; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey))) + return "privateKey: buffer expected"; + return null; + }; + + /** + * Creates an IdentityKeyPairStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.IdentityKeyPairStructure} IdentityKeyPairStructure + */ + IdentityKeyPairStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.IdentityKeyPairStructure) + return object; + var message = new $root.proto.IdentityKeyPairStructure(); + if (object.publicKey != null) + if (typeof object.publicKey === "string") + $util.base64.decode(object.publicKey, message.publicKey = $util.newBuffer($util.base64.length(object.publicKey)), 0); + else if (object.publicKey.length) + message.publicKey = object.publicKey; + if (object.privateKey != null) + if (typeof object.privateKey === "string") + $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0); + else if (object.privateKey.length) + message.privateKey = object.privateKey; + return message; + }; + + /** + * Creates a plain object from an IdentityKeyPairStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.IdentityKeyPairStructure + * @static + * @param {proto.IdentityKeyPairStructure} message IdentityKeyPairStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IdentityKeyPairStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.publicKey = ""; + else { + object.publicKey = []; + if (options.bytes !== Array) + object.publicKey = $util.newBuffer(object.publicKey); + } + if (options.bytes === String) + object.privateKey = ""; + else { + object.privateKey = []; + if (options.bytes !== Array) + object.privateKey = $util.newBuffer(object.privateKey); + } + } + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = options.bytes === String ? $util.base64.encode(message.publicKey, 0, message.publicKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKey) : message.publicKey; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey; + return object; + }; + + /** + * Converts this IdentityKeyPairStructure to JSON. + * @function toJSON + * @memberof proto.IdentityKeyPairStructure + * @instance + * @returns {Object.} JSON object + */ + IdentityKeyPairStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return IdentityKeyPairStructure; + })(); + + proto.InteractiveAnnotation = (function() { + + /** + * Properties of an InteractiveAnnotation. + * @memberof proto + * @interface IInteractiveAnnotation + * @property {Array.|null} [polygonVertices] InteractiveAnnotation polygonVertices + * @property {proto.ILocation|null} [location] InteractiveAnnotation location + */ + + /** + * Constructs a new InteractiveAnnotation. + * @memberof proto + * @classdesc Represents an InteractiveAnnotation. + * @implements IInteractiveAnnotation + * @constructor + * @param {proto.IInteractiveAnnotation=} [properties] Properties to set + */ + function InteractiveAnnotation(properties) { + this.polygonVertices = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InteractiveAnnotation polygonVertices. + * @member {Array.} polygonVertices + * @memberof proto.InteractiveAnnotation + * @instance + */ + InteractiveAnnotation.prototype.polygonVertices = $util.emptyArray; + + /** + * InteractiveAnnotation location. + * @member {proto.ILocation|null|undefined} location + * @memberof proto.InteractiveAnnotation + * @instance + */ + InteractiveAnnotation.prototype.location = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InteractiveAnnotation action. + * @member {"location"|undefined} action + * @memberof proto.InteractiveAnnotation + * @instance + */ + Object.defineProperty(InteractiveAnnotation.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["location"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InteractiveAnnotation instance using the specified properties. + * @function create + * @memberof proto.InteractiveAnnotation + * @static + * @param {proto.IInteractiveAnnotation=} [properties] Properties to set + * @returns {proto.InteractiveAnnotation} InteractiveAnnotation instance + */ + InteractiveAnnotation.create = function create(properties) { + return new InteractiveAnnotation(properties); + }; + + /** + * Encodes the specified InteractiveAnnotation message. Does not implicitly {@link proto.InteractiveAnnotation.verify|verify} messages. + * @function encode + * @memberof proto.InteractiveAnnotation + * @static + * @param {proto.IInteractiveAnnotation} message InteractiveAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InteractiveAnnotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.polygonVertices != null && message.polygonVertices.length) + for (var i = 0; i < message.polygonVertices.length; ++i) + $root.proto.Point.encode(message.polygonVertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + $root.proto.Location.encode(message.location, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InteractiveAnnotation message, length delimited. Does not implicitly {@link proto.InteractiveAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.InteractiveAnnotation + * @static + * @param {proto.IInteractiveAnnotation} message InteractiveAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InteractiveAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InteractiveAnnotation message from the specified reader or buffer. + * @function decode + * @memberof proto.InteractiveAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.InteractiveAnnotation} InteractiveAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InteractiveAnnotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.InteractiveAnnotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.polygonVertices && message.polygonVertices.length)) + message.polygonVertices = []; + message.polygonVertices.push($root.proto.Point.decode(reader, reader.uint32())); + break; + case 2: + message.location = $root.proto.Location.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InteractiveAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.InteractiveAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.InteractiveAnnotation} InteractiveAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InteractiveAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InteractiveAnnotation message. + * @function verify + * @memberof proto.InteractiveAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InteractiveAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.polygonVertices != null && message.hasOwnProperty("polygonVertices")) { + if (!Array.isArray(message.polygonVertices)) + return "polygonVertices: array expected"; + for (var i = 0; i < message.polygonVertices.length; ++i) { + var error = $root.proto.Point.verify(message.polygonVertices[i]); + if (error) + return "polygonVertices." + error; + } + } + if (message.location != null && message.hasOwnProperty("location")) { + properties.action = 1; + { + var error = $root.proto.Location.verify(message.location); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates an InteractiveAnnotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.InteractiveAnnotation + * @static + * @param {Object.} object Plain object + * @returns {proto.InteractiveAnnotation} InteractiveAnnotation + */ + InteractiveAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.proto.InteractiveAnnotation) + return object; + var message = new $root.proto.InteractiveAnnotation(); + if (object.polygonVertices) { + if (!Array.isArray(object.polygonVertices)) + throw TypeError(".proto.InteractiveAnnotation.polygonVertices: array expected"); + message.polygonVertices = []; + for (var i = 0; i < object.polygonVertices.length; ++i) { + if (typeof object.polygonVertices[i] !== "object") + throw TypeError(".proto.InteractiveAnnotation.polygonVertices: object expected"); + message.polygonVertices[i] = $root.proto.Point.fromObject(object.polygonVertices[i]); + } + } + if (object.location != null) { + if (typeof object.location !== "object") + throw TypeError(".proto.InteractiveAnnotation.location: object expected"); + message.location = $root.proto.Location.fromObject(object.location); + } + return message; + }; + + /** + * Creates a plain object from an InteractiveAnnotation message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.InteractiveAnnotation + * @static + * @param {proto.InteractiveAnnotation} message InteractiveAnnotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InteractiveAnnotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.polygonVertices = []; + if (message.polygonVertices && message.polygonVertices.length) { + object.polygonVertices = []; + for (var j = 0; j < message.polygonVertices.length; ++j) + object.polygonVertices[j] = $root.proto.Point.toObject(message.polygonVertices[j], options); + } + if (message.location != null && message.hasOwnProperty("location")) { + object.location = $root.proto.Location.toObject(message.location, options); + if (options.oneofs) + object.action = "location"; + } + return object; + }; + + /** + * Converts this InteractiveAnnotation to JSON. + * @function toJSON + * @memberof proto.InteractiveAnnotation + * @instance + * @returns {Object.} JSON object + */ + InteractiveAnnotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InteractiveAnnotation; + })(); + + proto.KeepInChat = (function() { + + /** + * Properties of a KeepInChat. + * @memberof proto + * @interface IKeepInChat + * @property {proto.KeepType|null} [keepType] KeepInChat keepType + * @property {number|Long|null} [serverTimestamp] KeepInChat serverTimestamp + * @property {proto.IMessageKey|null} [key] KeepInChat key + * @property {string|null} [deviceJid] KeepInChat deviceJid + * @property {number|Long|null} [clientTimestampMs] KeepInChat clientTimestampMs + * @property {number|Long|null} [serverTimestampMs] KeepInChat serverTimestampMs + */ + + /** + * Constructs a new KeepInChat. + * @memberof proto + * @classdesc Represents a KeepInChat. + * @implements IKeepInChat + * @constructor + * @param {proto.IKeepInChat=} [properties] Properties to set + */ + function KeepInChat(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeepInChat keepType. + * @member {proto.KeepType} keepType + * @memberof proto.KeepInChat + * @instance + */ + KeepInChat.prototype.keepType = 0; + + /** + * KeepInChat serverTimestamp. + * @member {number|Long} serverTimestamp + * @memberof proto.KeepInChat + * @instance + */ + KeepInChat.prototype.serverTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * KeepInChat key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.KeepInChat + * @instance + */ + KeepInChat.prototype.key = null; + + /** + * KeepInChat deviceJid. + * @member {string} deviceJid + * @memberof proto.KeepInChat + * @instance + */ + KeepInChat.prototype.deviceJid = ""; + + /** + * KeepInChat clientTimestampMs. + * @member {number|Long} clientTimestampMs + * @memberof proto.KeepInChat + * @instance + */ + KeepInChat.prototype.clientTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * KeepInChat serverTimestampMs. + * @member {number|Long} serverTimestampMs + * @memberof proto.KeepInChat + * @instance + */ + KeepInChat.prototype.serverTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new KeepInChat instance using the specified properties. + * @function create + * @memberof proto.KeepInChat + * @static + * @param {proto.IKeepInChat=} [properties] Properties to set + * @returns {proto.KeepInChat} KeepInChat instance + */ + KeepInChat.create = function create(properties) { + return new KeepInChat(properties); + }; + + /** + * Encodes the specified KeepInChat message. Does not implicitly {@link proto.KeepInChat.verify|verify} messages. + * @function encode + * @memberof proto.KeepInChat + * @static + * @param {proto.IKeepInChat} message KeepInChat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeepInChat.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keepType != null && Object.hasOwnProperty.call(message, "keepType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.keepType); + if (message.serverTimestamp != null && Object.hasOwnProperty.call(message, "serverTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.serverTimestamp); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.deviceJid != null && Object.hasOwnProperty.call(message, "deviceJid")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.deviceJid); + if (message.clientTimestampMs != null && Object.hasOwnProperty.call(message, "clientTimestampMs")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.clientTimestampMs); + if (message.serverTimestampMs != null && Object.hasOwnProperty.call(message, "serverTimestampMs")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.serverTimestampMs); + return writer; + }; + + /** + * Encodes the specified KeepInChat message, length delimited. Does not implicitly {@link proto.KeepInChat.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.KeepInChat + * @static + * @param {proto.IKeepInChat} message KeepInChat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeepInChat.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeepInChat message from the specified reader or buffer. + * @function decode + * @memberof proto.KeepInChat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.KeepInChat} KeepInChat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeepInChat.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.KeepInChat(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keepType = reader.int32(); + break; + case 2: + message.serverTimestamp = reader.int64(); + break; + case 3: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 4: + message.deviceJid = reader.string(); + break; + case 5: + message.clientTimestampMs = reader.int64(); + break; + case 6: + message.serverTimestampMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeepInChat message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.KeepInChat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.KeepInChat} KeepInChat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeepInChat.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeepInChat message. + * @function verify + * @memberof proto.KeepInChat + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeepInChat.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keepType != null && message.hasOwnProperty("keepType")) + switch (message.keepType) { + default: + return "keepType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.serverTimestamp != null && message.hasOwnProperty("serverTimestamp")) + if (!$util.isInteger(message.serverTimestamp) && !(message.serverTimestamp && $util.isInteger(message.serverTimestamp.low) && $util.isInteger(message.serverTimestamp.high))) + return "serverTimestamp: integer|Long expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.deviceJid != null && message.hasOwnProperty("deviceJid")) + if (!$util.isString(message.deviceJid)) + return "deviceJid: string expected"; + if (message.clientTimestampMs != null && message.hasOwnProperty("clientTimestampMs")) + if (!$util.isInteger(message.clientTimestampMs) && !(message.clientTimestampMs && $util.isInteger(message.clientTimestampMs.low) && $util.isInteger(message.clientTimestampMs.high))) + return "clientTimestampMs: integer|Long expected"; + if (message.serverTimestampMs != null && message.hasOwnProperty("serverTimestampMs")) + if (!$util.isInteger(message.serverTimestampMs) && !(message.serverTimestampMs && $util.isInteger(message.serverTimestampMs.low) && $util.isInteger(message.serverTimestampMs.high))) + return "serverTimestampMs: integer|Long expected"; + return null; + }; + + /** + * Creates a KeepInChat message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.KeepInChat + * @static + * @param {Object.} object Plain object + * @returns {proto.KeepInChat} KeepInChat + */ + KeepInChat.fromObject = function fromObject(object) { + if (object instanceof $root.proto.KeepInChat) + return object; + var message = new $root.proto.KeepInChat(); + switch (object.keepType) { + case "UNKNOWN": + case 0: + message.keepType = 0; + break; + case "KEEP_FOR_ALL": + case 1: + message.keepType = 1; + break; + case "UNDO_KEEP_FOR_ALL": + case 2: + message.keepType = 2; + break; + } + if (object.serverTimestamp != null) + if ($util.Long) + (message.serverTimestamp = $util.Long.fromValue(object.serverTimestamp)).unsigned = false; + else if (typeof object.serverTimestamp === "string") + message.serverTimestamp = parseInt(object.serverTimestamp, 10); + else if (typeof object.serverTimestamp === "number") + message.serverTimestamp = object.serverTimestamp; + else if (typeof object.serverTimestamp === "object") + message.serverTimestamp = new $util.LongBits(object.serverTimestamp.low >>> 0, object.serverTimestamp.high >>> 0).toNumber(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.KeepInChat.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + if (object.deviceJid != null) + message.deviceJid = String(object.deviceJid); + if (object.clientTimestampMs != null) + if ($util.Long) + (message.clientTimestampMs = $util.Long.fromValue(object.clientTimestampMs)).unsigned = false; + else if (typeof object.clientTimestampMs === "string") + message.clientTimestampMs = parseInt(object.clientTimestampMs, 10); + else if (typeof object.clientTimestampMs === "number") + message.clientTimestampMs = object.clientTimestampMs; + else if (typeof object.clientTimestampMs === "object") + message.clientTimestampMs = new $util.LongBits(object.clientTimestampMs.low >>> 0, object.clientTimestampMs.high >>> 0).toNumber(); + if (object.serverTimestampMs != null) + if ($util.Long) + (message.serverTimestampMs = $util.Long.fromValue(object.serverTimestampMs)).unsigned = false; + else if (typeof object.serverTimestampMs === "string") + message.serverTimestampMs = parseInt(object.serverTimestampMs, 10); + else if (typeof object.serverTimestampMs === "number") + message.serverTimestampMs = object.serverTimestampMs; + else if (typeof object.serverTimestampMs === "object") + message.serverTimestampMs = new $util.LongBits(object.serverTimestampMs.low >>> 0, object.serverTimestampMs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a KeepInChat message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.KeepInChat + * @static + * @param {proto.KeepInChat} message KeepInChat + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeepInChat.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.keepType = options.enums === String ? "UNKNOWN" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.serverTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.serverTimestamp = options.longs === String ? "0" : 0; + object.key = null; + object.deviceJid = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.clientTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.clientTimestampMs = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.serverTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.serverTimestampMs = options.longs === String ? "0" : 0; + } + if (message.keepType != null && message.hasOwnProperty("keepType")) + object.keepType = options.enums === String ? $root.proto.KeepType[message.keepType] : message.keepType; + if (message.serverTimestamp != null && message.hasOwnProperty("serverTimestamp")) + if (typeof message.serverTimestamp === "number") + object.serverTimestamp = options.longs === String ? String(message.serverTimestamp) : message.serverTimestamp; + else + object.serverTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.serverTimestamp) : options.longs === Number ? new $util.LongBits(message.serverTimestamp.low >>> 0, message.serverTimestamp.high >>> 0).toNumber() : message.serverTimestamp; + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.deviceJid != null && message.hasOwnProperty("deviceJid")) + object.deviceJid = message.deviceJid; + if (message.clientTimestampMs != null && message.hasOwnProperty("clientTimestampMs")) + if (typeof message.clientTimestampMs === "number") + object.clientTimestampMs = options.longs === String ? String(message.clientTimestampMs) : message.clientTimestampMs; + else + object.clientTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.clientTimestampMs) : options.longs === Number ? new $util.LongBits(message.clientTimestampMs.low >>> 0, message.clientTimestampMs.high >>> 0).toNumber() : message.clientTimestampMs; + if (message.serverTimestampMs != null && message.hasOwnProperty("serverTimestampMs")) + if (typeof message.serverTimestampMs === "number") + object.serverTimestampMs = options.longs === String ? String(message.serverTimestampMs) : message.serverTimestampMs; + else + object.serverTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.serverTimestampMs) : options.longs === Number ? new $util.LongBits(message.serverTimestampMs.low >>> 0, message.serverTimestampMs.high >>> 0).toNumber() : message.serverTimestampMs; + return object; + }; + + /** + * Converts this KeepInChat to JSON. + * @function toJSON + * @memberof proto.KeepInChat + * @instance + * @returns {Object.} JSON object + */ + KeepInChat.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeepInChat; + })(); + + /** + * KeepType enum. + * @name proto.KeepType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} KEEP_FOR_ALL=1 KEEP_FOR_ALL value + * @property {number} UNDO_KEEP_FOR_ALL=2 UNDO_KEEP_FOR_ALL value + */ + proto.KeepType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "KEEP_FOR_ALL"] = 1; + values[valuesById[2] = "UNDO_KEEP_FOR_ALL"] = 2; + return values; + })(); + + proto.KeyId = (function() { + + /** + * Properties of a KeyId. + * @memberof proto + * @interface IKeyId + * @property {Uint8Array|null} [id] KeyId id + */ + + /** + * Constructs a new KeyId. + * @memberof proto + * @classdesc Represents a KeyId. + * @implements IKeyId + * @constructor + * @param {proto.IKeyId=} [properties] Properties to set + */ + function KeyId(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyId id. + * @member {Uint8Array} id + * @memberof proto.KeyId + * @instance + */ + KeyId.prototype.id = $util.newBuffer([]); + + /** + * Creates a new KeyId instance using the specified properties. + * @function create + * @memberof proto.KeyId + * @static + * @param {proto.IKeyId=} [properties] Properties to set + * @returns {proto.KeyId} KeyId instance + */ + KeyId.create = function create(properties) { + return new KeyId(properties); + }; + + /** + * Encodes the specified KeyId message. Does not implicitly {@link proto.KeyId.verify|verify} messages. + * @function encode + * @memberof proto.KeyId + * @static + * @param {proto.IKeyId} message KeyId message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyId.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.id); + return writer; + }; + + /** + * Encodes the specified KeyId message, length delimited. Does not implicitly {@link proto.KeyId.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.KeyId + * @static + * @param {proto.IKeyId} message KeyId message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyId.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyId message from the specified reader or buffer. + * @function decode + * @memberof proto.KeyId + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.KeyId} KeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyId.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.KeyId(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyId message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.KeyId + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.KeyId} KeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyId.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyId message. + * @function verify + * @memberof proto.KeyId + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyId.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!(message.id && typeof message.id.length === "number" || $util.isString(message.id))) + return "id: buffer expected"; + return null; + }; + + /** + * Creates a KeyId message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.KeyId + * @static + * @param {Object.} object Plain object + * @returns {proto.KeyId} KeyId + */ + KeyId.fromObject = function fromObject(object) { + if (object instanceof $root.proto.KeyId) + return object; + var message = new $root.proto.KeyId(); + if (object.id != null) + if (typeof object.id === "string") + $util.base64.decode(object.id, message.id = $util.newBuffer($util.base64.length(object.id)), 0); + else if (object.id.length) + message.id = object.id; + return message; + }; + + /** + * Creates a plain object from a KeyId message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.KeyId + * @static + * @param {proto.KeyId} message KeyId + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyId.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.id = ""; + else { + object.id = []; + if (options.bytes !== Array) + object.id = $util.newBuffer(object.id); + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = options.bytes === String ? $util.base64.encode(message.id, 0, message.id.length) : options.bytes === Array ? Array.prototype.slice.call(message.id) : message.id; + return object; + }; + + /** + * Converts this KeyId to JSON. + * @function toJSON + * @memberof proto.KeyId + * @instance + * @returns {Object.} JSON object + */ + KeyId.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeyId; + })(); + + proto.LocalizedName = (function() { + + /** + * Properties of a LocalizedName. + * @memberof proto + * @interface ILocalizedName + * @property {string|null} [lg] LocalizedName lg + * @property {string|null} [lc] LocalizedName lc + * @property {string|null} [verifiedName] LocalizedName verifiedName + */ + + /** + * Constructs a new LocalizedName. + * @memberof proto + * @classdesc Represents a LocalizedName. + * @implements ILocalizedName + * @constructor + * @param {proto.ILocalizedName=} [properties] Properties to set + */ + function LocalizedName(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocalizedName lg. + * @member {string} lg + * @memberof proto.LocalizedName + * @instance + */ + LocalizedName.prototype.lg = ""; + + /** + * LocalizedName lc. + * @member {string} lc + * @memberof proto.LocalizedName + * @instance + */ + LocalizedName.prototype.lc = ""; + + /** + * LocalizedName verifiedName. + * @member {string} verifiedName + * @memberof proto.LocalizedName + * @instance + */ + LocalizedName.prototype.verifiedName = ""; + + /** + * Creates a new LocalizedName instance using the specified properties. + * @function create + * @memberof proto.LocalizedName + * @static + * @param {proto.ILocalizedName=} [properties] Properties to set + * @returns {proto.LocalizedName} LocalizedName instance + */ + LocalizedName.create = function create(properties) { + return new LocalizedName(properties); + }; + + /** + * Encodes the specified LocalizedName message. Does not implicitly {@link proto.LocalizedName.verify|verify} messages. + * @function encode + * @memberof proto.LocalizedName + * @static + * @param {proto.ILocalizedName} message LocalizedName message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocalizedName.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lg != null && Object.hasOwnProperty.call(message, "lg")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.lg); + if (message.lc != null && Object.hasOwnProperty.call(message, "lc")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.lc); + if (message.verifiedName != null && Object.hasOwnProperty.call(message, "verifiedName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.verifiedName); + return writer; + }; + + /** + * Encodes the specified LocalizedName message, length delimited. Does not implicitly {@link proto.LocalizedName.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.LocalizedName + * @static + * @param {proto.ILocalizedName} message LocalizedName message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocalizedName.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocalizedName message from the specified reader or buffer. + * @function decode + * @memberof proto.LocalizedName + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.LocalizedName} LocalizedName + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocalizedName.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.LocalizedName(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lg = reader.string(); + break; + case 2: + message.lc = reader.string(); + break; + case 3: + message.verifiedName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocalizedName message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.LocalizedName + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.LocalizedName} LocalizedName + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocalizedName.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocalizedName message. + * @function verify + * @memberof proto.LocalizedName + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocalizedName.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lg != null && message.hasOwnProperty("lg")) + if (!$util.isString(message.lg)) + return "lg: string expected"; + if (message.lc != null && message.hasOwnProperty("lc")) + if (!$util.isString(message.lc)) + return "lc: string expected"; + if (message.verifiedName != null && message.hasOwnProperty("verifiedName")) + if (!$util.isString(message.verifiedName)) + return "verifiedName: string expected"; + return null; + }; + + /** + * Creates a LocalizedName message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.LocalizedName + * @static + * @param {Object.} object Plain object + * @returns {proto.LocalizedName} LocalizedName + */ + LocalizedName.fromObject = function fromObject(object) { + if (object instanceof $root.proto.LocalizedName) + return object; + var message = new $root.proto.LocalizedName(); + if (object.lg != null) + message.lg = String(object.lg); + if (object.lc != null) + message.lc = String(object.lc); + if (object.verifiedName != null) + message.verifiedName = String(object.verifiedName); + return message; + }; + + /** + * Creates a plain object from a LocalizedName message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.LocalizedName + * @static + * @param {proto.LocalizedName} message LocalizedName + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocalizedName.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.lg = ""; + object.lc = ""; + object.verifiedName = ""; + } + if (message.lg != null && message.hasOwnProperty("lg")) + object.lg = message.lg; + if (message.lc != null && message.hasOwnProperty("lc")) + object.lc = message.lc; + if (message.verifiedName != null && message.hasOwnProperty("verifiedName")) + object.verifiedName = message.verifiedName; + return object; + }; + + /** + * Converts this LocalizedName to JSON. + * @function toJSON + * @memberof proto.LocalizedName + * @instance + * @returns {Object.} JSON object + */ + LocalizedName.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocalizedName; + })(); + + proto.Location = (function() { + + /** + * Properties of a Location. + * @memberof proto + * @interface ILocation + * @property {number|null} [degreesLatitude] Location degreesLatitude + * @property {number|null} [degreesLongitude] Location degreesLongitude + * @property {string|null} [name] Location name + */ + + /** + * Constructs a new Location. + * @memberof proto + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {proto.ILocation=} [properties] Properties to set + */ + function Location(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location degreesLatitude. + * @member {number} degreesLatitude + * @memberof proto.Location + * @instance + */ + Location.prototype.degreesLatitude = 0; + + /** + * Location degreesLongitude. + * @member {number} degreesLongitude + * @memberof proto.Location + * @instance + */ + Location.prototype.degreesLongitude = 0; + + /** + * Location name. + * @member {string} name + * @memberof proto.Location + * @instance + */ + Location.prototype.name = ""; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof proto.Location + * @static + * @param {proto.ILocation=} [properties] Properties to set + * @returns {proto.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link proto.Location.verify|verify} messages. + * @function encode + * @memberof proto.Location + * @static + * @param {proto.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.degreesLatitude != null && Object.hasOwnProperty.call(message, "degreesLatitude")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.degreesLatitude); + if (message.degreesLongitude != null && Object.hasOwnProperty.call(message, "degreesLongitude")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.degreesLongitude); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link proto.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Location + * @static + * @param {proto.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof proto.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.degreesLatitude = reader.double(); + break; + case 2: + message.degreesLongitude = reader.double(); + break; + case 3: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof proto.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.degreesLatitude != null && message.hasOwnProperty("degreesLatitude")) + if (typeof message.degreesLatitude !== "number") + return "degreesLatitude: number expected"; + if (message.degreesLongitude != null && message.hasOwnProperty("degreesLongitude")) + if (typeof message.degreesLongitude !== "number") + return "degreesLongitude: number expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Location + * @static + * @param {Object.} object Plain object + * @returns {proto.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Location) + return object; + var message = new $root.proto.Location(); + if (object.degreesLatitude != null) + message.degreesLatitude = Number(object.degreesLatitude); + if (object.degreesLongitude != null) + message.degreesLongitude = Number(object.degreesLongitude); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Location + * @static + * @param {proto.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.degreesLatitude = 0; + object.degreesLongitude = 0; + object.name = ""; + } + if (message.degreesLatitude != null && message.hasOwnProperty("degreesLatitude")) + object.degreesLatitude = options.json && !isFinite(message.degreesLatitude) ? String(message.degreesLatitude) : message.degreesLatitude; + if (message.degreesLongitude != null && message.hasOwnProperty("degreesLongitude")) + object.degreesLongitude = options.json && !isFinite(message.degreesLongitude) ? String(message.degreesLongitude) : message.degreesLongitude; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof proto.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + proto.MediaData = (function() { + + /** + * Properties of a MediaData. + * @memberof proto + * @interface IMediaData + * @property {string|null} [localPath] MediaData localPath + */ + + /** + * Constructs a new MediaData. + * @memberof proto + * @classdesc Represents a MediaData. + * @implements IMediaData + * @constructor + * @param {proto.IMediaData=} [properties] Properties to set + */ + function MediaData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MediaData localPath. + * @member {string} localPath + * @memberof proto.MediaData + * @instance + */ + MediaData.prototype.localPath = ""; + + /** + * Creates a new MediaData instance using the specified properties. + * @function create + * @memberof proto.MediaData + * @static + * @param {proto.IMediaData=} [properties] Properties to set + * @returns {proto.MediaData} MediaData instance + */ + MediaData.create = function create(properties) { + return new MediaData(properties); + }; + + /** + * Encodes the specified MediaData message. Does not implicitly {@link proto.MediaData.verify|verify} messages. + * @function encode + * @memberof proto.MediaData + * @static + * @param {proto.IMediaData} message MediaData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.localPath != null && Object.hasOwnProperty.call(message, "localPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.localPath); + return writer; + }; + + /** + * Encodes the specified MediaData message, length delimited. Does not implicitly {@link proto.MediaData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MediaData + * @static + * @param {proto.IMediaData} message MediaData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MediaData message from the specified reader or buffer. + * @function decode + * @memberof proto.MediaData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MediaData} MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MediaData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.localPath = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MediaData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MediaData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MediaData} MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MediaData message. + * @function verify + * @memberof proto.MediaData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MediaData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.localPath != null && message.hasOwnProperty("localPath")) + if (!$util.isString(message.localPath)) + return "localPath: string expected"; + return null; + }; + + /** + * Creates a MediaData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MediaData + * @static + * @param {Object.} object Plain object + * @returns {proto.MediaData} MediaData + */ + MediaData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MediaData) + return object; + var message = new $root.proto.MediaData(); + if (object.localPath != null) + message.localPath = String(object.localPath); + return message; + }; + + /** + * Creates a plain object from a MediaData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MediaData + * @static + * @param {proto.MediaData} message MediaData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MediaData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.localPath = ""; + if (message.localPath != null && message.hasOwnProperty("localPath")) + object.localPath = message.localPath; + return object; + }; + + /** + * Converts this MediaData to JSON. + * @function toJSON + * @memberof proto.MediaData + * @instance + * @returns {Object.} JSON object + */ + MediaData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MediaData; + })(); + + proto.MediaRetryNotification = (function() { + + /** + * Properties of a MediaRetryNotification. + * @memberof proto + * @interface IMediaRetryNotification + * @property {string|null} [stanzaId] MediaRetryNotification stanzaId + * @property {string|null} [directPath] MediaRetryNotification directPath + * @property {proto.MediaRetryNotification.ResultType|null} [result] MediaRetryNotification result + */ + + /** + * Constructs a new MediaRetryNotification. + * @memberof proto + * @classdesc Represents a MediaRetryNotification. + * @implements IMediaRetryNotification + * @constructor + * @param {proto.IMediaRetryNotification=} [properties] Properties to set + */ + function MediaRetryNotification(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MediaRetryNotification stanzaId. + * @member {string} stanzaId + * @memberof proto.MediaRetryNotification + * @instance + */ + MediaRetryNotification.prototype.stanzaId = ""; + + /** + * MediaRetryNotification directPath. + * @member {string} directPath + * @memberof proto.MediaRetryNotification + * @instance + */ + MediaRetryNotification.prototype.directPath = ""; + + /** + * MediaRetryNotification result. + * @member {proto.MediaRetryNotification.ResultType} result + * @memberof proto.MediaRetryNotification + * @instance + */ + MediaRetryNotification.prototype.result = 0; + + /** + * Creates a new MediaRetryNotification instance using the specified properties. + * @function create + * @memberof proto.MediaRetryNotification + * @static + * @param {proto.IMediaRetryNotification=} [properties] Properties to set + * @returns {proto.MediaRetryNotification} MediaRetryNotification instance + */ + MediaRetryNotification.create = function create(properties) { + return new MediaRetryNotification(properties); + }; + + /** + * Encodes the specified MediaRetryNotification message. Does not implicitly {@link proto.MediaRetryNotification.verify|verify} messages. + * @function encode + * @memberof proto.MediaRetryNotification + * @static + * @param {proto.IMediaRetryNotification} message MediaRetryNotification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaRetryNotification.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.stanzaId != null && Object.hasOwnProperty.call(message, "stanzaId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.stanzaId); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.directPath); + if (message.result != null && Object.hasOwnProperty.call(message, "result")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.result); + return writer; + }; + + /** + * Encodes the specified MediaRetryNotification message, length delimited. Does not implicitly {@link proto.MediaRetryNotification.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MediaRetryNotification + * @static + * @param {proto.IMediaRetryNotification} message MediaRetryNotification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaRetryNotification.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MediaRetryNotification message from the specified reader or buffer. + * @function decode + * @memberof proto.MediaRetryNotification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MediaRetryNotification} MediaRetryNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaRetryNotification.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MediaRetryNotification(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stanzaId = reader.string(); + break; + case 2: + message.directPath = reader.string(); + break; + case 3: + message.result = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MediaRetryNotification message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MediaRetryNotification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MediaRetryNotification} MediaRetryNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaRetryNotification.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MediaRetryNotification message. + * @function verify + * @memberof proto.MediaRetryNotification + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MediaRetryNotification.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + if (!$util.isString(message.stanzaId)) + return "stanzaId: string expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.result != null && message.hasOwnProperty("result")) + switch (message.result) { + default: + return "result: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a MediaRetryNotification message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MediaRetryNotification + * @static + * @param {Object.} object Plain object + * @returns {proto.MediaRetryNotification} MediaRetryNotification + */ + MediaRetryNotification.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MediaRetryNotification) + return object; + var message = new $root.proto.MediaRetryNotification(); + if (object.stanzaId != null) + message.stanzaId = String(object.stanzaId); + if (object.directPath != null) + message.directPath = String(object.directPath); + switch (object.result) { + case "GENERAL_ERROR": + case 0: + message.result = 0; + break; + case "SUCCESS": + case 1: + message.result = 1; + break; + case "NOT_FOUND": + case 2: + message.result = 2; + break; + case "DECRYPTION_ERROR": + case 3: + message.result = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a MediaRetryNotification message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MediaRetryNotification + * @static + * @param {proto.MediaRetryNotification} message MediaRetryNotification + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MediaRetryNotification.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.stanzaId = ""; + object.directPath = ""; + object.result = options.enums === String ? "GENERAL_ERROR" : 0; + } + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + object.stanzaId = message.stanzaId; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.result != null && message.hasOwnProperty("result")) + object.result = options.enums === String ? $root.proto.MediaRetryNotification.ResultType[message.result] : message.result; + return object; + }; + + /** + * Converts this MediaRetryNotification to JSON. + * @function toJSON + * @memberof proto.MediaRetryNotification + * @instance + * @returns {Object.} JSON object + */ + MediaRetryNotification.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ResultType enum. + * @name proto.MediaRetryNotification.ResultType + * @enum {number} + * @property {number} GENERAL_ERROR=0 GENERAL_ERROR value + * @property {number} SUCCESS=1 SUCCESS value + * @property {number} NOT_FOUND=2 NOT_FOUND value + * @property {number} DECRYPTION_ERROR=3 DECRYPTION_ERROR value + */ + MediaRetryNotification.ResultType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "GENERAL_ERROR"] = 0; + values[valuesById[1] = "SUCCESS"] = 1; + values[valuesById[2] = "NOT_FOUND"] = 2; + values[valuesById[3] = "DECRYPTION_ERROR"] = 3; + return values; + })(); + + return MediaRetryNotification; + })(); + + /** + * MediaVisibility enum. + * @name proto.MediaVisibility + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} OFF=1 OFF value + * @property {number} ON=2 ON value + */ + proto.MediaVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "OFF"] = 1; + values[valuesById[2] = "ON"] = 2; + return values; + })(); + + proto.Message = (function() { + + /** + * Properties of a Message. + * @memberof proto + * @interface IMessage + * @property {string|null} [conversation] Message conversation + * @property {proto.Message.ISenderKeyDistributionMessage|null} [senderKeyDistributionMessage] Message senderKeyDistributionMessage + * @property {proto.Message.IImageMessage|null} [imageMessage] Message imageMessage + * @property {proto.Message.IContactMessage|null} [contactMessage] Message contactMessage + * @property {proto.Message.ILocationMessage|null} [locationMessage] Message locationMessage + * @property {proto.Message.IExtendedTextMessage|null} [extendedTextMessage] Message extendedTextMessage + * @property {proto.Message.IDocumentMessage|null} [documentMessage] Message documentMessage + * @property {proto.Message.IAudioMessage|null} [audioMessage] Message audioMessage + * @property {proto.Message.IVideoMessage|null} [videoMessage] Message videoMessage + * @property {proto.Message.ICall|null} [call] Message call + * @property {proto.Message.IChat|null} [chat] Message chat + * @property {proto.Message.IProtocolMessage|null} [protocolMessage] Message protocolMessage + * @property {proto.Message.IContactsArrayMessage|null} [contactsArrayMessage] Message contactsArrayMessage + * @property {proto.Message.IHighlyStructuredMessage|null} [highlyStructuredMessage] Message highlyStructuredMessage + * @property {proto.Message.ISenderKeyDistributionMessage|null} [fastRatchetKeySenderKeyDistributionMessage] Message fastRatchetKeySenderKeyDistributionMessage + * @property {proto.Message.ISendPaymentMessage|null} [sendPaymentMessage] Message sendPaymentMessage + * @property {proto.Message.ILiveLocationMessage|null} [liveLocationMessage] Message liveLocationMessage + * @property {proto.Message.IRequestPaymentMessage|null} [requestPaymentMessage] Message requestPaymentMessage + * @property {proto.Message.IDeclinePaymentRequestMessage|null} [declinePaymentRequestMessage] Message declinePaymentRequestMessage + * @property {proto.Message.ICancelPaymentRequestMessage|null} [cancelPaymentRequestMessage] Message cancelPaymentRequestMessage + * @property {proto.Message.ITemplateMessage|null} [templateMessage] Message templateMessage + * @property {proto.Message.IStickerMessage|null} [stickerMessage] Message stickerMessage + * @property {proto.Message.IGroupInviteMessage|null} [groupInviteMessage] Message groupInviteMessage + * @property {proto.Message.ITemplateButtonReplyMessage|null} [templateButtonReplyMessage] Message templateButtonReplyMessage + * @property {proto.Message.IProductMessage|null} [productMessage] Message productMessage + * @property {proto.Message.IDeviceSentMessage|null} [deviceSentMessage] Message deviceSentMessage + * @property {proto.IMessageContextInfo|null} [messageContextInfo] Message messageContextInfo + * @property {proto.Message.IListMessage|null} [listMessage] Message listMessage + * @property {proto.Message.IFutureProofMessage|null} [viewOnceMessage] Message viewOnceMessage + * @property {proto.Message.IOrderMessage|null} [orderMessage] Message orderMessage + * @property {proto.Message.IListResponseMessage|null} [listResponseMessage] Message listResponseMessage + * @property {proto.Message.IFutureProofMessage|null} [ephemeralMessage] Message ephemeralMessage + * @property {proto.Message.IInvoiceMessage|null} [invoiceMessage] Message invoiceMessage + * @property {proto.Message.IButtonsMessage|null} [buttonsMessage] Message buttonsMessage + * @property {proto.Message.IButtonsResponseMessage|null} [buttonsResponseMessage] Message buttonsResponseMessage + * @property {proto.Message.IPaymentInviteMessage|null} [paymentInviteMessage] Message paymentInviteMessage + * @property {proto.Message.IInteractiveMessage|null} [interactiveMessage] Message interactiveMessage + * @property {proto.Message.IReactionMessage|null} [reactionMessage] Message reactionMessage + * @property {proto.Message.IStickerSyncRMRMessage|null} [stickerSyncRmrMessage] Message stickerSyncRmrMessage + * @property {proto.Message.IInteractiveResponseMessage|null} [interactiveResponseMessage] Message interactiveResponseMessage + * @property {proto.Message.IPollCreationMessage|null} [pollCreationMessage] Message pollCreationMessage + * @property {proto.Message.IPollUpdateMessage|null} [pollUpdateMessage] Message pollUpdateMessage + * @property {proto.Message.IKeepInChatMessage|null} [keepInChatMessage] Message keepInChatMessage + * @property {proto.Message.IFutureProofMessage|null} [documentWithCaptionMessage] Message documentWithCaptionMessage + * @property {proto.Message.IRequestPhoneNumberMessage|null} [requestPhoneNumberMessage] Message requestPhoneNumberMessage + * @property {proto.Message.IFutureProofMessage|null} [viewOnceMessageV2] Message viewOnceMessageV2 + * @property {proto.Message.IEncReactionMessage|null} [encReactionMessage] Message encReactionMessage + * @property {proto.Message.IFutureProofMessage|null} [editedMessage] Message editedMessage + * @property {proto.Message.IFutureProofMessage|null} [viewOnceMessageV2Extension] Message viewOnceMessageV2Extension + * @property {proto.Message.IPollCreationMessage|null} [pollCreationMessageV2] Message pollCreationMessageV2 + * @property {proto.Message.IScheduledCallCreationMessage|null} [scheduledCallCreationMessage] Message scheduledCallCreationMessage + * @property {proto.Message.IFutureProofMessage|null} [groupMentionedMessage] Message groupMentionedMessage + * @property {proto.Message.IPinMessage|null} [pinMessage] Message pinMessage + * @property {proto.Message.IPollCreationMessage|null} [pollCreationMessageV3] Message pollCreationMessageV3 + * @property {proto.Message.IScheduledCallEditMessage|null} [scheduledCallEditMessage] Message scheduledCallEditMessage + * @property {proto.Message.IVideoMessage|null} [ptvMessage] Message ptvMessage + */ + + /** + * Constructs a new Message. + * @memberof proto + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {proto.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message conversation. + * @member {string} conversation + * @memberof proto.Message + * @instance + */ + Message.prototype.conversation = ""; + + /** + * Message senderKeyDistributionMessage. + * @member {proto.Message.ISenderKeyDistributionMessage|null|undefined} senderKeyDistributionMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.senderKeyDistributionMessage = null; + + /** + * Message imageMessage. + * @member {proto.Message.IImageMessage|null|undefined} imageMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.imageMessage = null; + + /** + * Message contactMessage. + * @member {proto.Message.IContactMessage|null|undefined} contactMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.contactMessage = null; + + /** + * Message locationMessage. + * @member {proto.Message.ILocationMessage|null|undefined} locationMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.locationMessage = null; + + /** + * Message extendedTextMessage. + * @member {proto.Message.IExtendedTextMessage|null|undefined} extendedTextMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.extendedTextMessage = null; + + /** + * Message documentMessage. + * @member {proto.Message.IDocumentMessage|null|undefined} documentMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.documentMessage = null; + + /** + * Message audioMessage. + * @member {proto.Message.IAudioMessage|null|undefined} audioMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.audioMessage = null; + + /** + * Message videoMessage. + * @member {proto.Message.IVideoMessage|null|undefined} videoMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.videoMessage = null; + + /** + * Message call. + * @member {proto.Message.ICall|null|undefined} call + * @memberof proto.Message + * @instance + */ + Message.prototype.call = null; + + /** + * Message chat. + * @member {proto.Message.IChat|null|undefined} chat + * @memberof proto.Message + * @instance + */ + Message.prototype.chat = null; + + /** + * Message protocolMessage. + * @member {proto.Message.IProtocolMessage|null|undefined} protocolMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.protocolMessage = null; + + /** + * Message contactsArrayMessage. + * @member {proto.Message.IContactsArrayMessage|null|undefined} contactsArrayMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.contactsArrayMessage = null; + + /** + * Message highlyStructuredMessage. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} highlyStructuredMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.highlyStructuredMessage = null; + + /** + * Message fastRatchetKeySenderKeyDistributionMessage. + * @member {proto.Message.ISenderKeyDistributionMessage|null|undefined} fastRatchetKeySenderKeyDistributionMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.fastRatchetKeySenderKeyDistributionMessage = null; + + /** + * Message sendPaymentMessage. + * @member {proto.Message.ISendPaymentMessage|null|undefined} sendPaymentMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.sendPaymentMessage = null; + + /** + * Message liveLocationMessage. + * @member {proto.Message.ILiveLocationMessage|null|undefined} liveLocationMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.liveLocationMessage = null; + + /** + * Message requestPaymentMessage. + * @member {proto.Message.IRequestPaymentMessage|null|undefined} requestPaymentMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.requestPaymentMessage = null; + + /** + * Message declinePaymentRequestMessage. + * @member {proto.Message.IDeclinePaymentRequestMessage|null|undefined} declinePaymentRequestMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.declinePaymentRequestMessage = null; + + /** + * Message cancelPaymentRequestMessage. + * @member {proto.Message.ICancelPaymentRequestMessage|null|undefined} cancelPaymentRequestMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.cancelPaymentRequestMessage = null; + + /** + * Message templateMessage. + * @member {proto.Message.ITemplateMessage|null|undefined} templateMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.templateMessage = null; + + /** + * Message stickerMessage. + * @member {proto.Message.IStickerMessage|null|undefined} stickerMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.stickerMessage = null; + + /** + * Message groupInviteMessage. + * @member {proto.Message.IGroupInviteMessage|null|undefined} groupInviteMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.groupInviteMessage = null; + + /** + * Message templateButtonReplyMessage. + * @member {proto.Message.ITemplateButtonReplyMessage|null|undefined} templateButtonReplyMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.templateButtonReplyMessage = null; + + /** + * Message productMessage. + * @member {proto.Message.IProductMessage|null|undefined} productMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.productMessage = null; + + /** + * Message deviceSentMessage. + * @member {proto.Message.IDeviceSentMessage|null|undefined} deviceSentMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.deviceSentMessage = null; + + /** + * Message messageContextInfo. + * @member {proto.IMessageContextInfo|null|undefined} messageContextInfo + * @memberof proto.Message + * @instance + */ + Message.prototype.messageContextInfo = null; + + /** + * Message listMessage. + * @member {proto.Message.IListMessage|null|undefined} listMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.listMessage = null; + + /** + * Message viewOnceMessage. + * @member {proto.Message.IFutureProofMessage|null|undefined} viewOnceMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.viewOnceMessage = null; + + /** + * Message orderMessage. + * @member {proto.Message.IOrderMessage|null|undefined} orderMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.orderMessage = null; + + /** + * Message listResponseMessage. + * @member {proto.Message.IListResponseMessage|null|undefined} listResponseMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.listResponseMessage = null; + + /** + * Message ephemeralMessage. + * @member {proto.Message.IFutureProofMessage|null|undefined} ephemeralMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.ephemeralMessage = null; + + /** + * Message invoiceMessage. + * @member {proto.Message.IInvoiceMessage|null|undefined} invoiceMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.invoiceMessage = null; + + /** + * Message buttonsMessage. + * @member {proto.Message.IButtonsMessage|null|undefined} buttonsMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.buttonsMessage = null; + + /** + * Message buttonsResponseMessage. + * @member {proto.Message.IButtonsResponseMessage|null|undefined} buttonsResponseMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.buttonsResponseMessage = null; + + /** + * Message paymentInviteMessage. + * @member {proto.Message.IPaymentInviteMessage|null|undefined} paymentInviteMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.paymentInviteMessage = null; + + /** + * Message interactiveMessage. + * @member {proto.Message.IInteractiveMessage|null|undefined} interactiveMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.interactiveMessage = null; + + /** + * Message reactionMessage. + * @member {proto.Message.IReactionMessage|null|undefined} reactionMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.reactionMessage = null; + + /** + * Message stickerSyncRmrMessage. + * @member {proto.Message.IStickerSyncRMRMessage|null|undefined} stickerSyncRmrMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.stickerSyncRmrMessage = null; + + /** + * Message interactiveResponseMessage. + * @member {proto.Message.IInteractiveResponseMessage|null|undefined} interactiveResponseMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.interactiveResponseMessage = null; + + /** + * Message pollCreationMessage. + * @member {proto.Message.IPollCreationMessage|null|undefined} pollCreationMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.pollCreationMessage = null; + + /** + * Message pollUpdateMessage. + * @member {proto.Message.IPollUpdateMessage|null|undefined} pollUpdateMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.pollUpdateMessage = null; + + /** + * Message keepInChatMessage. + * @member {proto.Message.IKeepInChatMessage|null|undefined} keepInChatMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.keepInChatMessage = null; + + /** + * Message documentWithCaptionMessage. + * @member {proto.Message.IFutureProofMessage|null|undefined} documentWithCaptionMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.documentWithCaptionMessage = null; + + /** + * Message requestPhoneNumberMessage. + * @member {proto.Message.IRequestPhoneNumberMessage|null|undefined} requestPhoneNumberMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.requestPhoneNumberMessage = null; + + /** + * Message viewOnceMessageV2. + * @member {proto.Message.IFutureProofMessage|null|undefined} viewOnceMessageV2 + * @memberof proto.Message + * @instance + */ + Message.prototype.viewOnceMessageV2 = null; + + /** + * Message encReactionMessage. + * @member {proto.Message.IEncReactionMessage|null|undefined} encReactionMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.encReactionMessage = null; + + /** + * Message editedMessage. + * @member {proto.Message.IFutureProofMessage|null|undefined} editedMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.editedMessage = null; + + /** + * Message viewOnceMessageV2Extension. + * @member {proto.Message.IFutureProofMessage|null|undefined} viewOnceMessageV2Extension + * @memberof proto.Message + * @instance + */ + Message.prototype.viewOnceMessageV2Extension = null; + + /** + * Message pollCreationMessageV2. + * @member {proto.Message.IPollCreationMessage|null|undefined} pollCreationMessageV2 + * @memberof proto.Message + * @instance + */ + Message.prototype.pollCreationMessageV2 = null; + + /** + * Message scheduledCallCreationMessage. + * @member {proto.Message.IScheduledCallCreationMessage|null|undefined} scheduledCallCreationMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.scheduledCallCreationMessage = null; + + /** + * Message groupMentionedMessage. + * @member {proto.Message.IFutureProofMessage|null|undefined} groupMentionedMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.groupMentionedMessage = null; + + /** + * Message pinMessage. + * @member {proto.Message.IPinMessage|null|undefined} pinMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.pinMessage = null; + + /** + * Message pollCreationMessageV3. + * @member {proto.Message.IPollCreationMessage|null|undefined} pollCreationMessageV3 + * @memberof proto.Message + * @instance + */ + Message.prototype.pollCreationMessageV3 = null; + + /** + * Message scheduledCallEditMessage. + * @member {proto.Message.IScheduledCallEditMessage|null|undefined} scheduledCallEditMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.scheduledCallEditMessage = null; + + /** + * Message ptvMessage. + * @member {proto.Message.IVideoMessage|null|undefined} ptvMessage + * @memberof proto.Message + * @instance + */ + Message.prototype.ptvMessage = null; + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof proto.Message + * @static + * @param {proto.IMessage=} [properties] Properties to set + * @returns {proto.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link proto.Message.verify|verify} messages. + * @function encode + * @memberof proto.Message + * @static + * @param {proto.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversation); + if (message.senderKeyDistributionMessage != null && Object.hasOwnProperty.call(message, "senderKeyDistributionMessage")) + $root.proto.Message.SenderKeyDistributionMessage.encode(message.senderKeyDistributionMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageMessage != null && Object.hasOwnProperty.call(message, "imageMessage")) + $root.proto.Message.ImageMessage.encode(message.imageMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.contactMessage != null && Object.hasOwnProperty.call(message, "contactMessage")) + $root.proto.Message.ContactMessage.encode(message.contactMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.locationMessage != null && Object.hasOwnProperty.call(message, "locationMessage")) + $root.proto.Message.LocationMessage.encode(message.locationMessage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extendedTextMessage != null && Object.hasOwnProperty.call(message, "extendedTextMessage")) + $root.proto.Message.ExtendedTextMessage.encode(message.extendedTextMessage, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.documentMessage != null && Object.hasOwnProperty.call(message, "documentMessage")) + $root.proto.Message.DocumentMessage.encode(message.documentMessage, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.audioMessage != null && Object.hasOwnProperty.call(message, "audioMessage")) + $root.proto.Message.AudioMessage.encode(message.audioMessage, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.videoMessage != null && Object.hasOwnProperty.call(message, "videoMessage")) + $root.proto.Message.VideoMessage.encode(message.videoMessage, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.call != null && Object.hasOwnProperty.call(message, "call")) + $root.proto.Message.Call.encode(message.call, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.chat != null && Object.hasOwnProperty.call(message, "chat")) + $root.proto.Message.Chat.encode(message.chat, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.protocolMessage != null && Object.hasOwnProperty.call(message, "protocolMessage")) + $root.proto.Message.ProtocolMessage.encode(message.protocolMessage, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.contactsArrayMessage != null && Object.hasOwnProperty.call(message, "contactsArrayMessage")) + $root.proto.Message.ContactsArrayMessage.encode(message.contactsArrayMessage, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.highlyStructuredMessage != null && Object.hasOwnProperty.call(message, "highlyStructuredMessage")) + $root.proto.Message.HighlyStructuredMessage.encode(message.highlyStructuredMessage, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.fastRatchetKeySenderKeyDistributionMessage != null && Object.hasOwnProperty.call(message, "fastRatchetKeySenderKeyDistributionMessage")) + $root.proto.Message.SenderKeyDistributionMessage.encode(message.fastRatchetKeySenderKeyDistributionMessage, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.sendPaymentMessage != null && Object.hasOwnProperty.call(message, "sendPaymentMessage")) + $root.proto.Message.SendPaymentMessage.encode(message.sendPaymentMessage, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.liveLocationMessage != null && Object.hasOwnProperty.call(message, "liveLocationMessage")) + $root.proto.Message.LiveLocationMessage.encode(message.liveLocationMessage, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.requestPaymentMessage != null && Object.hasOwnProperty.call(message, "requestPaymentMessage")) + $root.proto.Message.RequestPaymentMessage.encode(message.requestPaymentMessage, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.declinePaymentRequestMessage != null && Object.hasOwnProperty.call(message, "declinePaymentRequestMessage")) + $root.proto.Message.DeclinePaymentRequestMessage.encode(message.declinePaymentRequestMessage, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.cancelPaymentRequestMessage != null && Object.hasOwnProperty.call(message, "cancelPaymentRequestMessage")) + $root.proto.Message.CancelPaymentRequestMessage.encode(message.cancelPaymentRequestMessage, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.templateMessage != null && Object.hasOwnProperty.call(message, "templateMessage")) + $root.proto.Message.TemplateMessage.encode(message.templateMessage, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.stickerMessage != null && Object.hasOwnProperty.call(message, "stickerMessage")) + $root.proto.Message.StickerMessage.encode(message.stickerMessage, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.groupInviteMessage != null && Object.hasOwnProperty.call(message, "groupInviteMessage")) + $root.proto.Message.GroupInviteMessage.encode(message.groupInviteMessage, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + if (message.templateButtonReplyMessage != null && Object.hasOwnProperty.call(message, "templateButtonReplyMessage")) + $root.proto.Message.TemplateButtonReplyMessage.encode(message.templateButtonReplyMessage, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.productMessage != null && Object.hasOwnProperty.call(message, "productMessage")) + $root.proto.Message.ProductMessage.encode(message.productMessage, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.deviceSentMessage != null && Object.hasOwnProperty.call(message, "deviceSentMessage")) + $root.proto.Message.DeviceSentMessage.encode(message.deviceSentMessage, writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.messageContextInfo != null && Object.hasOwnProperty.call(message, "messageContextInfo")) + $root.proto.MessageContextInfo.encode(message.messageContextInfo, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.listMessage != null && Object.hasOwnProperty.call(message, "listMessage")) + $root.proto.Message.ListMessage.encode(message.listMessage, writer.uint32(/* id 36, wireType 2 =*/290).fork()).ldelim(); + if (message.viewOnceMessage != null && Object.hasOwnProperty.call(message, "viewOnceMessage")) + $root.proto.Message.FutureProofMessage.encode(message.viewOnceMessage, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + if (message.orderMessage != null && Object.hasOwnProperty.call(message, "orderMessage")) + $root.proto.Message.OrderMessage.encode(message.orderMessage, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); + if (message.listResponseMessage != null && Object.hasOwnProperty.call(message, "listResponseMessage")) + $root.proto.Message.ListResponseMessage.encode(message.listResponseMessage, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.ephemeralMessage != null && Object.hasOwnProperty.call(message, "ephemeralMessage")) + $root.proto.Message.FutureProofMessage.encode(message.ephemeralMessage, writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); + if (message.invoiceMessage != null && Object.hasOwnProperty.call(message, "invoiceMessage")) + $root.proto.Message.InvoiceMessage.encode(message.invoiceMessage, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + if (message.buttonsMessage != null && Object.hasOwnProperty.call(message, "buttonsMessage")) + $root.proto.Message.ButtonsMessage.encode(message.buttonsMessage, writer.uint32(/* id 42, wireType 2 =*/338).fork()).ldelim(); + if (message.buttonsResponseMessage != null && Object.hasOwnProperty.call(message, "buttonsResponseMessage")) + $root.proto.Message.ButtonsResponseMessage.encode(message.buttonsResponseMessage, writer.uint32(/* id 43, wireType 2 =*/346).fork()).ldelim(); + if (message.paymentInviteMessage != null && Object.hasOwnProperty.call(message, "paymentInviteMessage")) + $root.proto.Message.PaymentInviteMessage.encode(message.paymentInviteMessage, writer.uint32(/* id 44, wireType 2 =*/354).fork()).ldelim(); + if (message.interactiveMessage != null && Object.hasOwnProperty.call(message, "interactiveMessage")) + $root.proto.Message.InteractiveMessage.encode(message.interactiveMessage, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + if (message.reactionMessage != null && Object.hasOwnProperty.call(message, "reactionMessage")) + $root.proto.Message.ReactionMessage.encode(message.reactionMessage, writer.uint32(/* id 46, wireType 2 =*/370).fork()).ldelim(); + if (message.stickerSyncRmrMessage != null && Object.hasOwnProperty.call(message, "stickerSyncRmrMessage")) + $root.proto.Message.StickerSyncRMRMessage.encode(message.stickerSyncRmrMessage, writer.uint32(/* id 47, wireType 2 =*/378).fork()).ldelim(); + if (message.interactiveResponseMessage != null && Object.hasOwnProperty.call(message, "interactiveResponseMessage")) + $root.proto.Message.InteractiveResponseMessage.encode(message.interactiveResponseMessage, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.pollCreationMessage != null && Object.hasOwnProperty.call(message, "pollCreationMessage")) + $root.proto.Message.PollCreationMessage.encode(message.pollCreationMessage, writer.uint32(/* id 49, wireType 2 =*/394).fork()).ldelim(); + if (message.pollUpdateMessage != null && Object.hasOwnProperty.call(message, "pollUpdateMessage")) + $root.proto.Message.PollUpdateMessage.encode(message.pollUpdateMessage, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.keepInChatMessage != null && Object.hasOwnProperty.call(message, "keepInChatMessage")) + $root.proto.Message.KeepInChatMessage.encode(message.keepInChatMessage, writer.uint32(/* id 51, wireType 2 =*/410).fork()).ldelim(); + if (message.documentWithCaptionMessage != null && Object.hasOwnProperty.call(message, "documentWithCaptionMessage")) + $root.proto.Message.FutureProofMessage.encode(message.documentWithCaptionMessage, writer.uint32(/* id 53, wireType 2 =*/426).fork()).ldelim(); + if (message.requestPhoneNumberMessage != null && Object.hasOwnProperty.call(message, "requestPhoneNumberMessage")) + $root.proto.Message.RequestPhoneNumberMessage.encode(message.requestPhoneNumberMessage, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); + if (message.viewOnceMessageV2 != null && Object.hasOwnProperty.call(message, "viewOnceMessageV2")) + $root.proto.Message.FutureProofMessage.encode(message.viewOnceMessageV2, writer.uint32(/* id 55, wireType 2 =*/442).fork()).ldelim(); + if (message.encReactionMessage != null && Object.hasOwnProperty.call(message, "encReactionMessage")) + $root.proto.Message.EncReactionMessage.encode(message.encReactionMessage, writer.uint32(/* id 56, wireType 2 =*/450).fork()).ldelim(); + if (message.editedMessage != null && Object.hasOwnProperty.call(message, "editedMessage")) + $root.proto.Message.FutureProofMessage.encode(message.editedMessage, writer.uint32(/* id 58, wireType 2 =*/466).fork()).ldelim(); + if (message.viewOnceMessageV2Extension != null && Object.hasOwnProperty.call(message, "viewOnceMessageV2Extension")) + $root.proto.Message.FutureProofMessage.encode(message.viewOnceMessageV2Extension, writer.uint32(/* id 59, wireType 2 =*/474).fork()).ldelim(); + if (message.pollCreationMessageV2 != null && Object.hasOwnProperty.call(message, "pollCreationMessageV2")) + $root.proto.Message.PollCreationMessage.encode(message.pollCreationMessageV2, writer.uint32(/* id 60, wireType 2 =*/482).fork()).ldelim(); + if (message.scheduledCallCreationMessage != null && Object.hasOwnProperty.call(message, "scheduledCallCreationMessage")) + $root.proto.Message.ScheduledCallCreationMessage.encode(message.scheduledCallCreationMessage, writer.uint32(/* id 61, wireType 2 =*/490).fork()).ldelim(); + if (message.groupMentionedMessage != null && Object.hasOwnProperty.call(message, "groupMentionedMessage")) + $root.proto.Message.FutureProofMessage.encode(message.groupMentionedMessage, writer.uint32(/* id 62, wireType 2 =*/498).fork()).ldelim(); + if (message.pinMessage != null && Object.hasOwnProperty.call(message, "pinMessage")) + $root.proto.Message.PinMessage.encode(message.pinMessage, writer.uint32(/* id 63, wireType 2 =*/506).fork()).ldelim(); + if (message.pollCreationMessageV3 != null && Object.hasOwnProperty.call(message, "pollCreationMessageV3")) + $root.proto.Message.PollCreationMessage.encode(message.pollCreationMessageV3, writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); + if (message.scheduledCallEditMessage != null && Object.hasOwnProperty.call(message, "scheduledCallEditMessage")) + $root.proto.Message.ScheduledCallEditMessage.encode(message.scheduledCallEditMessage, writer.uint32(/* id 65, wireType 2 =*/522).fork()).ldelim(); + if (message.ptvMessage != null && Object.hasOwnProperty.call(message, "ptvMessage")) + $root.proto.Message.VideoMessage.encode(message.ptvMessage, writer.uint32(/* id 66, wireType 2 =*/530).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link proto.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message + * @static + * @param {proto.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof proto.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.conversation = reader.string(); + break; + case 2: + message.senderKeyDistributionMessage = $root.proto.Message.SenderKeyDistributionMessage.decode(reader, reader.uint32()); + break; + case 3: + message.imageMessage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 4: + message.contactMessage = $root.proto.Message.ContactMessage.decode(reader, reader.uint32()); + break; + case 5: + message.locationMessage = $root.proto.Message.LocationMessage.decode(reader, reader.uint32()); + break; + case 6: + message.extendedTextMessage = $root.proto.Message.ExtendedTextMessage.decode(reader, reader.uint32()); + break; + case 7: + message.documentMessage = $root.proto.Message.DocumentMessage.decode(reader, reader.uint32()); + break; + case 8: + message.audioMessage = $root.proto.Message.AudioMessage.decode(reader, reader.uint32()); + break; + case 9: + message.videoMessage = $root.proto.Message.VideoMessage.decode(reader, reader.uint32()); + break; + case 10: + message.call = $root.proto.Message.Call.decode(reader, reader.uint32()); + break; + case 11: + message.chat = $root.proto.Message.Chat.decode(reader, reader.uint32()); + break; + case 12: + message.protocolMessage = $root.proto.Message.ProtocolMessage.decode(reader, reader.uint32()); + break; + case 13: + message.contactsArrayMessage = $root.proto.Message.ContactsArrayMessage.decode(reader, reader.uint32()); + break; + case 14: + message.highlyStructuredMessage = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 15: + message.fastRatchetKeySenderKeyDistributionMessage = $root.proto.Message.SenderKeyDistributionMessage.decode(reader, reader.uint32()); + break; + case 16: + message.sendPaymentMessage = $root.proto.Message.SendPaymentMessage.decode(reader, reader.uint32()); + break; + case 18: + message.liveLocationMessage = $root.proto.Message.LiveLocationMessage.decode(reader, reader.uint32()); + break; + case 22: + message.requestPaymentMessage = $root.proto.Message.RequestPaymentMessage.decode(reader, reader.uint32()); + break; + case 23: + message.declinePaymentRequestMessage = $root.proto.Message.DeclinePaymentRequestMessage.decode(reader, reader.uint32()); + break; + case 24: + message.cancelPaymentRequestMessage = $root.proto.Message.CancelPaymentRequestMessage.decode(reader, reader.uint32()); + break; + case 25: + message.templateMessage = $root.proto.Message.TemplateMessage.decode(reader, reader.uint32()); + break; + case 26: + message.stickerMessage = $root.proto.Message.StickerMessage.decode(reader, reader.uint32()); + break; + case 28: + message.groupInviteMessage = $root.proto.Message.GroupInviteMessage.decode(reader, reader.uint32()); + break; + case 29: + message.templateButtonReplyMessage = $root.proto.Message.TemplateButtonReplyMessage.decode(reader, reader.uint32()); + break; + case 30: + message.productMessage = $root.proto.Message.ProductMessage.decode(reader, reader.uint32()); + break; + case 31: + message.deviceSentMessage = $root.proto.Message.DeviceSentMessage.decode(reader, reader.uint32()); + break; + case 35: + message.messageContextInfo = $root.proto.MessageContextInfo.decode(reader, reader.uint32()); + break; + case 36: + message.listMessage = $root.proto.Message.ListMessage.decode(reader, reader.uint32()); + break; + case 37: + message.viewOnceMessage = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 38: + message.orderMessage = $root.proto.Message.OrderMessage.decode(reader, reader.uint32()); + break; + case 39: + message.listResponseMessage = $root.proto.Message.ListResponseMessage.decode(reader, reader.uint32()); + break; + case 40: + message.ephemeralMessage = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 41: + message.invoiceMessage = $root.proto.Message.InvoiceMessage.decode(reader, reader.uint32()); + break; + case 42: + message.buttonsMessage = $root.proto.Message.ButtonsMessage.decode(reader, reader.uint32()); + break; + case 43: + message.buttonsResponseMessage = $root.proto.Message.ButtonsResponseMessage.decode(reader, reader.uint32()); + break; + case 44: + message.paymentInviteMessage = $root.proto.Message.PaymentInviteMessage.decode(reader, reader.uint32()); + break; + case 45: + message.interactiveMessage = $root.proto.Message.InteractiveMessage.decode(reader, reader.uint32()); + break; + case 46: + message.reactionMessage = $root.proto.Message.ReactionMessage.decode(reader, reader.uint32()); + break; + case 47: + message.stickerSyncRmrMessage = $root.proto.Message.StickerSyncRMRMessage.decode(reader, reader.uint32()); + break; + case 48: + message.interactiveResponseMessage = $root.proto.Message.InteractiveResponseMessage.decode(reader, reader.uint32()); + break; + case 49: + message.pollCreationMessage = $root.proto.Message.PollCreationMessage.decode(reader, reader.uint32()); + break; + case 50: + message.pollUpdateMessage = $root.proto.Message.PollUpdateMessage.decode(reader, reader.uint32()); + break; + case 51: + message.keepInChatMessage = $root.proto.Message.KeepInChatMessage.decode(reader, reader.uint32()); + break; + case 53: + message.documentWithCaptionMessage = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 54: + message.requestPhoneNumberMessage = $root.proto.Message.RequestPhoneNumberMessage.decode(reader, reader.uint32()); + break; + case 55: + message.viewOnceMessageV2 = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 56: + message.encReactionMessage = $root.proto.Message.EncReactionMessage.decode(reader, reader.uint32()); + break; + case 58: + message.editedMessage = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 59: + message.viewOnceMessageV2Extension = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 60: + message.pollCreationMessageV2 = $root.proto.Message.PollCreationMessage.decode(reader, reader.uint32()); + break; + case 61: + message.scheduledCallCreationMessage = $root.proto.Message.ScheduledCallCreationMessage.decode(reader, reader.uint32()); + break; + case 62: + message.groupMentionedMessage = $root.proto.Message.FutureProofMessage.decode(reader, reader.uint32()); + break; + case 63: + message.pinMessage = $root.proto.Message.PinMessage.decode(reader, reader.uint32()); + break; + case 64: + message.pollCreationMessageV3 = $root.proto.Message.PollCreationMessage.decode(reader, reader.uint32()); + break; + case 65: + message.scheduledCallEditMessage = $root.proto.Message.ScheduledCallEditMessage.decode(reader, reader.uint32()); + break; + case 66: + message.ptvMessage = $root.proto.Message.VideoMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof proto.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversation != null && message.hasOwnProperty("conversation")) + if (!$util.isString(message.conversation)) + return "conversation: string expected"; + if (message.senderKeyDistributionMessage != null && message.hasOwnProperty("senderKeyDistributionMessage")) { + var error = $root.proto.Message.SenderKeyDistributionMessage.verify(message.senderKeyDistributionMessage); + if (error) + return "senderKeyDistributionMessage." + error; + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + var error = $root.proto.Message.ImageMessage.verify(message.imageMessage); + if (error) + return "imageMessage." + error; + } + if (message.contactMessage != null && message.hasOwnProperty("contactMessage")) { + var error = $root.proto.Message.ContactMessage.verify(message.contactMessage); + if (error) + return "contactMessage." + error; + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + var error = $root.proto.Message.LocationMessage.verify(message.locationMessage); + if (error) + return "locationMessage." + error; + } + if (message.extendedTextMessage != null && message.hasOwnProperty("extendedTextMessage")) { + var error = $root.proto.Message.ExtendedTextMessage.verify(message.extendedTextMessage); + if (error) + return "extendedTextMessage." + error; + } + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + var error = $root.proto.Message.DocumentMessage.verify(message.documentMessage); + if (error) + return "documentMessage." + error; + } + if (message.audioMessage != null && message.hasOwnProperty("audioMessage")) { + var error = $root.proto.Message.AudioMessage.verify(message.audioMessage); + if (error) + return "audioMessage." + error; + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + var error = $root.proto.Message.VideoMessage.verify(message.videoMessage); + if (error) + return "videoMessage." + error; + } + if (message.call != null && message.hasOwnProperty("call")) { + var error = $root.proto.Message.Call.verify(message.call); + if (error) + return "call." + error; + } + if (message.chat != null && message.hasOwnProperty("chat")) { + var error = $root.proto.Message.Chat.verify(message.chat); + if (error) + return "chat." + error; + } + if (message.protocolMessage != null && message.hasOwnProperty("protocolMessage")) { + var error = $root.proto.Message.ProtocolMessage.verify(message.protocolMessage); + if (error) + return "protocolMessage." + error; + } + if (message.contactsArrayMessage != null && message.hasOwnProperty("contactsArrayMessage")) { + var error = $root.proto.Message.ContactsArrayMessage.verify(message.contactsArrayMessage); + if (error) + return "contactsArrayMessage." + error; + } + if (message.highlyStructuredMessage != null && message.hasOwnProperty("highlyStructuredMessage")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.highlyStructuredMessage); + if (error) + return "highlyStructuredMessage." + error; + } + if (message.fastRatchetKeySenderKeyDistributionMessage != null && message.hasOwnProperty("fastRatchetKeySenderKeyDistributionMessage")) { + var error = $root.proto.Message.SenderKeyDistributionMessage.verify(message.fastRatchetKeySenderKeyDistributionMessage); + if (error) + return "fastRatchetKeySenderKeyDistributionMessage." + error; + } + if (message.sendPaymentMessage != null && message.hasOwnProperty("sendPaymentMessage")) { + var error = $root.proto.Message.SendPaymentMessage.verify(message.sendPaymentMessage); + if (error) + return "sendPaymentMessage." + error; + } + if (message.liveLocationMessage != null && message.hasOwnProperty("liveLocationMessage")) { + var error = $root.proto.Message.LiveLocationMessage.verify(message.liveLocationMessage); + if (error) + return "liveLocationMessage." + error; + } + if (message.requestPaymentMessage != null && message.hasOwnProperty("requestPaymentMessage")) { + var error = $root.proto.Message.RequestPaymentMessage.verify(message.requestPaymentMessage); + if (error) + return "requestPaymentMessage." + error; + } + if (message.declinePaymentRequestMessage != null && message.hasOwnProperty("declinePaymentRequestMessage")) { + var error = $root.proto.Message.DeclinePaymentRequestMessage.verify(message.declinePaymentRequestMessage); + if (error) + return "declinePaymentRequestMessage." + error; + } + if (message.cancelPaymentRequestMessage != null && message.hasOwnProperty("cancelPaymentRequestMessage")) { + var error = $root.proto.Message.CancelPaymentRequestMessage.verify(message.cancelPaymentRequestMessage); + if (error) + return "cancelPaymentRequestMessage." + error; + } + if (message.templateMessage != null && message.hasOwnProperty("templateMessage")) { + var error = $root.proto.Message.TemplateMessage.verify(message.templateMessage); + if (error) + return "templateMessage." + error; + } + if (message.stickerMessage != null && message.hasOwnProperty("stickerMessage")) { + var error = $root.proto.Message.StickerMessage.verify(message.stickerMessage); + if (error) + return "stickerMessage." + error; + } + if (message.groupInviteMessage != null && message.hasOwnProperty("groupInviteMessage")) { + var error = $root.proto.Message.GroupInviteMessage.verify(message.groupInviteMessage); + if (error) + return "groupInviteMessage." + error; + } + if (message.templateButtonReplyMessage != null && message.hasOwnProperty("templateButtonReplyMessage")) { + var error = $root.proto.Message.TemplateButtonReplyMessage.verify(message.templateButtonReplyMessage); + if (error) + return "templateButtonReplyMessage." + error; + } + if (message.productMessage != null && message.hasOwnProperty("productMessage")) { + var error = $root.proto.Message.ProductMessage.verify(message.productMessage); + if (error) + return "productMessage." + error; + } + if (message.deviceSentMessage != null && message.hasOwnProperty("deviceSentMessage")) { + var error = $root.proto.Message.DeviceSentMessage.verify(message.deviceSentMessage); + if (error) + return "deviceSentMessage." + error; + } + if (message.messageContextInfo != null && message.hasOwnProperty("messageContextInfo")) { + var error = $root.proto.MessageContextInfo.verify(message.messageContextInfo); + if (error) + return "messageContextInfo." + error; + } + if (message.listMessage != null && message.hasOwnProperty("listMessage")) { + var error = $root.proto.Message.ListMessage.verify(message.listMessage); + if (error) + return "listMessage." + error; + } + if (message.viewOnceMessage != null && message.hasOwnProperty("viewOnceMessage")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.viewOnceMessage); + if (error) + return "viewOnceMessage." + error; + } + if (message.orderMessage != null && message.hasOwnProperty("orderMessage")) { + var error = $root.proto.Message.OrderMessage.verify(message.orderMessage); + if (error) + return "orderMessage." + error; + } + if (message.listResponseMessage != null && message.hasOwnProperty("listResponseMessage")) { + var error = $root.proto.Message.ListResponseMessage.verify(message.listResponseMessage); + if (error) + return "listResponseMessage." + error; + } + if (message.ephemeralMessage != null && message.hasOwnProperty("ephemeralMessage")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.ephemeralMessage); + if (error) + return "ephemeralMessage." + error; + } + if (message.invoiceMessage != null && message.hasOwnProperty("invoiceMessage")) { + var error = $root.proto.Message.InvoiceMessage.verify(message.invoiceMessage); + if (error) + return "invoiceMessage." + error; + } + if (message.buttonsMessage != null && message.hasOwnProperty("buttonsMessage")) { + var error = $root.proto.Message.ButtonsMessage.verify(message.buttonsMessage); + if (error) + return "buttonsMessage." + error; + } + if (message.buttonsResponseMessage != null && message.hasOwnProperty("buttonsResponseMessage")) { + var error = $root.proto.Message.ButtonsResponseMessage.verify(message.buttonsResponseMessage); + if (error) + return "buttonsResponseMessage." + error; + } + if (message.paymentInviteMessage != null && message.hasOwnProperty("paymentInviteMessage")) { + var error = $root.proto.Message.PaymentInviteMessage.verify(message.paymentInviteMessage); + if (error) + return "paymentInviteMessage." + error; + } + if (message.interactiveMessage != null && message.hasOwnProperty("interactiveMessage")) { + var error = $root.proto.Message.InteractiveMessage.verify(message.interactiveMessage); + if (error) + return "interactiveMessage." + error; + } + if (message.reactionMessage != null && message.hasOwnProperty("reactionMessage")) { + var error = $root.proto.Message.ReactionMessage.verify(message.reactionMessage); + if (error) + return "reactionMessage." + error; + } + if (message.stickerSyncRmrMessage != null && message.hasOwnProperty("stickerSyncRmrMessage")) { + var error = $root.proto.Message.StickerSyncRMRMessage.verify(message.stickerSyncRmrMessage); + if (error) + return "stickerSyncRmrMessage." + error; + } + if (message.interactiveResponseMessage != null && message.hasOwnProperty("interactiveResponseMessage")) { + var error = $root.proto.Message.InteractiveResponseMessage.verify(message.interactiveResponseMessage); + if (error) + return "interactiveResponseMessage." + error; + } + if (message.pollCreationMessage != null && message.hasOwnProperty("pollCreationMessage")) { + var error = $root.proto.Message.PollCreationMessage.verify(message.pollCreationMessage); + if (error) + return "pollCreationMessage." + error; + } + if (message.pollUpdateMessage != null && message.hasOwnProperty("pollUpdateMessage")) { + var error = $root.proto.Message.PollUpdateMessage.verify(message.pollUpdateMessage); + if (error) + return "pollUpdateMessage." + error; + } + if (message.keepInChatMessage != null && message.hasOwnProperty("keepInChatMessage")) { + var error = $root.proto.Message.KeepInChatMessage.verify(message.keepInChatMessage); + if (error) + return "keepInChatMessage." + error; + } + if (message.documentWithCaptionMessage != null && message.hasOwnProperty("documentWithCaptionMessage")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.documentWithCaptionMessage); + if (error) + return "documentWithCaptionMessage." + error; + } + if (message.requestPhoneNumberMessage != null && message.hasOwnProperty("requestPhoneNumberMessage")) { + var error = $root.proto.Message.RequestPhoneNumberMessage.verify(message.requestPhoneNumberMessage); + if (error) + return "requestPhoneNumberMessage." + error; + } + if (message.viewOnceMessageV2 != null && message.hasOwnProperty("viewOnceMessageV2")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.viewOnceMessageV2); + if (error) + return "viewOnceMessageV2." + error; + } + if (message.encReactionMessage != null && message.hasOwnProperty("encReactionMessage")) { + var error = $root.proto.Message.EncReactionMessage.verify(message.encReactionMessage); + if (error) + return "encReactionMessage." + error; + } + if (message.editedMessage != null && message.hasOwnProperty("editedMessage")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.editedMessage); + if (error) + return "editedMessage." + error; + } + if (message.viewOnceMessageV2Extension != null && message.hasOwnProperty("viewOnceMessageV2Extension")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.viewOnceMessageV2Extension); + if (error) + return "viewOnceMessageV2Extension." + error; + } + if (message.pollCreationMessageV2 != null && message.hasOwnProperty("pollCreationMessageV2")) { + var error = $root.proto.Message.PollCreationMessage.verify(message.pollCreationMessageV2); + if (error) + return "pollCreationMessageV2." + error; + } + if (message.scheduledCallCreationMessage != null && message.hasOwnProperty("scheduledCallCreationMessage")) { + var error = $root.proto.Message.ScheduledCallCreationMessage.verify(message.scheduledCallCreationMessage); + if (error) + return "scheduledCallCreationMessage." + error; + } + if (message.groupMentionedMessage != null && message.hasOwnProperty("groupMentionedMessage")) { + var error = $root.proto.Message.FutureProofMessage.verify(message.groupMentionedMessage); + if (error) + return "groupMentionedMessage." + error; + } + if (message.pinMessage != null && message.hasOwnProperty("pinMessage")) { + var error = $root.proto.Message.PinMessage.verify(message.pinMessage); + if (error) + return "pinMessage." + error; + } + if (message.pollCreationMessageV3 != null && message.hasOwnProperty("pollCreationMessageV3")) { + var error = $root.proto.Message.PollCreationMessage.verify(message.pollCreationMessageV3); + if (error) + return "pollCreationMessageV3." + error; + } + if (message.scheduledCallEditMessage != null && message.hasOwnProperty("scheduledCallEditMessage")) { + var error = $root.proto.Message.ScheduledCallEditMessage.verify(message.scheduledCallEditMessage); + if (error) + return "scheduledCallEditMessage." + error; + } + if (message.ptvMessage != null && message.hasOwnProperty("ptvMessage")) { + var error = $root.proto.Message.VideoMessage.verify(message.ptvMessage); + if (error) + return "ptvMessage." + error; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message + * @static + * @param {Object.} object Plain object + * @returns {proto.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message) + return object; + var message = new $root.proto.Message(); + if (object.conversation != null) + message.conversation = String(object.conversation); + if (object.senderKeyDistributionMessage != null) { + if (typeof object.senderKeyDistributionMessage !== "object") + throw TypeError(".proto.Message.senderKeyDistributionMessage: object expected"); + message.senderKeyDistributionMessage = $root.proto.Message.SenderKeyDistributionMessage.fromObject(object.senderKeyDistributionMessage); + } + if (object.imageMessage != null) { + if (typeof object.imageMessage !== "object") + throw TypeError(".proto.Message.imageMessage: object expected"); + message.imageMessage = $root.proto.Message.ImageMessage.fromObject(object.imageMessage); + } + if (object.contactMessage != null) { + if (typeof object.contactMessage !== "object") + throw TypeError(".proto.Message.contactMessage: object expected"); + message.contactMessage = $root.proto.Message.ContactMessage.fromObject(object.contactMessage); + } + if (object.locationMessage != null) { + if (typeof object.locationMessage !== "object") + throw TypeError(".proto.Message.locationMessage: object expected"); + message.locationMessage = $root.proto.Message.LocationMessage.fromObject(object.locationMessage); + } + if (object.extendedTextMessage != null) { + if (typeof object.extendedTextMessage !== "object") + throw TypeError(".proto.Message.extendedTextMessage: object expected"); + message.extendedTextMessage = $root.proto.Message.ExtendedTextMessage.fromObject(object.extendedTextMessage); + } + if (object.documentMessage != null) { + if (typeof object.documentMessage !== "object") + throw TypeError(".proto.Message.documentMessage: object expected"); + message.documentMessage = $root.proto.Message.DocumentMessage.fromObject(object.documentMessage); + } + if (object.audioMessage != null) { + if (typeof object.audioMessage !== "object") + throw TypeError(".proto.Message.audioMessage: object expected"); + message.audioMessage = $root.proto.Message.AudioMessage.fromObject(object.audioMessage); + } + if (object.videoMessage != null) { + if (typeof object.videoMessage !== "object") + throw TypeError(".proto.Message.videoMessage: object expected"); + message.videoMessage = $root.proto.Message.VideoMessage.fromObject(object.videoMessage); + } + if (object.call != null) { + if (typeof object.call !== "object") + throw TypeError(".proto.Message.call: object expected"); + message.call = $root.proto.Message.Call.fromObject(object.call); + } + if (object.chat != null) { + if (typeof object.chat !== "object") + throw TypeError(".proto.Message.chat: object expected"); + message.chat = $root.proto.Message.Chat.fromObject(object.chat); + } + if (object.protocolMessage != null) { + if (typeof object.protocolMessage !== "object") + throw TypeError(".proto.Message.protocolMessage: object expected"); + message.protocolMessage = $root.proto.Message.ProtocolMessage.fromObject(object.protocolMessage); + } + if (object.contactsArrayMessage != null) { + if (typeof object.contactsArrayMessage !== "object") + throw TypeError(".proto.Message.contactsArrayMessage: object expected"); + message.contactsArrayMessage = $root.proto.Message.ContactsArrayMessage.fromObject(object.contactsArrayMessage); + } + if (object.highlyStructuredMessage != null) { + if (typeof object.highlyStructuredMessage !== "object") + throw TypeError(".proto.Message.highlyStructuredMessage: object expected"); + message.highlyStructuredMessage = $root.proto.Message.HighlyStructuredMessage.fromObject(object.highlyStructuredMessage); + } + if (object.fastRatchetKeySenderKeyDistributionMessage != null) { + if (typeof object.fastRatchetKeySenderKeyDistributionMessage !== "object") + throw TypeError(".proto.Message.fastRatchetKeySenderKeyDistributionMessage: object expected"); + message.fastRatchetKeySenderKeyDistributionMessage = $root.proto.Message.SenderKeyDistributionMessage.fromObject(object.fastRatchetKeySenderKeyDistributionMessage); + } + if (object.sendPaymentMessage != null) { + if (typeof object.sendPaymentMessage !== "object") + throw TypeError(".proto.Message.sendPaymentMessage: object expected"); + message.sendPaymentMessage = $root.proto.Message.SendPaymentMessage.fromObject(object.sendPaymentMessage); + } + if (object.liveLocationMessage != null) { + if (typeof object.liveLocationMessage !== "object") + throw TypeError(".proto.Message.liveLocationMessage: object expected"); + message.liveLocationMessage = $root.proto.Message.LiveLocationMessage.fromObject(object.liveLocationMessage); + } + if (object.requestPaymentMessage != null) { + if (typeof object.requestPaymentMessage !== "object") + throw TypeError(".proto.Message.requestPaymentMessage: object expected"); + message.requestPaymentMessage = $root.proto.Message.RequestPaymentMessage.fromObject(object.requestPaymentMessage); + } + if (object.declinePaymentRequestMessage != null) { + if (typeof object.declinePaymentRequestMessage !== "object") + throw TypeError(".proto.Message.declinePaymentRequestMessage: object expected"); + message.declinePaymentRequestMessage = $root.proto.Message.DeclinePaymentRequestMessage.fromObject(object.declinePaymentRequestMessage); + } + if (object.cancelPaymentRequestMessage != null) { + if (typeof object.cancelPaymentRequestMessage !== "object") + throw TypeError(".proto.Message.cancelPaymentRequestMessage: object expected"); + message.cancelPaymentRequestMessage = $root.proto.Message.CancelPaymentRequestMessage.fromObject(object.cancelPaymentRequestMessage); + } + if (object.templateMessage != null) { + if (typeof object.templateMessage !== "object") + throw TypeError(".proto.Message.templateMessage: object expected"); + message.templateMessage = $root.proto.Message.TemplateMessage.fromObject(object.templateMessage); + } + if (object.stickerMessage != null) { + if (typeof object.stickerMessage !== "object") + throw TypeError(".proto.Message.stickerMessage: object expected"); + message.stickerMessage = $root.proto.Message.StickerMessage.fromObject(object.stickerMessage); + } + if (object.groupInviteMessage != null) { + if (typeof object.groupInviteMessage !== "object") + throw TypeError(".proto.Message.groupInviteMessage: object expected"); + message.groupInviteMessage = $root.proto.Message.GroupInviteMessage.fromObject(object.groupInviteMessage); + } + if (object.templateButtonReplyMessage != null) { + if (typeof object.templateButtonReplyMessage !== "object") + throw TypeError(".proto.Message.templateButtonReplyMessage: object expected"); + message.templateButtonReplyMessage = $root.proto.Message.TemplateButtonReplyMessage.fromObject(object.templateButtonReplyMessage); + } + if (object.productMessage != null) { + if (typeof object.productMessage !== "object") + throw TypeError(".proto.Message.productMessage: object expected"); + message.productMessage = $root.proto.Message.ProductMessage.fromObject(object.productMessage); + } + if (object.deviceSentMessage != null) { + if (typeof object.deviceSentMessage !== "object") + throw TypeError(".proto.Message.deviceSentMessage: object expected"); + message.deviceSentMessage = $root.proto.Message.DeviceSentMessage.fromObject(object.deviceSentMessage); + } + if (object.messageContextInfo != null) { + if (typeof object.messageContextInfo !== "object") + throw TypeError(".proto.Message.messageContextInfo: object expected"); + message.messageContextInfo = $root.proto.MessageContextInfo.fromObject(object.messageContextInfo); + } + if (object.listMessage != null) { + if (typeof object.listMessage !== "object") + throw TypeError(".proto.Message.listMessage: object expected"); + message.listMessage = $root.proto.Message.ListMessage.fromObject(object.listMessage); + } + if (object.viewOnceMessage != null) { + if (typeof object.viewOnceMessage !== "object") + throw TypeError(".proto.Message.viewOnceMessage: object expected"); + message.viewOnceMessage = $root.proto.Message.FutureProofMessage.fromObject(object.viewOnceMessage); + } + if (object.orderMessage != null) { + if (typeof object.orderMessage !== "object") + throw TypeError(".proto.Message.orderMessage: object expected"); + message.orderMessage = $root.proto.Message.OrderMessage.fromObject(object.orderMessage); + } + if (object.listResponseMessage != null) { + if (typeof object.listResponseMessage !== "object") + throw TypeError(".proto.Message.listResponseMessage: object expected"); + message.listResponseMessage = $root.proto.Message.ListResponseMessage.fromObject(object.listResponseMessage); + } + if (object.ephemeralMessage != null) { + if (typeof object.ephemeralMessage !== "object") + throw TypeError(".proto.Message.ephemeralMessage: object expected"); + message.ephemeralMessage = $root.proto.Message.FutureProofMessage.fromObject(object.ephemeralMessage); + } + if (object.invoiceMessage != null) { + if (typeof object.invoiceMessage !== "object") + throw TypeError(".proto.Message.invoiceMessage: object expected"); + message.invoiceMessage = $root.proto.Message.InvoiceMessage.fromObject(object.invoiceMessage); + } + if (object.buttonsMessage != null) { + if (typeof object.buttonsMessage !== "object") + throw TypeError(".proto.Message.buttonsMessage: object expected"); + message.buttonsMessage = $root.proto.Message.ButtonsMessage.fromObject(object.buttonsMessage); + } + if (object.buttonsResponseMessage != null) { + if (typeof object.buttonsResponseMessage !== "object") + throw TypeError(".proto.Message.buttonsResponseMessage: object expected"); + message.buttonsResponseMessage = $root.proto.Message.ButtonsResponseMessage.fromObject(object.buttonsResponseMessage); + } + if (object.paymentInviteMessage != null) { + if (typeof object.paymentInviteMessage !== "object") + throw TypeError(".proto.Message.paymentInviteMessage: object expected"); + message.paymentInviteMessage = $root.proto.Message.PaymentInviteMessage.fromObject(object.paymentInviteMessage); + } + if (object.interactiveMessage != null) { + if (typeof object.interactiveMessage !== "object") + throw TypeError(".proto.Message.interactiveMessage: object expected"); + message.interactiveMessage = $root.proto.Message.InteractiveMessage.fromObject(object.interactiveMessage); + } + if (object.reactionMessage != null) { + if (typeof object.reactionMessage !== "object") + throw TypeError(".proto.Message.reactionMessage: object expected"); + message.reactionMessage = $root.proto.Message.ReactionMessage.fromObject(object.reactionMessage); + } + if (object.stickerSyncRmrMessage != null) { + if (typeof object.stickerSyncRmrMessage !== "object") + throw TypeError(".proto.Message.stickerSyncRmrMessage: object expected"); + message.stickerSyncRmrMessage = $root.proto.Message.StickerSyncRMRMessage.fromObject(object.stickerSyncRmrMessage); + } + if (object.interactiveResponseMessage != null) { + if (typeof object.interactiveResponseMessage !== "object") + throw TypeError(".proto.Message.interactiveResponseMessage: object expected"); + message.interactiveResponseMessage = $root.proto.Message.InteractiveResponseMessage.fromObject(object.interactiveResponseMessage); + } + if (object.pollCreationMessage != null) { + if (typeof object.pollCreationMessage !== "object") + throw TypeError(".proto.Message.pollCreationMessage: object expected"); + message.pollCreationMessage = $root.proto.Message.PollCreationMessage.fromObject(object.pollCreationMessage); + } + if (object.pollUpdateMessage != null) { + if (typeof object.pollUpdateMessage !== "object") + throw TypeError(".proto.Message.pollUpdateMessage: object expected"); + message.pollUpdateMessage = $root.proto.Message.PollUpdateMessage.fromObject(object.pollUpdateMessage); + } + if (object.keepInChatMessage != null) { + if (typeof object.keepInChatMessage !== "object") + throw TypeError(".proto.Message.keepInChatMessage: object expected"); + message.keepInChatMessage = $root.proto.Message.KeepInChatMessage.fromObject(object.keepInChatMessage); + } + if (object.documentWithCaptionMessage != null) { + if (typeof object.documentWithCaptionMessage !== "object") + throw TypeError(".proto.Message.documentWithCaptionMessage: object expected"); + message.documentWithCaptionMessage = $root.proto.Message.FutureProofMessage.fromObject(object.documentWithCaptionMessage); + } + if (object.requestPhoneNumberMessage != null) { + if (typeof object.requestPhoneNumberMessage !== "object") + throw TypeError(".proto.Message.requestPhoneNumberMessage: object expected"); + message.requestPhoneNumberMessage = $root.proto.Message.RequestPhoneNumberMessage.fromObject(object.requestPhoneNumberMessage); + } + if (object.viewOnceMessageV2 != null) { + if (typeof object.viewOnceMessageV2 !== "object") + throw TypeError(".proto.Message.viewOnceMessageV2: object expected"); + message.viewOnceMessageV2 = $root.proto.Message.FutureProofMessage.fromObject(object.viewOnceMessageV2); + } + if (object.encReactionMessage != null) { + if (typeof object.encReactionMessage !== "object") + throw TypeError(".proto.Message.encReactionMessage: object expected"); + message.encReactionMessage = $root.proto.Message.EncReactionMessage.fromObject(object.encReactionMessage); + } + if (object.editedMessage != null) { + if (typeof object.editedMessage !== "object") + throw TypeError(".proto.Message.editedMessage: object expected"); + message.editedMessage = $root.proto.Message.FutureProofMessage.fromObject(object.editedMessage); + } + if (object.viewOnceMessageV2Extension != null) { + if (typeof object.viewOnceMessageV2Extension !== "object") + throw TypeError(".proto.Message.viewOnceMessageV2Extension: object expected"); + message.viewOnceMessageV2Extension = $root.proto.Message.FutureProofMessage.fromObject(object.viewOnceMessageV2Extension); + } + if (object.pollCreationMessageV2 != null) { + if (typeof object.pollCreationMessageV2 !== "object") + throw TypeError(".proto.Message.pollCreationMessageV2: object expected"); + message.pollCreationMessageV2 = $root.proto.Message.PollCreationMessage.fromObject(object.pollCreationMessageV2); + } + if (object.scheduledCallCreationMessage != null) { + if (typeof object.scheduledCallCreationMessage !== "object") + throw TypeError(".proto.Message.scheduledCallCreationMessage: object expected"); + message.scheduledCallCreationMessage = $root.proto.Message.ScheduledCallCreationMessage.fromObject(object.scheduledCallCreationMessage); + } + if (object.groupMentionedMessage != null) { + if (typeof object.groupMentionedMessage !== "object") + throw TypeError(".proto.Message.groupMentionedMessage: object expected"); + message.groupMentionedMessage = $root.proto.Message.FutureProofMessage.fromObject(object.groupMentionedMessage); + } + if (object.pinMessage != null) { + if (typeof object.pinMessage !== "object") + throw TypeError(".proto.Message.pinMessage: object expected"); + message.pinMessage = $root.proto.Message.PinMessage.fromObject(object.pinMessage); + } + if (object.pollCreationMessageV3 != null) { + if (typeof object.pollCreationMessageV3 !== "object") + throw TypeError(".proto.Message.pollCreationMessageV3: object expected"); + message.pollCreationMessageV3 = $root.proto.Message.PollCreationMessage.fromObject(object.pollCreationMessageV3); + } + if (object.scheduledCallEditMessage != null) { + if (typeof object.scheduledCallEditMessage !== "object") + throw TypeError(".proto.Message.scheduledCallEditMessage: object expected"); + message.scheduledCallEditMessage = $root.proto.Message.ScheduledCallEditMessage.fromObject(object.scheduledCallEditMessage); + } + if (object.ptvMessage != null) { + if (typeof object.ptvMessage !== "object") + throw TypeError(".proto.Message.ptvMessage: object expected"); + message.ptvMessage = $root.proto.Message.VideoMessage.fromObject(object.ptvMessage); + } + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message + * @static + * @param {proto.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversation = ""; + object.senderKeyDistributionMessage = null; + object.imageMessage = null; + object.contactMessage = null; + object.locationMessage = null; + object.extendedTextMessage = null; + object.documentMessage = null; + object.audioMessage = null; + object.videoMessage = null; + object.call = null; + object.chat = null; + object.protocolMessage = null; + object.contactsArrayMessage = null; + object.highlyStructuredMessage = null; + object.fastRatchetKeySenderKeyDistributionMessage = null; + object.sendPaymentMessage = null; + object.liveLocationMessage = null; + object.requestPaymentMessage = null; + object.declinePaymentRequestMessage = null; + object.cancelPaymentRequestMessage = null; + object.templateMessage = null; + object.stickerMessage = null; + object.groupInviteMessage = null; + object.templateButtonReplyMessage = null; + object.productMessage = null; + object.deviceSentMessage = null; + object.messageContextInfo = null; + object.listMessage = null; + object.viewOnceMessage = null; + object.orderMessage = null; + object.listResponseMessage = null; + object.ephemeralMessage = null; + object.invoiceMessage = null; + object.buttonsMessage = null; + object.buttonsResponseMessage = null; + object.paymentInviteMessage = null; + object.interactiveMessage = null; + object.reactionMessage = null; + object.stickerSyncRmrMessage = null; + object.interactiveResponseMessage = null; + object.pollCreationMessage = null; + object.pollUpdateMessage = null; + object.keepInChatMessage = null; + object.documentWithCaptionMessage = null; + object.requestPhoneNumberMessage = null; + object.viewOnceMessageV2 = null; + object.encReactionMessage = null; + object.editedMessage = null; + object.viewOnceMessageV2Extension = null; + object.pollCreationMessageV2 = null; + object.scheduledCallCreationMessage = null; + object.groupMentionedMessage = null; + object.pinMessage = null; + object.pollCreationMessageV3 = null; + object.scheduledCallEditMessage = null; + object.ptvMessage = null; + } + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = message.conversation; + if (message.senderKeyDistributionMessage != null && message.hasOwnProperty("senderKeyDistributionMessage")) + object.senderKeyDistributionMessage = $root.proto.Message.SenderKeyDistributionMessage.toObject(message.senderKeyDistributionMessage, options); + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) + object.imageMessage = $root.proto.Message.ImageMessage.toObject(message.imageMessage, options); + if (message.contactMessage != null && message.hasOwnProperty("contactMessage")) + object.contactMessage = $root.proto.Message.ContactMessage.toObject(message.contactMessage, options); + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) + object.locationMessage = $root.proto.Message.LocationMessage.toObject(message.locationMessage, options); + if (message.extendedTextMessage != null && message.hasOwnProperty("extendedTextMessage")) + object.extendedTextMessage = $root.proto.Message.ExtendedTextMessage.toObject(message.extendedTextMessage, options); + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) + object.documentMessage = $root.proto.Message.DocumentMessage.toObject(message.documentMessage, options); + if (message.audioMessage != null && message.hasOwnProperty("audioMessage")) + object.audioMessage = $root.proto.Message.AudioMessage.toObject(message.audioMessage, options); + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) + object.videoMessage = $root.proto.Message.VideoMessage.toObject(message.videoMessage, options); + if (message.call != null && message.hasOwnProperty("call")) + object.call = $root.proto.Message.Call.toObject(message.call, options); + if (message.chat != null && message.hasOwnProperty("chat")) + object.chat = $root.proto.Message.Chat.toObject(message.chat, options); + if (message.protocolMessage != null && message.hasOwnProperty("protocolMessage")) + object.protocolMessage = $root.proto.Message.ProtocolMessage.toObject(message.protocolMessage, options); + if (message.contactsArrayMessage != null && message.hasOwnProperty("contactsArrayMessage")) + object.contactsArrayMessage = $root.proto.Message.ContactsArrayMessage.toObject(message.contactsArrayMessage, options); + if (message.highlyStructuredMessage != null && message.hasOwnProperty("highlyStructuredMessage")) + object.highlyStructuredMessage = $root.proto.Message.HighlyStructuredMessage.toObject(message.highlyStructuredMessage, options); + if (message.fastRatchetKeySenderKeyDistributionMessage != null && message.hasOwnProperty("fastRatchetKeySenderKeyDistributionMessage")) + object.fastRatchetKeySenderKeyDistributionMessage = $root.proto.Message.SenderKeyDistributionMessage.toObject(message.fastRatchetKeySenderKeyDistributionMessage, options); + if (message.sendPaymentMessage != null && message.hasOwnProperty("sendPaymentMessage")) + object.sendPaymentMessage = $root.proto.Message.SendPaymentMessage.toObject(message.sendPaymentMessage, options); + if (message.liveLocationMessage != null && message.hasOwnProperty("liveLocationMessage")) + object.liveLocationMessage = $root.proto.Message.LiveLocationMessage.toObject(message.liveLocationMessage, options); + if (message.requestPaymentMessage != null && message.hasOwnProperty("requestPaymentMessage")) + object.requestPaymentMessage = $root.proto.Message.RequestPaymentMessage.toObject(message.requestPaymentMessage, options); + if (message.declinePaymentRequestMessage != null && message.hasOwnProperty("declinePaymentRequestMessage")) + object.declinePaymentRequestMessage = $root.proto.Message.DeclinePaymentRequestMessage.toObject(message.declinePaymentRequestMessage, options); + if (message.cancelPaymentRequestMessage != null && message.hasOwnProperty("cancelPaymentRequestMessage")) + object.cancelPaymentRequestMessage = $root.proto.Message.CancelPaymentRequestMessage.toObject(message.cancelPaymentRequestMessage, options); + if (message.templateMessage != null && message.hasOwnProperty("templateMessage")) + object.templateMessage = $root.proto.Message.TemplateMessage.toObject(message.templateMessage, options); + if (message.stickerMessage != null && message.hasOwnProperty("stickerMessage")) + object.stickerMessage = $root.proto.Message.StickerMessage.toObject(message.stickerMessage, options); + if (message.groupInviteMessage != null && message.hasOwnProperty("groupInviteMessage")) + object.groupInviteMessage = $root.proto.Message.GroupInviteMessage.toObject(message.groupInviteMessage, options); + if (message.templateButtonReplyMessage != null && message.hasOwnProperty("templateButtonReplyMessage")) + object.templateButtonReplyMessage = $root.proto.Message.TemplateButtonReplyMessage.toObject(message.templateButtonReplyMessage, options); + if (message.productMessage != null && message.hasOwnProperty("productMessage")) + object.productMessage = $root.proto.Message.ProductMessage.toObject(message.productMessage, options); + if (message.deviceSentMessage != null && message.hasOwnProperty("deviceSentMessage")) + object.deviceSentMessage = $root.proto.Message.DeviceSentMessage.toObject(message.deviceSentMessage, options); + if (message.messageContextInfo != null && message.hasOwnProperty("messageContextInfo")) + object.messageContextInfo = $root.proto.MessageContextInfo.toObject(message.messageContextInfo, options); + if (message.listMessage != null && message.hasOwnProperty("listMessage")) + object.listMessage = $root.proto.Message.ListMessage.toObject(message.listMessage, options); + if (message.viewOnceMessage != null && message.hasOwnProperty("viewOnceMessage")) + object.viewOnceMessage = $root.proto.Message.FutureProofMessage.toObject(message.viewOnceMessage, options); + if (message.orderMessage != null && message.hasOwnProperty("orderMessage")) + object.orderMessage = $root.proto.Message.OrderMessage.toObject(message.orderMessage, options); + if (message.listResponseMessage != null && message.hasOwnProperty("listResponseMessage")) + object.listResponseMessage = $root.proto.Message.ListResponseMessage.toObject(message.listResponseMessage, options); + if (message.ephemeralMessage != null && message.hasOwnProperty("ephemeralMessage")) + object.ephemeralMessage = $root.proto.Message.FutureProofMessage.toObject(message.ephemeralMessage, options); + if (message.invoiceMessage != null && message.hasOwnProperty("invoiceMessage")) + object.invoiceMessage = $root.proto.Message.InvoiceMessage.toObject(message.invoiceMessage, options); + if (message.buttonsMessage != null && message.hasOwnProperty("buttonsMessage")) + object.buttonsMessage = $root.proto.Message.ButtonsMessage.toObject(message.buttonsMessage, options); + if (message.buttonsResponseMessage != null && message.hasOwnProperty("buttonsResponseMessage")) + object.buttonsResponseMessage = $root.proto.Message.ButtonsResponseMessage.toObject(message.buttonsResponseMessage, options); + if (message.paymentInviteMessage != null && message.hasOwnProperty("paymentInviteMessage")) + object.paymentInviteMessage = $root.proto.Message.PaymentInviteMessage.toObject(message.paymentInviteMessage, options); + if (message.interactiveMessage != null && message.hasOwnProperty("interactiveMessage")) + object.interactiveMessage = $root.proto.Message.InteractiveMessage.toObject(message.interactiveMessage, options); + if (message.reactionMessage != null && message.hasOwnProperty("reactionMessage")) + object.reactionMessage = $root.proto.Message.ReactionMessage.toObject(message.reactionMessage, options); + if (message.stickerSyncRmrMessage != null && message.hasOwnProperty("stickerSyncRmrMessage")) + object.stickerSyncRmrMessage = $root.proto.Message.StickerSyncRMRMessage.toObject(message.stickerSyncRmrMessage, options); + if (message.interactiveResponseMessage != null && message.hasOwnProperty("interactiveResponseMessage")) + object.interactiveResponseMessage = $root.proto.Message.InteractiveResponseMessage.toObject(message.interactiveResponseMessage, options); + if (message.pollCreationMessage != null && message.hasOwnProperty("pollCreationMessage")) + object.pollCreationMessage = $root.proto.Message.PollCreationMessage.toObject(message.pollCreationMessage, options); + if (message.pollUpdateMessage != null && message.hasOwnProperty("pollUpdateMessage")) + object.pollUpdateMessage = $root.proto.Message.PollUpdateMessage.toObject(message.pollUpdateMessage, options); + if (message.keepInChatMessage != null && message.hasOwnProperty("keepInChatMessage")) + object.keepInChatMessage = $root.proto.Message.KeepInChatMessage.toObject(message.keepInChatMessage, options); + if (message.documentWithCaptionMessage != null && message.hasOwnProperty("documentWithCaptionMessage")) + object.documentWithCaptionMessage = $root.proto.Message.FutureProofMessage.toObject(message.documentWithCaptionMessage, options); + if (message.requestPhoneNumberMessage != null && message.hasOwnProperty("requestPhoneNumberMessage")) + object.requestPhoneNumberMessage = $root.proto.Message.RequestPhoneNumberMessage.toObject(message.requestPhoneNumberMessage, options); + if (message.viewOnceMessageV2 != null && message.hasOwnProperty("viewOnceMessageV2")) + object.viewOnceMessageV2 = $root.proto.Message.FutureProofMessage.toObject(message.viewOnceMessageV2, options); + if (message.encReactionMessage != null && message.hasOwnProperty("encReactionMessage")) + object.encReactionMessage = $root.proto.Message.EncReactionMessage.toObject(message.encReactionMessage, options); + if (message.editedMessage != null && message.hasOwnProperty("editedMessage")) + object.editedMessage = $root.proto.Message.FutureProofMessage.toObject(message.editedMessage, options); + if (message.viewOnceMessageV2Extension != null && message.hasOwnProperty("viewOnceMessageV2Extension")) + object.viewOnceMessageV2Extension = $root.proto.Message.FutureProofMessage.toObject(message.viewOnceMessageV2Extension, options); + if (message.pollCreationMessageV2 != null && message.hasOwnProperty("pollCreationMessageV2")) + object.pollCreationMessageV2 = $root.proto.Message.PollCreationMessage.toObject(message.pollCreationMessageV2, options); + if (message.scheduledCallCreationMessage != null && message.hasOwnProperty("scheduledCallCreationMessage")) + object.scheduledCallCreationMessage = $root.proto.Message.ScheduledCallCreationMessage.toObject(message.scheduledCallCreationMessage, options); + if (message.groupMentionedMessage != null && message.hasOwnProperty("groupMentionedMessage")) + object.groupMentionedMessage = $root.proto.Message.FutureProofMessage.toObject(message.groupMentionedMessage, options); + if (message.pinMessage != null && message.hasOwnProperty("pinMessage")) + object.pinMessage = $root.proto.Message.PinMessage.toObject(message.pinMessage, options); + if (message.pollCreationMessageV3 != null && message.hasOwnProperty("pollCreationMessageV3")) + object.pollCreationMessageV3 = $root.proto.Message.PollCreationMessage.toObject(message.pollCreationMessageV3, options); + if (message.scheduledCallEditMessage != null && message.hasOwnProperty("scheduledCallEditMessage")) + object.scheduledCallEditMessage = $root.proto.Message.ScheduledCallEditMessage.toObject(message.scheduledCallEditMessage, options); + if (message.ptvMessage != null && message.hasOwnProperty("ptvMessage")) + object.ptvMessage = $root.proto.Message.VideoMessage.toObject(message.ptvMessage, options); + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof proto.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Message.AppStateFatalExceptionNotification = (function() { + + /** + * Properties of an AppStateFatalExceptionNotification. + * @memberof proto.Message + * @interface IAppStateFatalExceptionNotification + * @property {Array.|null} [collectionNames] AppStateFatalExceptionNotification collectionNames + * @property {number|Long|null} [timestamp] AppStateFatalExceptionNotification timestamp + */ + + /** + * Constructs a new AppStateFatalExceptionNotification. + * @memberof proto.Message + * @classdesc Represents an AppStateFatalExceptionNotification. + * @implements IAppStateFatalExceptionNotification + * @constructor + * @param {proto.Message.IAppStateFatalExceptionNotification=} [properties] Properties to set + */ + function AppStateFatalExceptionNotification(properties) { + this.collectionNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateFatalExceptionNotification collectionNames. + * @member {Array.} collectionNames + * @memberof proto.Message.AppStateFatalExceptionNotification + * @instance + */ + AppStateFatalExceptionNotification.prototype.collectionNames = $util.emptyArray; + + /** + * AppStateFatalExceptionNotification timestamp. + * @member {number|Long} timestamp + * @memberof proto.Message.AppStateFatalExceptionNotification + * @instance + */ + AppStateFatalExceptionNotification.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new AppStateFatalExceptionNotification instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {proto.Message.IAppStateFatalExceptionNotification=} [properties] Properties to set + * @returns {proto.Message.AppStateFatalExceptionNotification} AppStateFatalExceptionNotification instance + */ + AppStateFatalExceptionNotification.create = function create(properties) { + return new AppStateFatalExceptionNotification(properties); + }; + + /** + * Encodes the specified AppStateFatalExceptionNotification message. Does not implicitly {@link proto.Message.AppStateFatalExceptionNotification.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {proto.Message.IAppStateFatalExceptionNotification} message AppStateFatalExceptionNotification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateFatalExceptionNotification.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.collectionNames != null && message.collectionNames.length) + for (var i = 0; i < message.collectionNames.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.collectionNames[i]); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified AppStateFatalExceptionNotification message, length delimited. Does not implicitly {@link proto.Message.AppStateFatalExceptionNotification.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {proto.Message.IAppStateFatalExceptionNotification} message AppStateFatalExceptionNotification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateFatalExceptionNotification.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateFatalExceptionNotification message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateFatalExceptionNotification} AppStateFatalExceptionNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateFatalExceptionNotification.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateFatalExceptionNotification(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.collectionNames && message.collectionNames.length)) + message.collectionNames = []; + message.collectionNames.push(reader.string()); + break; + case 2: + message.timestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateFatalExceptionNotification message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateFatalExceptionNotification} AppStateFatalExceptionNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateFatalExceptionNotification.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateFatalExceptionNotification message. + * @function verify + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateFatalExceptionNotification.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.collectionNames != null && message.hasOwnProperty("collectionNames")) { + if (!Array.isArray(message.collectionNames)) + return "collectionNames: array expected"; + for (var i = 0; i < message.collectionNames.length; ++i) + if (!$util.isString(message.collectionNames[i])) + return "collectionNames: string[] expected"; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates an AppStateFatalExceptionNotification message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateFatalExceptionNotification} AppStateFatalExceptionNotification + */ + AppStateFatalExceptionNotification.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateFatalExceptionNotification) + return object; + var message = new $root.proto.Message.AppStateFatalExceptionNotification(); + if (object.collectionNames) { + if (!Array.isArray(object.collectionNames)) + throw TypeError(".proto.Message.AppStateFatalExceptionNotification.collectionNames: array expected"); + message.collectionNames = []; + for (var i = 0; i < object.collectionNames.length; ++i) + message.collectionNames[i] = String(object.collectionNames[i]); + } + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an AppStateFatalExceptionNotification message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateFatalExceptionNotification + * @static + * @param {proto.Message.AppStateFatalExceptionNotification} message AppStateFatalExceptionNotification + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateFatalExceptionNotification.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.collectionNames = []; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + if (message.collectionNames && message.collectionNames.length) { + object.collectionNames = []; + for (var j = 0; j < message.collectionNames.length; ++j) + object.collectionNames[j] = message.collectionNames[j]; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + return object; + }; + + /** + * Converts this AppStateFatalExceptionNotification to JSON. + * @function toJSON + * @memberof proto.Message.AppStateFatalExceptionNotification + * @instance + * @returns {Object.} JSON object + */ + AppStateFatalExceptionNotification.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateFatalExceptionNotification; + })(); + + Message.AppStateSyncKey = (function() { + + /** + * Properties of an AppStateSyncKey. + * @memberof proto.Message + * @interface IAppStateSyncKey + * @property {proto.Message.IAppStateSyncKeyId|null} [keyId] AppStateSyncKey keyId + * @property {proto.Message.IAppStateSyncKeyData|null} [keyData] AppStateSyncKey keyData + */ + + /** + * Constructs a new AppStateSyncKey. + * @memberof proto.Message + * @classdesc Represents an AppStateSyncKey. + * @implements IAppStateSyncKey + * @constructor + * @param {proto.Message.IAppStateSyncKey=} [properties] Properties to set + */ + function AppStateSyncKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateSyncKey keyId. + * @member {proto.Message.IAppStateSyncKeyId|null|undefined} keyId + * @memberof proto.Message.AppStateSyncKey + * @instance + */ + AppStateSyncKey.prototype.keyId = null; + + /** + * AppStateSyncKey keyData. + * @member {proto.Message.IAppStateSyncKeyData|null|undefined} keyData + * @memberof proto.Message.AppStateSyncKey + * @instance + */ + AppStateSyncKey.prototype.keyData = null; + + /** + * Creates a new AppStateSyncKey instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {proto.Message.IAppStateSyncKey=} [properties] Properties to set + * @returns {proto.Message.AppStateSyncKey} AppStateSyncKey instance + */ + AppStateSyncKey.create = function create(properties) { + return new AppStateSyncKey(properties); + }; + + /** + * Encodes the specified AppStateSyncKey message. Does not implicitly {@link proto.Message.AppStateSyncKey.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {proto.Message.IAppStateSyncKey} message AppStateSyncKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyId != null && Object.hasOwnProperty.call(message, "keyId")) + $root.proto.Message.AppStateSyncKeyId.encode(message.keyId, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.keyData != null && Object.hasOwnProperty.call(message, "keyData")) + $root.proto.Message.AppStateSyncKeyData.encode(message.keyData, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AppStateSyncKey message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {proto.Message.IAppStateSyncKey} message AppStateSyncKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateSyncKey message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateSyncKey} AppStateSyncKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateSyncKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyId = $root.proto.Message.AppStateSyncKeyId.decode(reader, reader.uint32()); + break; + case 2: + message.keyData = $root.proto.Message.AppStateSyncKeyData.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateSyncKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateSyncKey} AppStateSyncKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateSyncKey message. + * @function verify + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateSyncKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyId != null && message.hasOwnProperty("keyId")) { + var error = $root.proto.Message.AppStateSyncKeyId.verify(message.keyId); + if (error) + return "keyId." + error; + } + if (message.keyData != null && message.hasOwnProperty("keyData")) { + var error = $root.proto.Message.AppStateSyncKeyData.verify(message.keyData); + if (error) + return "keyData." + error; + } + return null; + }; + + /** + * Creates an AppStateSyncKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateSyncKey} AppStateSyncKey + */ + AppStateSyncKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateSyncKey) + return object; + var message = new $root.proto.Message.AppStateSyncKey(); + if (object.keyId != null) { + if (typeof object.keyId !== "object") + throw TypeError(".proto.Message.AppStateSyncKey.keyId: object expected"); + message.keyId = $root.proto.Message.AppStateSyncKeyId.fromObject(object.keyId); + } + if (object.keyData != null) { + if (typeof object.keyData !== "object") + throw TypeError(".proto.Message.AppStateSyncKey.keyData: object expected"); + message.keyData = $root.proto.Message.AppStateSyncKeyData.fromObject(object.keyData); + } + return message; + }; + + /** + * Creates a plain object from an AppStateSyncKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateSyncKey + * @static + * @param {proto.Message.AppStateSyncKey} message AppStateSyncKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateSyncKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.keyId = null; + object.keyData = null; + } + if (message.keyId != null && message.hasOwnProperty("keyId")) + object.keyId = $root.proto.Message.AppStateSyncKeyId.toObject(message.keyId, options); + if (message.keyData != null && message.hasOwnProperty("keyData")) + object.keyData = $root.proto.Message.AppStateSyncKeyData.toObject(message.keyData, options); + return object; + }; + + /** + * Converts this AppStateSyncKey to JSON. + * @function toJSON + * @memberof proto.Message.AppStateSyncKey + * @instance + * @returns {Object.} JSON object + */ + AppStateSyncKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateSyncKey; + })(); + + Message.AppStateSyncKeyData = (function() { + + /** + * Properties of an AppStateSyncKeyData. + * @memberof proto.Message + * @interface IAppStateSyncKeyData + * @property {Uint8Array|null} [keyData] AppStateSyncKeyData keyData + * @property {proto.Message.IAppStateSyncKeyFingerprint|null} [fingerprint] AppStateSyncKeyData fingerprint + * @property {number|Long|null} [timestamp] AppStateSyncKeyData timestamp + */ + + /** + * Constructs a new AppStateSyncKeyData. + * @memberof proto.Message + * @classdesc Represents an AppStateSyncKeyData. + * @implements IAppStateSyncKeyData + * @constructor + * @param {proto.Message.IAppStateSyncKeyData=} [properties] Properties to set + */ + function AppStateSyncKeyData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateSyncKeyData keyData. + * @member {Uint8Array} keyData + * @memberof proto.Message.AppStateSyncKeyData + * @instance + */ + AppStateSyncKeyData.prototype.keyData = $util.newBuffer([]); + + /** + * AppStateSyncKeyData fingerprint. + * @member {proto.Message.IAppStateSyncKeyFingerprint|null|undefined} fingerprint + * @memberof proto.Message.AppStateSyncKeyData + * @instance + */ + AppStateSyncKeyData.prototype.fingerprint = null; + + /** + * AppStateSyncKeyData timestamp. + * @member {number|Long} timestamp + * @memberof proto.Message.AppStateSyncKeyData + * @instance + */ + AppStateSyncKeyData.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new AppStateSyncKeyData instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {proto.Message.IAppStateSyncKeyData=} [properties] Properties to set + * @returns {proto.Message.AppStateSyncKeyData} AppStateSyncKeyData instance + */ + AppStateSyncKeyData.create = function create(properties) { + return new AppStateSyncKeyData(properties); + }; + + /** + * Encodes the specified AppStateSyncKeyData message. Does not implicitly {@link proto.Message.AppStateSyncKeyData.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {proto.Message.IAppStateSyncKeyData} message AppStateSyncKeyData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyData != null && Object.hasOwnProperty.call(message, "keyData")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.keyData); + if (message.fingerprint != null && Object.hasOwnProperty.call(message, "fingerprint")) + $root.proto.Message.AppStateSyncKeyFingerprint.encode(message.fingerprint, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified AppStateSyncKeyData message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {proto.Message.IAppStateSyncKeyData} message AppStateSyncKeyData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateSyncKeyData message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateSyncKeyData} AppStateSyncKeyData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateSyncKeyData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyData = reader.bytes(); + break; + case 2: + message.fingerprint = $root.proto.Message.AppStateSyncKeyFingerprint.decode(reader, reader.uint32()); + break; + case 3: + message.timestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateSyncKeyData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateSyncKeyData} AppStateSyncKeyData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateSyncKeyData message. + * @function verify + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateSyncKeyData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyData != null && message.hasOwnProperty("keyData")) + if (!(message.keyData && typeof message.keyData.length === "number" || $util.isString(message.keyData))) + return "keyData: buffer expected"; + if (message.fingerprint != null && message.hasOwnProperty("fingerprint")) { + var error = $root.proto.Message.AppStateSyncKeyFingerprint.verify(message.fingerprint); + if (error) + return "fingerprint." + error; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates an AppStateSyncKeyData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateSyncKeyData} AppStateSyncKeyData + */ + AppStateSyncKeyData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateSyncKeyData) + return object; + var message = new $root.proto.Message.AppStateSyncKeyData(); + if (object.keyData != null) + if (typeof object.keyData === "string") + $util.base64.decode(object.keyData, message.keyData = $util.newBuffer($util.base64.length(object.keyData)), 0); + else if (object.keyData.length) + message.keyData = object.keyData; + if (object.fingerprint != null) { + if (typeof object.fingerprint !== "object") + throw TypeError(".proto.Message.AppStateSyncKeyData.fingerprint: object expected"); + message.fingerprint = $root.proto.Message.AppStateSyncKeyFingerprint.fromObject(object.fingerprint); + } + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an AppStateSyncKeyData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateSyncKeyData + * @static + * @param {proto.Message.AppStateSyncKeyData} message AppStateSyncKeyData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateSyncKeyData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.keyData = ""; + else { + object.keyData = []; + if (options.bytes !== Array) + object.keyData = $util.newBuffer(object.keyData); + } + object.fingerprint = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.keyData != null && message.hasOwnProperty("keyData")) + object.keyData = options.bytes === String ? $util.base64.encode(message.keyData, 0, message.keyData.length) : options.bytes === Array ? Array.prototype.slice.call(message.keyData) : message.keyData; + if (message.fingerprint != null && message.hasOwnProperty("fingerprint")) + object.fingerprint = $root.proto.Message.AppStateSyncKeyFingerprint.toObject(message.fingerprint, options); + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + return object; + }; + + /** + * Converts this AppStateSyncKeyData to JSON. + * @function toJSON + * @memberof proto.Message.AppStateSyncKeyData + * @instance + * @returns {Object.} JSON object + */ + AppStateSyncKeyData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateSyncKeyData; + })(); + + Message.AppStateSyncKeyFingerprint = (function() { + + /** + * Properties of an AppStateSyncKeyFingerprint. + * @memberof proto.Message + * @interface IAppStateSyncKeyFingerprint + * @property {number|null} [rawId] AppStateSyncKeyFingerprint rawId + * @property {number|null} [currentIndex] AppStateSyncKeyFingerprint currentIndex + * @property {Array.|null} [deviceIndexes] AppStateSyncKeyFingerprint deviceIndexes + */ + + /** + * Constructs a new AppStateSyncKeyFingerprint. + * @memberof proto.Message + * @classdesc Represents an AppStateSyncKeyFingerprint. + * @implements IAppStateSyncKeyFingerprint + * @constructor + * @param {proto.Message.IAppStateSyncKeyFingerprint=} [properties] Properties to set + */ + function AppStateSyncKeyFingerprint(properties) { + this.deviceIndexes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateSyncKeyFingerprint rawId. + * @member {number} rawId + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @instance + */ + AppStateSyncKeyFingerprint.prototype.rawId = 0; + + /** + * AppStateSyncKeyFingerprint currentIndex. + * @member {number} currentIndex + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @instance + */ + AppStateSyncKeyFingerprint.prototype.currentIndex = 0; + + /** + * AppStateSyncKeyFingerprint deviceIndexes. + * @member {Array.} deviceIndexes + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @instance + */ + AppStateSyncKeyFingerprint.prototype.deviceIndexes = $util.emptyArray; + + /** + * Creates a new AppStateSyncKeyFingerprint instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {proto.Message.IAppStateSyncKeyFingerprint=} [properties] Properties to set + * @returns {proto.Message.AppStateSyncKeyFingerprint} AppStateSyncKeyFingerprint instance + */ + AppStateSyncKeyFingerprint.create = function create(properties) { + return new AppStateSyncKeyFingerprint(properties); + }; + + /** + * Encodes the specified AppStateSyncKeyFingerprint message. Does not implicitly {@link proto.Message.AppStateSyncKeyFingerprint.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {proto.Message.IAppStateSyncKeyFingerprint} message AppStateSyncKeyFingerprint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyFingerprint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rawId != null && Object.hasOwnProperty.call(message, "rawId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.rawId); + if (message.currentIndex != null && Object.hasOwnProperty.call(message, "currentIndex")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.currentIndex); + if (message.deviceIndexes != null && message.deviceIndexes.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.deviceIndexes.length; ++i) + writer.uint32(message.deviceIndexes[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified AppStateSyncKeyFingerprint message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyFingerprint.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {proto.Message.IAppStateSyncKeyFingerprint} message AppStateSyncKeyFingerprint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyFingerprint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateSyncKeyFingerprint message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateSyncKeyFingerprint} AppStateSyncKeyFingerprint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyFingerprint.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateSyncKeyFingerprint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rawId = reader.uint32(); + break; + case 2: + message.currentIndex = reader.uint32(); + break; + case 3: + if (!(message.deviceIndexes && message.deviceIndexes.length)) + message.deviceIndexes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.deviceIndexes.push(reader.uint32()); + } else + message.deviceIndexes.push(reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateSyncKeyFingerprint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateSyncKeyFingerprint} AppStateSyncKeyFingerprint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyFingerprint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateSyncKeyFingerprint message. + * @function verify + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateSyncKeyFingerprint.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rawId != null && message.hasOwnProperty("rawId")) + if (!$util.isInteger(message.rawId)) + return "rawId: integer expected"; + if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) + if (!$util.isInteger(message.currentIndex)) + return "currentIndex: integer expected"; + if (message.deviceIndexes != null && message.hasOwnProperty("deviceIndexes")) { + if (!Array.isArray(message.deviceIndexes)) + return "deviceIndexes: array expected"; + for (var i = 0; i < message.deviceIndexes.length; ++i) + if (!$util.isInteger(message.deviceIndexes[i])) + return "deviceIndexes: integer[] expected"; + } + return null; + }; + + /** + * Creates an AppStateSyncKeyFingerprint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateSyncKeyFingerprint} AppStateSyncKeyFingerprint + */ + AppStateSyncKeyFingerprint.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateSyncKeyFingerprint) + return object; + var message = new $root.proto.Message.AppStateSyncKeyFingerprint(); + if (object.rawId != null) + message.rawId = object.rawId >>> 0; + if (object.currentIndex != null) + message.currentIndex = object.currentIndex >>> 0; + if (object.deviceIndexes) { + if (!Array.isArray(object.deviceIndexes)) + throw TypeError(".proto.Message.AppStateSyncKeyFingerprint.deviceIndexes: array expected"); + message.deviceIndexes = []; + for (var i = 0; i < object.deviceIndexes.length; ++i) + message.deviceIndexes[i] = object.deviceIndexes[i] >>> 0; + } + return message; + }; + + /** + * Creates a plain object from an AppStateSyncKeyFingerprint message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @static + * @param {proto.Message.AppStateSyncKeyFingerprint} message AppStateSyncKeyFingerprint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateSyncKeyFingerprint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.deviceIndexes = []; + if (options.defaults) { + object.rawId = 0; + object.currentIndex = 0; + } + if (message.rawId != null && message.hasOwnProperty("rawId")) + object.rawId = message.rawId; + if (message.currentIndex != null && message.hasOwnProperty("currentIndex")) + object.currentIndex = message.currentIndex; + if (message.deviceIndexes && message.deviceIndexes.length) { + object.deviceIndexes = []; + for (var j = 0; j < message.deviceIndexes.length; ++j) + object.deviceIndexes[j] = message.deviceIndexes[j]; + } + return object; + }; + + /** + * Converts this AppStateSyncKeyFingerprint to JSON. + * @function toJSON + * @memberof proto.Message.AppStateSyncKeyFingerprint + * @instance + * @returns {Object.} JSON object + */ + AppStateSyncKeyFingerprint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateSyncKeyFingerprint; + })(); + + Message.AppStateSyncKeyId = (function() { + + /** + * Properties of an AppStateSyncKeyId. + * @memberof proto.Message + * @interface IAppStateSyncKeyId + * @property {Uint8Array|null} [keyId] AppStateSyncKeyId keyId + */ + + /** + * Constructs a new AppStateSyncKeyId. + * @memberof proto.Message + * @classdesc Represents an AppStateSyncKeyId. + * @implements IAppStateSyncKeyId + * @constructor + * @param {proto.Message.IAppStateSyncKeyId=} [properties] Properties to set + */ + function AppStateSyncKeyId(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateSyncKeyId keyId. + * @member {Uint8Array} keyId + * @memberof proto.Message.AppStateSyncKeyId + * @instance + */ + AppStateSyncKeyId.prototype.keyId = $util.newBuffer([]); + + /** + * Creates a new AppStateSyncKeyId instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {proto.Message.IAppStateSyncKeyId=} [properties] Properties to set + * @returns {proto.Message.AppStateSyncKeyId} AppStateSyncKeyId instance + */ + AppStateSyncKeyId.create = function create(properties) { + return new AppStateSyncKeyId(properties); + }; + + /** + * Encodes the specified AppStateSyncKeyId message. Does not implicitly {@link proto.Message.AppStateSyncKeyId.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {proto.Message.IAppStateSyncKeyId} message AppStateSyncKeyId message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyId.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyId != null && Object.hasOwnProperty.call(message, "keyId")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.keyId); + return writer; + }; + + /** + * Encodes the specified AppStateSyncKeyId message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyId.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {proto.Message.IAppStateSyncKeyId} message AppStateSyncKeyId message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyId.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateSyncKeyId message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateSyncKeyId} AppStateSyncKeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyId.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateSyncKeyId(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyId = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateSyncKeyId message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateSyncKeyId} AppStateSyncKeyId + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyId.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateSyncKeyId message. + * @function verify + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateSyncKeyId.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyId != null && message.hasOwnProperty("keyId")) + if (!(message.keyId && typeof message.keyId.length === "number" || $util.isString(message.keyId))) + return "keyId: buffer expected"; + return null; + }; + + /** + * Creates an AppStateSyncKeyId message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateSyncKeyId} AppStateSyncKeyId + */ + AppStateSyncKeyId.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateSyncKeyId) + return object; + var message = new $root.proto.Message.AppStateSyncKeyId(); + if (object.keyId != null) + if (typeof object.keyId === "string") + $util.base64.decode(object.keyId, message.keyId = $util.newBuffer($util.base64.length(object.keyId)), 0); + else if (object.keyId.length) + message.keyId = object.keyId; + return message; + }; + + /** + * Creates a plain object from an AppStateSyncKeyId message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateSyncKeyId + * @static + * @param {proto.Message.AppStateSyncKeyId} message AppStateSyncKeyId + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateSyncKeyId.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.keyId = ""; + else { + object.keyId = []; + if (options.bytes !== Array) + object.keyId = $util.newBuffer(object.keyId); + } + if (message.keyId != null && message.hasOwnProperty("keyId")) + object.keyId = options.bytes === String ? $util.base64.encode(message.keyId, 0, message.keyId.length) : options.bytes === Array ? Array.prototype.slice.call(message.keyId) : message.keyId; + return object; + }; + + /** + * Converts this AppStateSyncKeyId to JSON. + * @function toJSON + * @memberof proto.Message.AppStateSyncKeyId + * @instance + * @returns {Object.} JSON object + */ + AppStateSyncKeyId.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateSyncKeyId; + })(); + + Message.AppStateSyncKeyRequest = (function() { + + /** + * Properties of an AppStateSyncKeyRequest. + * @memberof proto.Message + * @interface IAppStateSyncKeyRequest + * @property {Array.|null} [keyIds] AppStateSyncKeyRequest keyIds + */ + + /** + * Constructs a new AppStateSyncKeyRequest. + * @memberof proto.Message + * @classdesc Represents an AppStateSyncKeyRequest. + * @implements IAppStateSyncKeyRequest + * @constructor + * @param {proto.Message.IAppStateSyncKeyRequest=} [properties] Properties to set + */ + function AppStateSyncKeyRequest(properties) { + this.keyIds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateSyncKeyRequest keyIds. + * @member {Array.} keyIds + * @memberof proto.Message.AppStateSyncKeyRequest + * @instance + */ + AppStateSyncKeyRequest.prototype.keyIds = $util.emptyArray; + + /** + * Creates a new AppStateSyncKeyRequest instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {proto.Message.IAppStateSyncKeyRequest=} [properties] Properties to set + * @returns {proto.Message.AppStateSyncKeyRequest} AppStateSyncKeyRequest instance + */ + AppStateSyncKeyRequest.create = function create(properties) { + return new AppStateSyncKeyRequest(properties); + }; + + /** + * Encodes the specified AppStateSyncKeyRequest message. Does not implicitly {@link proto.Message.AppStateSyncKeyRequest.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {proto.Message.IAppStateSyncKeyRequest} message AppStateSyncKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyIds != null && message.keyIds.length) + for (var i = 0; i < message.keyIds.length; ++i) + $root.proto.Message.AppStateSyncKeyId.encode(message.keyIds[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AppStateSyncKeyRequest message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {proto.Message.IAppStateSyncKeyRequest} message AppStateSyncKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateSyncKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateSyncKeyRequest} AppStateSyncKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateSyncKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.keyIds && message.keyIds.length)) + message.keyIds = []; + message.keyIds.push($root.proto.Message.AppStateSyncKeyId.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateSyncKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateSyncKeyRequest} AppStateSyncKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateSyncKeyRequest message. + * @function verify + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateSyncKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyIds != null && message.hasOwnProperty("keyIds")) { + if (!Array.isArray(message.keyIds)) + return "keyIds: array expected"; + for (var i = 0; i < message.keyIds.length; ++i) { + var error = $root.proto.Message.AppStateSyncKeyId.verify(message.keyIds[i]); + if (error) + return "keyIds." + error; + } + } + return null; + }; + + /** + * Creates an AppStateSyncKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateSyncKeyRequest} AppStateSyncKeyRequest + */ + AppStateSyncKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateSyncKeyRequest) + return object; + var message = new $root.proto.Message.AppStateSyncKeyRequest(); + if (object.keyIds) { + if (!Array.isArray(object.keyIds)) + throw TypeError(".proto.Message.AppStateSyncKeyRequest.keyIds: array expected"); + message.keyIds = []; + for (var i = 0; i < object.keyIds.length; ++i) { + if (typeof object.keyIds[i] !== "object") + throw TypeError(".proto.Message.AppStateSyncKeyRequest.keyIds: object expected"); + message.keyIds[i] = $root.proto.Message.AppStateSyncKeyId.fromObject(object.keyIds[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an AppStateSyncKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateSyncKeyRequest + * @static + * @param {proto.Message.AppStateSyncKeyRequest} message AppStateSyncKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateSyncKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keyIds = []; + if (message.keyIds && message.keyIds.length) { + object.keyIds = []; + for (var j = 0; j < message.keyIds.length; ++j) + object.keyIds[j] = $root.proto.Message.AppStateSyncKeyId.toObject(message.keyIds[j], options); + } + return object; + }; + + /** + * Converts this AppStateSyncKeyRequest to JSON. + * @function toJSON + * @memberof proto.Message.AppStateSyncKeyRequest + * @instance + * @returns {Object.} JSON object + */ + AppStateSyncKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateSyncKeyRequest; + })(); + + Message.AppStateSyncKeyShare = (function() { + + /** + * Properties of an AppStateSyncKeyShare. + * @memberof proto.Message + * @interface IAppStateSyncKeyShare + * @property {Array.|null} [keys] AppStateSyncKeyShare keys + */ + + /** + * Constructs a new AppStateSyncKeyShare. + * @memberof proto.Message + * @classdesc Represents an AppStateSyncKeyShare. + * @implements IAppStateSyncKeyShare + * @constructor + * @param {proto.Message.IAppStateSyncKeyShare=} [properties] Properties to set + */ + function AppStateSyncKeyShare(properties) { + this.keys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AppStateSyncKeyShare keys. + * @member {Array.} keys + * @memberof proto.Message.AppStateSyncKeyShare + * @instance + */ + AppStateSyncKeyShare.prototype.keys = $util.emptyArray; + + /** + * Creates a new AppStateSyncKeyShare instance using the specified properties. + * @function create + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {proto.Message.IAppStateSyncKeyShare=} [properties] Properties to set + * @returns {proto.Message.AppStateSyncKeyShare} AppStateSyncKeyShare instance + */ + AppStateSyncKeyShare.create = function create(properties) { + return new AppStateSyncKeyShare(properties); + }; + + /** + * Encodes the specified AppStateSyncKeyShare message. Does not implicitly {@link proto.Message.AppStateSyncKeyShare.verify|verify} messages. + * @function encode + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {proto.Message.IAppStateSyncKeyShare} message AppStateSyncKeyShare message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyShare.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keys != null && message.keys.length) + for (var i = 0; i < message.keys.length; ++i) + $root.proto.Message.AppStateSyncKey.encode(message.keys[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AppStateSyncKeyShare message, length delimited. Does not implicitly {@link proto.Message.AppStateSyncKeyShare.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {proto.Message.IAppStateSyncKeyShare} message AppStateSyncKeyShare message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppStateSyncKeyShare.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppStateSyncKeyShare message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AppStateSyncKeyShare} AppStateSyncKeyShare + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyShare.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AppStateSyncKeyShare(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.keys && message.keys.length)) + message.keys = []; + message.keys.push($root.proto.Message.AppStateSyncKey.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppStateSyncKeyShare message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AppStateSyncKeyShare} AppStateSyncKeyShare + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppStateSyncKeyShare.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppStateSyncKeyShare message. + * @function verify + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppStateSyncKeyShare.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keys != null && message.hasOwnProperty("keys")) { + if (!Array.isArray(message.keys)) + return "keys: array expected"; + for (var i = 0; i < message.keys.length; ++i) { + var error = $root.proto.Message.AppStateSyncKey.verify(message.keys[i]); + if (error) + return "keys." + error; + } + } + return null; + }; + + /** + * Creates an AppStateSyncKeyShare message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AppStateSyncKeyShare} AppStateSyncKeyShare + */ + AppStateSyncKeyShare.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AppStateSyncKeyShare) + return object; + var message = new $root.proto.Message.AppStateSyncKeyShare(); + if (object.keys) { + if (!Array.isArray(object.keys)) + throw TypeError(".proto.Message.AppStateSyncKeyShare.keys: array expected"); + message.keys = []; + for (var i = 0; i < object.keys.length; ++i) { + if (typeof object.keys[i] !== "object") + throw TypeError(".proto.Message.AppStateSyncKeyShare.keys: object expected"); + message.keys[i] = $root.proto.Message.AppStateSyncKey.fromObject(object.keys[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an AppStateSyncKeyShare message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AppStateSyncKeyShare + * @static + * @param {proto.Message.AppStateSyncKeyShare} message AppStateSyncKeyShare + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppStateSyncKeyShare.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keys = []; + if (message.keys && message.keys.length) { + object.keys = []; + for (var j = 0; j < message.keys.length; ++j) + object.keys[j] = $root.proto.Message.AppStateSyncKey.toObject(message.keys[j], options); + } + return object; + }; + + /** + * Converts this AppStateSyncKeyShare to JSON. + * @function toJSON + * @memberof proto.Message.AppStateSyncKeyShare + * @instance + * @returns {Object.} JSON object + */ + AppStateSyncKeyShare.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AppStateSyncKeyShare; + })(); + + Message.AudioMessage = (function() { + + /** + * Properties of an AudioMessage. + * @memberof proto.Message + * @interface IAudioMessage + * @property {string|null} [url] AudioMessage url + * @property {string|null} [mimetype] AudioMessage mimetype + * @property {Uint8Array|null} [fileSha256] AudioMessage fileSha256 + * @property {number|Long|null} [fileLength] AudioMessage fileLength + * @property {number|null} [seconds] AudioMessage seconds + * @property {boolean|null} [ptt] AudioMessage ptt + * @property {Uint8Array|null} [mediaKey] AudioMessage mediaKey + * @property {Uint8Array|null} [fileEncSha256] AudioMessage fileEncSha256 + * @property {string|null} [directPath] AudioMessage directPath + * @property {number|Long|null} [mediaKeyTimestamp] AudioMessage mediaKeyTimestamp + * @property {proto.IContextInfo|null} [contextInfo] AudioMessage contextInfo + * @property {Uint8Array|null} [streamingSidecar] AudioMessage streamingSidecar + * @property {Uint8Array|null} [waveform] AudioMessage waveform + * @property {number|null} [backgroundArgb] AudioMessage backgroundArgb + * @property {boolean|null} [viewOnce] AudioMessage viewOnce + */ + + /** + * Constructs a new AudioMessage. + * @memberof proto.Message + * @classdesc Represents an AudioMessage. + * @implements IAudioMessage + * @constructor + * @param {proto.Message.IAudioMessage=} [properties] Properties to set + */ + function AudioMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AudioMessage url. + * @member {string} url + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.url = ""; + + /** + * AudioMessage mimetype. + * @member {string} mimetype + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.mimetype = ""; + + /** + * AudioMessage fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.fileSha256 = $util.newBuffer([]); + + /** + * AudioMessage fileLength. + * @member {number|Long} fileLength + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * AudioMessage seconds. + * @member {number} seconds + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.seconds = 0; + + /** + * AudioMessage ptt. + * @member {boolean} ptt + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.ptt = false; + + /** + * AudioMessage mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.mediaKey = $util.newBuffer([]); + + /** + * AudioMessage fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * AudioMessage directPath. + * @member {string} directPath + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.directPath = ""; + + /** + * AudioMessage mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * AudioMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.contextInfo = null; + + /** + * AudioMessage streamingSidecar. + * @member {Uint8Array} streamingSidecar + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.streamingSidecar = $util.newBuffer([]); + + /** + * AudioMessage waveform. + * @member {Uint8Array} waveform + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.waveform = $util.newBuffer([]); + + /** + * AudioMessage backgroundArgb. + * @member {number} backgroundArgb + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.backgroundArgb = 0; + + /** + * AudioMessage viewOnce. + * @member {boolean} viewOnce + * @memberof proto.Message.AudioMessage + * @instance + */ + AudioMessage.prototype.viewOnce = false; + + /** + * Creates a new AudioMessage instance using the specified properties. + * @function create + * @memberof proto.Message.AudioMessage + * @static + * @param {proto.Message.IAudioMessage=} [properties] Properties to set + * @returns {proto.Message.AudioMessage} AudioMessage instance + */ + AudioMessage.create = function create(properties) { + return new AudioMessage(properties); + }; + + /** + * Encodes the specified AudioMessage message. Does not implicitly {@link proto.Message.AudioMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.AudioMessage + * @static + * @param {proto.Message.IAudioMessage} message AudioMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AudioMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimetype); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.fileSha256); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.fileLength); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.seconds); + if (message.ptt != null && Object.hasOwnProperty.call(message, "ptt")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.ptt); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.mediaKey); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.fileEncSha256); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.directPath); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.mediaKeyTimestamp); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.streamingSidecar != null && Object.hasOwnProperty.call(message, "streamingSidecar")) + writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.streamingSidecar); + if (message.waveform != null && Object.hasOwnProperty.call(message, "waveform")) + writer.uint32(/* id 19, wireType 2 =*/154).bytes(message.waveform); + if (message.backgroundArgb != null && Object.hasOwnProperty.call(message, "backgroundArgb")) + writer.uint32(/* id 20, wireType 5 =*/165).fixed32(message.backgroundArgb); + if (message.viewOnce != null && Object.hasOwnProperty.call(message, "viewOnce")) + writer.uint32(/* id 21, wireType 0 =*/168).bool(message.viewOnce); + return writer; + }; + + /** + * Encodes the specified AudioMessage message, length delimited. Does not implicitly {@link proto.Message.AudioMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.AudioMessage + * @static + * @param {proto.Message.IAudioMessage} message AudioMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AudioMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AudioMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.AudioMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.AudioMessage} AudioMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AudioMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.AudioMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.mimetype = reader.string(); + break; + case 3: + message.fileSha256 = reader.bytes(); + break; + case 4: + message.fileLength = reader.uint64(); + break; + case 5: + message.seconds = reader.uint32(); + break; + case 6: + message.ptt = reader.bool(); + break; + case 7: + message.mediaKey = reader.bytes(); + break; + case 8: + message.fileEncSha256 = reader.bytes(); + break; + case 9: + message.directPath = reader.string(); + break; + case 10: + message.mediaKeyTimestamp = reader.int64(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 18: + message.streamingSidecar = reader.bytes(); + break; + case 19: + message.waveform = reader.bytes(); + break; + case 20: + message.backgroundArgb = reader.fixed32(); + break; + case 21: + message.viewOnce = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AudioMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.AudioMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.AudioMessage} AudioMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AudioMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AudioMessage message. + * @function verify + * @memberof proto.Message.AudioMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AudioMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds)) + return "seconds: integer expected"; + if (message.ptt != null && message.hasOwnProperty("ptt")) + if (typeof message.ptt !== "boolean") + return "ptt: boolean expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.streamingSidecar != null && message.hasOwnProperty("streamingSidecar")) + if (!(message.streamingSidecar && typeof message.streamingSidecar.length === "number" || $util.isString(message.streamingSidecar))) + return "streamingSidecar: buffer expected"; + if (message.waveform != null && message.hasOwnProperty("waveform")) + if (!(message.waveform && typeof message.waveform.length === "number" || $util.isString(message.waveform))) + return "waveform: buffer expected"; + if (message.backgroundArgb != null && message.hasOwnProperty("backgroundArgb")) + if (!$util.isInteger(message.backgroundArgb)) + return "backgroundArgb: integer expected"; + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + if (typeof message.viewOnce !== "boolean") + return "viewOnce: boolean expected"; + return null; + }; + + /** + * Creates an AudioMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.AudioMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.AudioMessage} AudioMessage + */ + AudioMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.AudioMessage) + return object; + var message = new $root.proto.Message.AudioMessage(); + if (object.url != null) + message.url = String(object.url); + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.seconds != null) + message.seconds = object.seconds >>> 0; + if (object.ptt != null) + message.ptt = Boolean(object.ptt); + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.AudioMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.streamingSidecar != null) + if (typeof object.streamingSidecar === "string") + $util.base64.decode(object.streamingSidecar, message.streamingSidecar = $util.newBuffer($util.base64.length(object.streamingSidecar)), 0); + else if (object.streamingSidecar.length) + message.streamingSidecar = object.streamingSidecar; + if (object.waveform != null) + if (typeof object.waveform === "string") + $util.base64.decode(object.waveform, message.waveform = $util.newBuffer($util.base64.length(object.waveform)), 0); + else if (object.waveform.length) + message.waveform = object.waveform; + if (object.backgroundArgb != null) + message.backgroundArgb = object.backgroundArgb >>> 0; + if (object.viewOnce != null) + message.viewOnce = Boolean(object.viewOnce); + return message; + }; + + /** + * Creates a plain object from an AudioMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.AudioMessage + * @static + * @param {proto.Message.AudioMessage} message AudioMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AudioMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.mimetype = ""; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.seconds = 0; + object.ptt = false; + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + object.contextInfo = null; + if (options.bytes === String) + object.streamingSidecar = ""; + else { + object.streamingSidecar = []; + if (options.bytes !== Array) + object.streamingSidecar = $util.newBuffer(object.streamingSidecar); + } + if (options.bytes === String) + object.waveform = ""; + else { + object.waveform = []; + if (options.bytes !== Array) + object.waveform = $util.newBuffer(object.waveform); + } + object.backgroundArgb = 0; + object.viewOnce = false; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.seconds != null && message.hasOwnProperty("seconds")) + object.seconds = message.seconds; + if (message.ptt != null && message.hasOwnProperty("ptt")) + object.ptt = message.ptt; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.streamingSidecar != null && message.hasOwnProperty("streamingSidecar")) + object.streamingSidecar = options.bytes === String ? $util.base64.encode(message.streamingSidecar, 0, message.streamingSidecar.length) : options.bytes === Array ? Array.prototype.slice.call(message.streamingSidecar) : message.streamingSidecar; + if (message.waveform != null && message.hasOwnProperty("waveform")) + object.waveform = options.bytes === String ? $util.base64.encode(message.waveform, 0, message.waveform.length) : options.bytes === Array ? Array.prototype.slice.call(message.waveform) : message.waveform; + if (message.backgroundArgb != null && message.hasOwnProperty("backgroundArgb")) + object.backgroundArgb = message.backgroundArgb; + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + object.viewOnce = message.viewOnce; + return object; + }; + + /** + * Converts this AudioMessage to JSON. + * @function toJSON + * @memberof proto.Message.AudioMessage + * @instance + * @returns {Object.} JSON object + */ + AudioMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AudioMessage; + })(); + + Message.ButtonsMessage = (function() { + + /** + * Properties of a ButtonsMessage. + * @memberof proto.Message + * @interface IButtonsMessage + * @property {string|null} [contentText] ButtonsMessage contentText + * @property {string|null} [footerText] ButtonsMessage footerText + * @property {proto.IContextInfo|null} [contextInfo] ButtonsMessage contextInfo + * @property {Array.|null} [buttons] ButtonsMessage buttons + * @property {proto.Message.ButtonsMessage.HeaderType|null} [headerType] ButtonsMessage headerType + * @property {string|null} [text] ButtonsMessage text + * @property {proto.Message.IDocumentMessage|null} [documentMessage] ButtonsMessage documentMessage + * @property {proto.Message.IImageMessage|null} [imageMessage] ButtonsMessage imageMessage + * @property {proto.Message.IVideoMessage|null} [videoMessage] ButtonsMessage videoMessage + * @property {proto.Message.ILocationMessage|null} [locationMessage] ButtonsMessage locationMessage + */ + + /** + * Constructs a new ButtonsMessage. + * @memberof proto.Message + * @classdesc Represents a ButtonsMessage. + * @implements IButtonsMessage + * @constructor + * @param {proto.Message.IButtonsMessage=} [properties] Properties to set + */ + function ButtonsMessage(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ButtonsMessage contentText. + * @member {string} contentText + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.contentText = ""; + + /** + * ButtonsMessage footerText. + * @member {string} footerText + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.footerText = ""; + + /** + * ButtonsMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.contextInfo = null; + + /** + * ButtonsMessage buttons. + * @member {Array.} buttons + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.buttons = $util.emptyArray; + + /** + * ButtonsMessage headerType. + * @member {proto.Message.ButtonsMessage.HeaderType} headerType + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.headerType = 0; + + /** + * ButtonsMessage text. + * @member {string|null|undefined} text + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.text = null; + + /** + * ButtonsMessage documentMessage. + * @member {proto.Message.IDocumentMessage|null|undefined} documentMessage + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.documentMessage = null; + + /** + * ButtonsMessage imageMessage. + * @member {proto.Message.IImageMessage|null|undefined} imageMessage + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.imageMessage = null; + + /** + * ButtonsMessage videoMessage. + * @member {proto.Message.IVideoMessage|null|undefined} videoMessage + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.videoMessage = null; + + /** + * ButtonsMessage locationMessage. + * @member {proto.Message.ILocationMessage|null|undefined} locationMessage + * @memberof proto.Message.ButtonsMessage + * @instance + */ + ButtonsMessage.prototype.locationMessage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ButtonsMessage header. + * @member {"text"|"documentMessage"|"imageMessage"|"videoMessage"|"locationMessage"|undefined} header + * @memberof proto.Message.ButtonsMessage + * @instance + */ + Object.defineProperty(ButtonsMessage.prototype, "header", { + get: $util.oneOfGetter($oneOfFields = ["text", "documentMessage", "imageMessage", "videoMessage", "locationMessage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ButtonsMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ButtonsMessage + * @static + * @param {proto.Message.IButtonsMessage=} [properties] Properties to set + * @returns {proto.Message.ButtonsMessage} ButtonsMessage instance + */ + ButtonsMessage.create = function create(properties) { + return new ButtonsMessage(properties); + }; + + /** + * Encodes the specified ButtonsMessage message. Does not implicitly {@link proto.Message.ButtonsMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ButtonsMessage + * @static + * @param {proto.Message.IButtonsMessage} message ButtonsMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ButtonsMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.documentMessage != null && Object.hasOwnProperty.call(message, "documentMessage")) + $root.proto.Message.DocumentMessage.encode(message.documentMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageMessage != null && Object.hasOwnProperty.call(message, "imageMessage")) + $root.proto.Message.ImageMessage.encode(message.imageMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.videoMessage != null && Object.hasOwnProperty.call(message, "videoMessage")) + $root.proto.Message.VideoMessage.encode(message.videoMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.locationMessage != null && Object.hasOwnProperty.call(message, "locationMessage")) + $root.proto.Message.LocationMessage.encode(message.locationMessage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.contentText != null && Object.hasOwnProperty.call(message, "contentText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.contentText); + if (message.footerText != null && Object.hasOwnProperty.call(message, "footerText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.footerText); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.proto.Message.ButtonsMessage.Button.encode(message.buttons[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.headerType != null && Object.hasOwnProperty.call(message, "headerType")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.headerType); + return writer; + }; + + /** + * Encodes the specified ButtonsMessage message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ButtonsMessage + * @static + * @param {proto.Message.IButtonsMessage} message ButtonsMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ButtonsMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ButtonsMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ButtonsMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ButtonsMessage} ButtonsMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ButtonsMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ButtonsMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.contentText = reader.string(); + break; + case 7: + message.footerText = reader.string(); + break; + case 8: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.proto.Message.ButtonsMessage.Button.decode(reader, reader.uint32())); + break; + case 10: + message.headerType = reader.int32(); + break; + case 1: + message.text = reader.string(); + break; + case 2: + message.documentMessage = $root.proto.Message.DocumentMessage.decode(reader, reader.uint32()); + break; + case 3: + message.imageMessage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 4: + message.videoMessage = $root.proto.Message.VideoMessage.decode(reader, reader.uint32()); + break; + case 5: + message.locationMessage = $root.proto.Message.LocationMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ButtonsMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ButtonsMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ButtonsMessage} ButtonsMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ButtonsMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ButtonsMessage message. + * @function verify + * @memberof proto.Message.ButtonsMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ButtonsMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.contentText != null && message.hasOwnProperty("contentText")) + if (!$util.isString(message.contentText)) + return "contentText: string expected"; + if (message.footerText != null && message.hasOwnProperty("footerText")) + if (!$util.isString(message.footerText)) + return "footerText: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.proto.Message.ButtonsMessage.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + if (message.headerType != null && message.hasOwnProperty("headerType")) + switch (message.headerType) { + default: + return "headerType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.text != null && message.hasOwnProperty("text")) { + properties.header = 1; + if (!$util.isString(message.text)) + return "text: string expected"; + } + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + if (properties.header === 1) + return "header: multiple values"; + properties.header = 1; + { + var error = $root.proto.Message.DocumentMessage.verify(message.documentMessage); + if (error) + return "documentMessage." + error; + } + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + if (properties.header === 1) + return "header: multiple values"; + properties.header = 1; + { + var error = $root.proto.Message.ImageMessage.verify(message.imageMessage); + if (error) + return "imageMessage." + error; + } + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + if (properties.header === 1) + return "header: multiple values"; + properties.header = 1; + { + var error = $root.proto.Message.VideoMessage.verify(message.videoMessage); + if (error) + return "videoMessage." + error; + } + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + if (properties.header === 1) + return "header: multiple values"; + properties.header = 1; + { + var error = $root.proto.Message.LocationMessage.verify(message.locationMessage); + if (error) + return "locationMessage." + error; + } + } + return null; + }; + + /** + * Creates a ButtonsMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ButtonsMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ButtonsMessage} ButtonsMessage + */ + ButtonsMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ButtonsMessage) + return object; + var message = new $root.proto.Message.ButtonsMessage(); + if (object.contentText != null) + message.contentText = String(object.contentText); + if (object.footerText != null) + message.footerText = String(object.footerText); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ButtonsMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".proto.Message.ButtonsMessage.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".proto.Message.ButtonsMessage.buttons: object expected"); + message.buttons[i] = $root.proto.Message.ButtonsMessage.Button.fromObject(object.buttons[i]); + } + } + switch (object.headerType) { + case "UNKNOWN": + case 0: + message.headerType = 0; + break; + case "EMPTY": + case 1: + message.headerType = 1; + break; + case "TEXT": + case 2: + message.headerType = 2; + break; + case "DOCUMENT": + case 3: + message.headerType = 3; + break; + case "IMAGE": + case 4: + message.headerType = 4; + break; + case "VIDEO": + case 5: + message.headerType = 5; + break; + case "LOCATION": + case 6: + message.headerType = 6; + break; + } + if (object.text != null) + message.text = String(object.text); + if (object.documentMessage != null) { + if (typeof object.documentMessage !== "object") + throw TypeError(".proto.Message.ButtonsMessage.documentMessage: object expected"); + message.documentMessage = $root.proto.Message.DocumentMessage.fromObject(object.documentMessage); + } + if (object.imageMessage != null) { + if (typeof object.imageMessage !== "object") + throw TypeError(".proto.Message.ButtonsMessage.imageMessage: object expected"); + message.imageMessage = $root.proto.Message.ImageMessage.fromObject(object.imageMessage); + } + if (object.videoMessage != null) { + if (typeof object.videoMessage !== "object") + throw TypeError(".proto.Message.ButtonsMessage.videoMessage: object expected"); + message.videoMessage = $root.proto.Message.VideoMessage.fromObject(object.videoMessage); + } + if (object.locationMessage != null) { + if (typeof object.locationMessage !== "object") + throw TypeError(".proto.Message.ButtonsMessage.locationMessage: object expected"); + message.locationMessage = $root.proto.Message.LocationMessage.fromObject(object.locationMessage); + } + return message; + }; + + /** + * Creates a plain object from a ButtonsMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ButtonsMessage + * @static + * @param {proto.Message.ButtonsMessage} message ButtonsMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ButtonsMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.contentText = ""; + object.footerText = ""; + object.contextInfo = null; + object.headerType = options.enums === String ? "UNKNOWN" : 0; + } + if (message.text != null && message.hasOwnProperty("text")) { + object.text = message.text; + if (options.oneofs) + object.header = "text"; + } + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + object.documentMessage = $root.proto.Message.DocumentMessage.toObject(message.documentMessage, options); + if (options.oneofs) + object.header = "documentMessage"; + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + object.imageMessage = $root.proto.Message.ImageMessage.toObject(message.imageMessage, options); + if (options.oneofs) + object.header = "imageMessage"; + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + object.videoMessage = $root.proto.Message.VideoMessage.toObject(message.videoMessage, options); + if (options.oneofs) + object.header = "videoMessage"; + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + object.locationMessage = $root.proto.Message.LocationMessage.toObject(message.locationMessage, options); + if (options.oneofs) + object.header = "locationMessage"; + } + if (message.contentText != null && message.hasOwnProperty("contentText")) + object.contentText = message.contentText; + if (message.footerText != null && message.hasOwnProperty("footerText")) + object.footerText = message.footerText; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.proto.Message.ButtonsMessage.Button.toObject(message.buttons[j], options); + } + if (message.headerType != null && message.hasOwnProperty("headerType")) + object.headerType = options.enums === String ? $root.proto.Message.ButtonsMessage.HeaderType[message.headerType] : message.headerType; + return object; + }; + + /** + * Converts this ButtonsMessage to JSON. + * @function toJSON + * @memberof proto.Message.ButtonsMessage + * @instance + * @returns {Object.} JSON object + */ + ButtonsMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ButtonsMessage.Button = (function() { + + /** + * Properties of a Button. + * @memberof proto.Message.ButtonsMessage + * @interface IButton + * @property {string|null} [buttonId] Button buttonId + * @property {proto.Message.ButtonsMessage.Button.IButtonText|null} [buttonText] Button buttonText + * @property {proto.Message.ButtonsMessage.Button.Type|null} [type] Button type + * @property {proto.Message.ButtonsMessage.Button.INativeFlowInfo|null} [nativeFlowInfo] Button nativeFlowInfo + */ + + /** + * Constructs a new Button. + * @memberof proto.Message.ButtonsMessage + * @classdesc Represents a Button. + * @implements IButton + * @constructor + * @param {proto.Message.ButtonsMessage.IButton=} [properties] Properties to set + */ + function Button(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Button buttonId. + * @member {string} buttonId + * @memberof proto.Message.ButtonsMessage.Button + * @instance + */ + Button.prototype.buttonId = ""; + + /** + * Button buttonText. + * @member {proto.Message.ButtonsMessage.Button.IButtonText|null|undefined} buttonText + * @memberof proto.Message.ButtonsMessage.Button + * @instance + */ + Button.prototype.buttonText = null; + + /** + * Button type. + * @member {proto.Message.ButtonsMessage.Button.Type} type + * @memberof proto.Message.ButtonsMessage.Button + * @instance + */ + Button.prototype.type = 0; + + /** + * Button nativeFlowInfo. + * @member {proto.Message.ButtonsMessage.Button.INativeFlowInfo|null|undefined} nativeFlowInfo + * @memberof proto.Message.ButtonsMessage.Button + * @instance + */ + Button.prototype.nativeFlowInfo = null; + + /** + * Creates a new Button instance using the specified properties. + * @function create + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {proto.Message.ButtonsMessage.IButton=} [properties] Properties to set + * @returns {proto.Message.ButtonsMessage.Button} Button instance + */ + Button.create = function create(properties) { + return new Button(properties); + }; + + /** + * Encodes the specified Button message. Does not implicitly {@link proto.Message.ButtonsMessage.Button.verify|verify} messages. + * @function encode + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {proto.Message.ButtonsMessage.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.buttonId != null && Object.hasOwnProperty.call(message, "buttonId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.buttonId); + if (message.buttonText != null && Object.hasOwnProperty.call(message, "buttonText")) + $root.proto.Message.ButtonsMessage.Button.ButtonText.encode(message.buttonText, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.nativeFlowInfo != null && Object.hasOwnProperty.call(message, "nativeFlowInfo")) + $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo.encode(message.nativeFlowInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.Button.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {proto.Message.ButtonsMessage.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Button message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ButtonsMessage.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ButtonsMessage.Button(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.buttonId = reader.string(); + break; + case 2: + message.buttonText = $root.proto.Message.ButtonsMessage.Button.ButtonText.decode(reader, reader.uint32()); + break; + case 3: + message.type = reader.int32(); + break; + case 4: + message.nativeFlowInfo = $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ButtonsMessage.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Button message. + * @function verify + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Button.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.buttonId != null && message.hasOwnProperty("buttonId")) + if (!$util.isString(message.buttonId)) + return "buttonId: string expected"; + if (message.buttonText != null && message.hasOwnProperty("buttonText")) { + var error = $root.proto.Message.ButtonsMessage.Button.ButtonText.verify(message.buttonText); + if (error) + return "buttonText." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.nativeFlowInfo != null && message.hasOwnProperty("nativeFlowInfo")) { + var error = $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo.verify(message.nativeFlowInfo); + if (error) + return "nativeFlowInfo." + error; + } + return null; + }; + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ButtonsMessage.Button} Button + */ + Button.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ButtonsMessage.Button) + return object; + var message = new $root.proto.Message.ButtonsMessage.Button(); + if (object.buttonId != null) + message.buttonId = String(object.buttonId); + if (object.buttonText != null) { + if (typeof object.buttonText !== "object") + throw TypeError(".proto.Message.ButtonsMessage.Button.buttonText: object expected"); + message.buttonText = $root.proto.Message.ButtonsMessage.Button.ButtonText.fromObject(object.buttonText); + } + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "RESPONSE": + case 1: + message.type = 1; + break; + case "NATIVE_FLOW": + case 2: + message.type = 2; + break; + } + if (object.nativeFlowInfo != null) { + if (typeof object.nativeFlowInfo !== "object") + throw TypeError(".proto.Message.ButtonsMessage.Button.nativeFlowInfo: object expected"); + message.nativeFlowInfo = $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo.fromObject(object.nativeFlowInfo); + } + return message; + }; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ButtonsMessage.Button + * @static + * @param {proto.Message.ButtonsMessage.Button} message Button + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Button.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.buttonId = ""; + object.buttonText = null; + object.type = options.enums === String ? "UNKNOWN" : 0; + object.nativeFlowInfo = null; + } + if (message.buttonId != null && message.hasOwnProperty("buttonId")) + object.buttonId = message.buttonId; + if (message.buttonText != null && message.hasOwnProperty("buttonText")) + object.buttonText = $root.proto.Message.ButtonsMessage.Button.ButtonText.toObject(message.buttonText, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.proto.Message.ButtonsMessage.Button.Type[message.type] : message.type; + if (message.nativeFlowInfo != null && message.hasOwnProperty("nativeFlowInfo")) + object.nativeFlowInfo = $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo.toObject(message.nativeFlowInfo, options); + return object; + }; + + /** + * Converts this Button to JSON. + * @function toJSON + * @memberof proto.Message.ButtonsMessage.Button + * @instance + * @returns {Object.} JSON object + */ + Button.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Button.ButtonText = (function() { + + /** + * Properties of a ButtonText. + * @memberof proto.Message.ButtonsMessage.Button + * @interface IButtonText + * @property {string|null} [displayText] ButtonText displayText + */ + + /** + * Constructs a new ButtonText. + * @memberof proto.Message.ButtonsMessage.Button + * @classdesc Represents a ButtonText. + * @implements IButtonText + * @constructor + * @param {proto.Message.ButtonsMessage.Button.IButtonText=} [properties] Properties to set + */ + function ButtonText(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ButtonText displayText. + * @member {string} displayText + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @instance + */ + ButtonText.prototype.displayText = ""; + + /** + * Creates a new ButtonText instance using the specified properties. + * @function create + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {proto.Message.ButtonsMessage.Button.IButtonText=} [properties] Properties to set + * @returns {proto.Message.ButtonsMessage.Button.ButtonText} ButtonText instance + */ + ButtonText.create = function create(properties) { + return new ButtonText(properties); + }; + + /** + * Encodes the specified ButtonText message. Does not implicitly {@link proto.Message.ButtonsMessage.Button.ButtonText.verify|verify} messages. + * @function encode + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {proto.Message.ButtonsMessage.Button.IButtonText} message ButtonText message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ButtonText.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayText); + return writer; + }; + + /** + * Encodes the specified ButtonText message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.Button.ButtonText.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {proto.Message.ButtonsMessage.Button.IButtonText} message ButtonText message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ButtonText.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ButtonText message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ButtonsMessage.Button.ButtonText} ButtonText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ButtonText.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ButtonsMessage.Button.ButtonText(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ButtonText message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ButtonsMessage.Button.ButtonText} ButtonText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ButtonText.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ButtonText message. + * @function verify + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ButtonText.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) + if (!$util.isString(message.displayText)) + return "displayText: string expected"; + return null; + }; + + /** + * Creates a ButtonText message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ButtonsMessage.Button.ButtonText} ButtonText + */ + ButtonText.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ButtonsMessage.Button.ButtonText) + return object; + var message = new $root.proto.Message.ButtonsMessage.Button.ButtonText(); + if (object.displayText != null) + message.displayText = String(object.displayText); + return message; + }; + + /** + * Creates a plain object from a ButtonText message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @static + * @param {proto.Message.ButtonsMessage.Button.ButtonText} message ButtonText + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ButtonText.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.displayText = ""; + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = message.displayText; + return object; + }; + + /** + * Converts this ButtonText to JSON. + * @function toJSON + * @memberof proto.Message.ButtonsMessage.Button.ButtonText + * @instance + * @returns {Object.} JSON object + */ + ButtonText.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ButtonText; + })(); + + Button.NativeFlowInfo = (function() { + + /** + * Properties of a NativeFlowInfo. + * @memberof proto.Message.ButtonsMessage.Button + * @interface INativeFlowInfo + * @property {string|null} [name] NativeFlowInfo name + * @property {string|null} [paramsJson] NativeFlowInfo paramsJson + */ + + /** + * Constructs a new NativeFlowInfo. + * @memberof proto.Message.ButtonsMessage.Button + * @classdesc Represents a NativeFlowInfo. + * @implements INativeFlowInfo + * @constructor + * @param {proto.Message.ButtonsMessage.Button.INativeFlowInfo=} [properties] Properties to set + */ + function NativeFlowInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NativeFlowInfo name. + * @member {string} name + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @instance + */ + NativeFlowInfo.prototype.name = ""; + + /** + * NativeFlowInfo paramsJson. + * @member {string} paramsJson + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @instance + */ + NativeFlowInfo.prototype.paramsJson = ""; + + /** + * Creates a new NativeFlowInfo instance using the specified properties. + * @function create + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {proto.Message.ButtonsMessage.Button.INativeFlowInfo=} [properties] Properties to set + * @returns {proto.Message.ButtonsMessage.Button.NativeFlowInfo} NativeFlowInfo instance + */ + NativeFlowInfo.create = function create(properties) { + return new NativeFlowInfo(properties); + }; + + /** + * Encodes the specified NativeFlowInfo message. Does not implicitly {@link proto.Message.ButtonsMessage.Button.NativeFlowInfo.verify|verify} messages. + * @function encode + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {proto.Message.ButtonsMessage.Button.INativeFlowInfo} message NativeFlowInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.paramsJson != null && Object.hasOwnProperty.call(message, "paramsJson")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.paramsJson); + return writer; + }; + + /** + * Encodes the specified NativeFlowInfo message, length delimited. Does not implicitly {@link proto.Message.ButtonsMessage.Button.NativeFlowInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {proto.Message.ButtonsMessage.Button.INativeFlowInfo} message NativeFlowInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NativeFlowInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ButtonsMessage.Button.NativeFlowInfo} NativeFlowInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.paramsJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NativeFlowInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ButtonsMessage.Button.NativeFlowInfo} NativeFlowInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NativeFlowInfo message. + * @function verify + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NativeFlowInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.paramsJson != null && message.hasOwnProperty("paramsJson")) + if (!$util.isString(message.paramsJson)) + return "paramsJson: string expected"; + return null; + }; + + /** + * Creates a NativeFlowInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ButtonsMessage.Button.NativeFlowInfo} NativeFlowInfo + */ + NativeFlowInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo) + return object; + var message = new $root.proto.Message.ButtonsMessage.Button.NativeFlowInfo(); + if (object.name != null) + message.name = String(object.name); + if (object.paramsJson != null) + message.paramsJson = String(object.paramsJson); + return message; + }; + + /** + * Creates a plain object from a NativeFlowInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @static + * @param {proto.Message.ButtonsMessage.Button.NativeFlowInfo} message NativeFlowInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NativeFlowInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.paramsJson = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.paramsJson != null && message.hasOwnProperty("paramsJson")) + object.paramsJson = message.paramsJson; + return object; + }; + + /** + * Converts this NativeFlowInfo to JSON. + * @function toJSON + * @memberof proto.Message.ButtonsMessage.Button.NativeFlowInfo + * @instance + * @returns {Object.} JSON object + */ + NativeFlowInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NativeFlowInfo; + })(); + + /** + * Type enum. + * @name proto.Message.ButtonsMessage.Button.Type + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} RESPONSE=1 RESPONSE value + * @property {number} NATIVE_FLOW=2 NATIVE_FLOW value + */ + Button.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "RESPONSE"] = 1; + values[valuesById[2] = "NATIVE_FLOW"] = 2; + return values; + })(); + + return Button; + })(); + + /** + * HeaderType enum. + * @name proto.Message.ButtonsMessage.HeaderType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} EMPTY=1 EMPTY value + * @property {number} TEXT=2 TEXT value + * @property {number} DOCUMENT=3 DOCUMENT value + * @property {number} IMAGE=4 IMAGE value + * @property {number} VIDEO=5 VIDEO value + * @property {number} LOCATION=6 LOCATION value + */ + ButtonsMessage.HeaderType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "EMPTY"] = 1; + values[valuesById[2] = "TEXT"] = 2; + values[valuesById[3] = "DOCUMENT"] = 3; + values[valuesById[4] = "IMAGE"] = 4; + values[valuesById[5] = "VIDEO"] = 5; + values[valuesById[6] = "LOCATION"] = 6; + return values; + })(); + + return ButtonsMessage; + })(); + + Message.ButtonsResponseMessage = (function() { + + /** + * Properties of a ButtonsResponseMessage. + * @memberof proto.Message + * @interface IButtonsResponseMessage + * @property {string|null} [selectedButtonId] ButtonsResponseMessage selectedButtonId + * @property {proto.IContextInfo|null} [contextInfo] ButtonsResponseMessage contextInfo + * @property {proto.Message.ButtonsResponseMessage.Type|null} [type] ButtonsResponseMessage type + * @property {string|null} [selectedDisplayText] ButtonsResponseMessage selectedDisplayText + */ + + /** + * Constructs a new ButtonsResponseMessage. + * @memberof proto.Message + * @classdesc Represents a ButtonsResponseMessage. + * @implements IButtonsResponseMessage + * @constructor + * @param {proto.Message.IButtonsResponseMessage=} [properties] Properties to set + */ + function ButtonsResponseMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ButtonsResponseMessage selectedButtonId. + * @member {string} selectedButtonId + * @memberof proto.Message.ButtonsResponseMessage + * @instance + */ + ButtonsResponseMessage.prototype.selectedButtonId = ""; + + /** + * ButtonsResponseMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ButtonsResponseMessage + * @instance + */ + ButtonsResponseMessage.prototype.contextInfo = null; + + /** + * ButtonsResponseMessage type. + * @member {proto.Message.ButtonsResponseMessage.Type} type + * @memberof proto.Message.ButtonsResponseMessage + * @instance + */ + ButtonsResponseMessage.prototype.type = 0; + + /** + * ButtonsResponseMessage selectedDisplayText. + * @member {string|null|undefined} selectedDisplayText + * @memberof proto.Message.ButtonsResponseMessage + * @instance + */ + ButtonsResponseMessage.prototype.selectedDisplayText = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ButtonsResponseMessage response. + * @member {"selectedDisplayText"|undefined} response + * @memberof proto.Message.ButtonsResponseMessage + * @instance + */ + Object.defineProperty(ButtonsResponseMessage.prototype, "response", { + get: $util.oneOfGetter($oneOfFields = ["selectedDisplayText"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ButtonsResponseMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {proto.Message.IButtonsResponseMessage=} [properties] Properties to set + * @returns {proto.Message.ButtonsResponseMessage} ButtonsResponseMessage instance + */ + ButtonsResponseMessage.create = function create(properties) { + return new ButtonsResponseMessage(properties); + }; + + /** + * Encodes the specified ButtonsResponseMessage message. Does not implicitly {@link proto.Message.ButtonsResponseMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {proto.Message.IButtonsResponseMessage} message ButtonsResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ButtonsResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selectedButtonId != null && Object.hasOwnProperty.call(message, "selectedButtonId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectedButtonId); + if (message.selectedDisplayText != null && Object.hasOwnProperty.call(message, "selectedDisplayText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedDisplayText); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + return writer; + }; + + /** + * Encodes the specified ButtonsResponseMessage message, length delimited. Does not implicitly {@link proto.Message.ButtonsResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {proto.Message.IButtonsResponseMessage} message ButtonsResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ButtonsResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ButtonsResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ButtonsResponseMessage} ButtonsResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ButtonsResponseMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ButtonsResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selectedButtonId = reader.string(); + break; + case 3: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 4: + message.type = reader.int32(); + break; + case 2: + message.selectedDisplayText = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ButtonsResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ButtonsResponseMessage} ButtonsResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ButtonsResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ButtonsResponseMessage message. + * @function verify + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ButtonsResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selectedButtonId != null && message.hasOwnProperty("selectedButtonId")) + if (!$util.isString(message.selectedButtonId)) + return "selectedButtonId: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + break; + } + if (message.selectedDisplayText != null && message.hasOwnProperty("selectedDisplayText")) { + properties.response = 1; + if (!$util.isString(message.selectedDisplayText)) + return "selectedDisplayText: string expected"; + } + return null; + }; + + /** + * Creates a ButtonsResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ButtonsResponseMessage} ButtonsResponseMessage + */ + ButtonsResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ButtonsResponseMessage) + return object; + var message = new $root.proto.Message.ButtonsResponseMessage(); + if (object.selectedButtonId != null) + message.selectedButtonId = String(object.selectedButtonId); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ButtonsResponseMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "DISPLAY_TEXT": + case 1: + message.type = 1; + break; + } + if (object.selectedDisplayText != null) + message.selectedDisplayText = String(object.selectedDisplayText); + return message; + }; + + /** + * Creates a plain object from a ButtonsResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ButtonsResponseMessage + * @static + * @param {proto.Message.ButtonsResponseMessage} message ButtonsResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ButtonsResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.selectedButtonId = ""; + object.contextInfo = null; + object.type = options.enums === String ? "UNKNOWN" : 0; + } + if (message.selectedButtonId != null && message.hasOwnProperty("selectedButtonId")) + object.selectedButtonId = message.selectedButtonId; + if (message.selectedDisplayText != null && message.hasOwnProperty("selectedDisplayText")) { + object.selectedDisplayText = message.selectedDisplayText; + if (options.oneofs) + object.response = "selectedDisplayText"; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.proto.Message.ButtonsResponseMessage.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this ButtonsResponseMessage to JSON. + * @function toJSON + * @memberof proto.Message.ButtonsResponseMessage + * @instance + * @returns {Object.} JSON object + */ + ButtonsResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name proto.Message.ButtonsResponseMessage.Type + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} DISPLAY_TEXT=1 DISPLAY_TEXT value + */ + ButtonsResponseMessage.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "DISPLAY_TEXT"] = 1; + return values; + })(); + + return ButtonsResponseMessage; + })(); + + Message.Call = (function() { + + /** + * Properties of a Call. + * @memberof proto.Message + * @interface ICall + * @property {Uint8Array|null} [callKey] Call callKey + * @property {string|null} [conversionSource] Call conversionSource + * @property {Uint8Array|null} [conversionData] Call conversionData + * @property {number|null} [conversionDelaySeconds] Call conversionDelaySeconds + */ + + /** + * Constructs a new Call. + * @memberof proto.Message + * @classdesc Represents a Call. + * @implements ICall + * @constructor + * @param {proto.Message.ICall=} [properties] Properties to set + */ + function Call(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Call callKey. + * @member {Uint8Array} callKey + * @memberof proto.Message.Call + * @instance + */ + Call.prototype.callKey = $util.newBuffer([]); + + /** + * Call conversionSource. + * @member {string} conversionSource + * @memberof proto.Message.Call + * @instance + */ + Call.prototype.conversionSource = ""; + + /** + * Call conversionData. + * @member {Uint8Array} conversionData + * @memberof proto.Message.Call + * @instance + */ + Call.prototype.conversionData = $util.newBuffer([]); + + /** + * Call conversionDelaySeconds. + * @member {number} conversionDelaySeconds + * @memberof proto.Message.Call + * @instance + */ + Call.prototype.conversionDelaySeconds = 0; + + /** + * Creates a new Call instance using the specified properties. + * @function create + * @memberof proto.Message.Call + * @static + * @param {proto.Message.ICall=} [properties] Properties to set + * @returns {proto.Message.Call} Call instance + */ + Call.create = function create(properties) { + return new Call(properties); + }; + + /** + * Encodes the specified Call message. Does not implicitly {@link proto.Message.Call.verify|verify} messages. + * @function encode + * @memberof proto.Message.Call + * @static + * @param {proto.Message.ICall} message Call message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Call.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.callKey != null && Object.hasOwnProperty.call(message, "callKey")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.callKey); + if (message.conversionSource != null && Object.hasOwnProperty.call(message, "conversionSource")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.conversionSource); + if (message.conversionData != null && Object.hasOwnProperty.call(message, "conversionData")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.conversionData); + if (message.conversionDelaySeconds != null && Object.hasOwnProperty.call(message, "conversionDelaySeconds")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.conversionDelaySeconds); + return writer; + }; + + /** + * Encodes the specified Call message, length delimited. Does not implicitly {@link proto.Message.Call.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.Call + * @static + * @param {proto.Message.ICall} message Call message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Call.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Call message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.Call + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.Call} Call + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Call.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.Call(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.callKey = reader.bytes(); + break; + case 2: + message.conversionSource = reader.string(); + break; + case 3: + message.conversionData = reader.bytes(); + break; + case 4: + message.conversionDelaySeconds = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Call message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.Call + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.Call} Call + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Call.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Call message. + * @function verify + * @memberof proto.Message.Call + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Call.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.callKey != null && message.hasOwnProperty("callKey")) + if (!(message.callKey && typeof message.callKey.length === "number" || $util.isString(message.callKey))) + return "callKey: buffer expected"; + if (message.conversionSource != null && message.hasOwnProperty("conversionSource")) + if (!$util.isString(message.conversionSource)) + return "conversionSource: string expected"; + if (message.conversionData != null && message.hasOwnProperty("conversionData")) + if (!(message.conversionData && typeof message.conversionData.length === "number" || $util.isString(message.conversionData))) + return "conversionData: buffer expected"; + if (message.conversionDelaySeconds != null && message.hasOwnProperty("conversionDelaySeconds")) + if (!$util.isInteger(message.conversionDelaySeconds)) + return "conversionDelaySeconds: integer expected"; + return null; + }; + + /** + * Creates a Call message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.Call + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.Call} Call + */ + Call.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.Call) + return object; + var message = new $root.proto.Message.Call(); + if (object.callKey != null) + if (typeof object.callKey === "string") + $util.base64.decode(object.callKey, message.callKey = $util.newBuffer($util.base64.length(object.callKey)), 0); + else if (object.callKey.length) + message.callKey = object.callKey; + if (object.conversionSource != null) + message.conversionSource = String(object.conversionSource); + if (object.conversionData != null) + if (typeof object.conversionData === "string") + $util.base64.decode(object.conversionData, message.conversionData = $util.newBuffer($util.base64.length(object.conversionData)), 0); + else if (object.conversionData.length) + message.conversionData = object.conversionData; + if (object.conversionDelaySeconds != null) + message.conversionDelaySeconds = object.conversionDelaySeconds >>> 0; + return message; + }; + + /** + * Creates a plain object from a Call message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.Call + * @static + * @param {proto.Message.Call} message Call + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Call.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.callKey = ""; + else { + object.callKey = []; + if (options.bytes !== Array) + object.callKey = $util.newBuffer(object.callKey); + } + object.conversionSource = ""; + if (options.bytes === String) + object.conversionData = ""; + else { + object.conversionData = []; + if (options.bytes !== Array) + object.conversionData = $util.newBuffer(object.conversionData); + } + object.conversionDelaySeconds = 0; + } + if (message.callKey != null && message.hasOwnProperty("callKey")) + object.callKey = options.bytes === String ? $util.base64.encode(message.callKey, 0, message.callKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.callKey) : message.callKey; + if (message.conversionSource != null && message.hasOwnProperty("conversionSource")) + object.conversionSource = message.conversionSource; + if (message.conversionData != null && message.hasOwnProperty("conversionData")) + object.conversionData = options.bytes === String ? $util.base64.encode(message.conversionData, 0, message.conversionData.length) : options.bytes === Array ? Array.prototype.slice.call(message.conversionData) : message.conversionData; + if (message.conversionDelaySeconds != null && message.hasOwnProperty("conversionDelaySeconds")) + object.conversionDelaySeconds = message.conversionDelaySeconds; + return object; + }; + + /** + * Converts this Call to JSON. + * @function toJSON + * @memberof proto.Message.Call + * @instance + * @returns {Object.} JSON object + */ + Call.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Call; + })(); + + Message.CancelPaymentRequestMessage = (function() { + + /** + * Properties of a CancelPaymentRequestMessage. + * @memberof proto.Message + * @interface ICancelPaymentRequestMessage + * @property {proto.IMessageKey|null} [key] CancelPaymentRequestMessage key + */ + + /** + * Constructs a new CancelPaymentRequestMessage. + * @memberof proto.Message + * @classdesc Represents a CancelPaymentRequestMessage. + * @implements ICancelPaymentRequestMessage + * @constructor + * @param {proto.Message.ICancelPaymentRequestMessage=} [properties] Properties to set + */ + function CancelPaymentRequestMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelPaymentRequestMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.CancelPaymentRequestMessage + * @instance + */ + CancelPaymentRequestMessage.prototype.key = null; + + /** + * Creates a new CancelPaymentRequestMessage instance using the specified properties. + * @function create + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {proto.Message.ICancelPaymentRequestMessage=} [properties] Properties to set + * @returns {proto.Message.CancelPaymentRequestMessage} CancelPaymentRequestMessage instance + */ + CancelPaymentRequestMessage.create = function create(properties) { + return new CancelPaymentRequestMessage(properties); + }; + + /** + * Encodes the specified CancelPaymentRequestMessage message. Does not implicitly {@link proto.Message.CancelPaymentRequestMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {proto.Message.ICancelPaymentRequestMessage} message CancelPaymentRequestMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelPaymentRequestMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CancelPaymentRequestMessage message, length delimited. Does not implicitly {@link proto.Message.CancelPaymentRequestMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {proto.Message.ICancelPaymentRequestMessage} message CancelPaymentRequestMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelPaymentRequestMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CancelPaymentRequestMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.CancelPaymentRequestMessage} CancelPaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelPaymentRequestMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.CancelPaymentRequestMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CancelPaymentRequestMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.CancelPaymentRequestMessage} CancelPaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelPaymentRequestMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelPaymentRequestMessage message. + * @function verify + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelPaymentRequestMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + return null; + }; + + /** + * Creates a CancelPaymentRequestMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.CancelPaymentRequestMessage} CancelPaymentRequestMessage + */ + CancelPaymentRequestMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.CancelPaymentRequestMessage) + return object; + var message = new $root.proto.Message.CancelPaymentRequestMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.CancelPaymentRequestMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + return message; + }; + + /** + * Creates a plain object from a CancelPaymentRequestMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.CancelPaymentRequestMessage + * @static + * @param {proto.Message.CancelPaymentRequestMessage} message CancelPaymentRequestMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelPaymentRequestMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.key = null; + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + return object; + }; + + /** + * Converts this CancelPaymentRequestMessage to JSON. + * @function toJSON + * @memberof proto.Message.CancelPaymentRequestMessage + * @instance + * @returns {Object.} JSON object + */ + CancelPaymentRequestMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CancelPaymentRequestMessage; + })(); + + Message.Chat = (function() { + + /** + * Properties of a Chat. + * @memberof proto.Message + * @interface IChat + * @property {string|null} [displayName] Chat displayName + * @property {string|null} [id] Chat id + */ + + /** + * Constructs a new Chat. + * @memberof proto.Message + * @classdesc Represents a Chat. + * @implements IChat + * @constructor + * @param {proto.Message.IChat=} [properties] Properties to set + */ + function Chat(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Chat displayName. + * @member {string} displayName + * @memberof proto.Message.Chat + * @instance + */ + Chat.prototype.displayName = ""; + + /** + * Chat id. + * @member {string} id + * @memberof proto.Message.Chat + * @instance + */ + Chat.prototype.id = ""; + + /** + * Creates a new Chat instance using the specified properties. + * @function create + * @memberof proto.Message.Chat + * @static + * @param {proto.Message.IChat=} [properties] Properties to set + * @returns {proto.Message.Chat} Chat instance + */ + Chat.create = function create(properties) { + return new Chat(properties); + }; + + /** + * Encodes the specified Chat message. Does not implicitly {@link proto.Message.Chat.verify|verify} messages. + * @function encode + * @memberof proto.Message.Chat + * @static + * @param {proto.Message.IChat} message Chat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Chat.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + return writer; + }; + + /** + * Encodes the specified Chat message, length delimited. Does not implicitly {@link proto.Message.Chat.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.Chat + * @static + * @param {proto.Message.IChat} message Chat message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Chat.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Chat message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.Chat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.Chat} Chat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Chat.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.Chat(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Chat message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.Chat + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.Chat} Chat + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Chat.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Chat message. + * @function verify + * @memberof proto.Message.Chat + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Chat.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + return null; + }; + + /** + * Creates a Chat message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.Chat + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.Chat} Chat + */ + Chat.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.Chat) + return object; + var message = new $root.proto.Message.Chat(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.id != null) + message.id = String(object.id); + return message; + }; + + /** + * Creates a plain object from a Chat message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.Chat + * @static + * @param {proto.Message.Chat} message Chat + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Chat.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayName = ""; + object.id = ""; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + return object; + }; + + /** + * Converts this Chat to JSON. + * @function toJSON + * @memberof proto.Message.Chat + * @instance + * @returns {Object.} JSON object + */ + Chat.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Chat; + })(); + + Message.ContactMessage = (function() { + + /** + * Properties of a ContactMessage. + * @memberof proto.Message + * @interface IContactMessage + * @property {string|null} [displayName] ContactMessage displayName + * @property {string|null} [vcard] ContactMessage vcard + * @property {proto.IContextInfo|null} [contextInfo] ContactMessage contextInfo + */ + + /** + * Constructs a new ContactMessage. + * @memberof proto.Message + * @classdesc Represents a ContactMessage. + * @implements IContactMessage + * @constructor + * @param {proto.Message.IContactMessage=} [properties] Properties to set + */ + function ContactMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContactMessage displayName. + * @member {string} displayName + * @memberof proto.Message.ContactMessage + * @instance + */ + ContactMessage.prototype.displayName = ""; + + /** + * ContactMessage vcard. + * @member {string} vcard + * @memberof proto.Message.ContactMessage + * @instance + */ + ContactMessage.prototype.vcard = ""; + + /** + * ContactMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ContactMessage + * @instance + */ + ContactMessage.prototype.contextInfo = null; + + /** + * Creates a new ContactMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ContactMessage + * @static + * @param {proto.Message.IContactMessage=} [properties] Properties to set + * @returns {proto.Message.ContactMessage} ContactMessage instance + */ + ContactMessage.create = function create(properties) { + return new ContactMessage(properties); + }; + + /** + * Encodes the specified ContactMessage message. Does not implicitly {@link proto.Message.ContactMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ContactMessage + * @static + * @param {proto.Message.IContactMessage} message ContactMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContactMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.vcard != null && Object.hasOwnProperty.call(message, "vcard")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.vcard); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ContactMessage message, length delimited. Does not implicitly {@link proto.Message.ContactMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ContactMessage + * @static + * @param {proto.Message.IContactMessage} message ContactMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContactMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContactMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ContactMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ContactMessage} ContactMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContactMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ContactMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 16: + message.vcard = reader.string(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContactMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ContactMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ContactMessage} ContactMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContactMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContactMessage message. + * @function verify + * @memberof proto.Message.ContactMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContactMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.vcard != null && message.hasOwnProperty("vcard")) + if (!$util.isString(message.vcard)) + return "vcard: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a ContactMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ContactMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ContactMessage} ContactMessage + */ + ContactMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ContactMessage) + return object; + var message = new $root.proto.Message.ContactMessage(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.vcard != null) + message.vcard = String(object.vcard); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ContactMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a ContactMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ContactMessage + * @static + * @param {proto.Message.ContactMessage} message ContactMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContactMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayName = ""; + object.vcard = ""; + object.contextInfo = null; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.vcard != null && message.hasOwnProperty("vcard")) + object.vcard = message.vcard; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this ContactMessage to JSON. + * @function toJSON + * @memberof proto.Message.ContactMessage + * @instance + * @returns {Object.} JSON object + */ + ContactMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContactMessage; + })(); + + Message.ContactsArrayMessage = (function() { + + /** + * Properties of a ContactsArrayMessage. + * @memberof proto.Message + * @interface IContactsArrayMessage + * @property {string|null} [displayName] ContactsArrayMessage displayName + * @property {Array.|null} [contacts] ContactsArrayMessage contacts + * @property {proto.IContextInfo|null} [contextInfo] ContactsArrayMessage contextInfo + */ + + /** + * Constructs a new ContactsArrayMessage. + * @memberof proto.Message + * @classdesc Represents a ContactsArrayMessage. + * @implements IContactsArrayMessage + * @constructor + * @param {proto.Message.IContactsArrayMessage=} [properties] Properties to set + */ + function ContactsArrayMessage(properties) { + this.contacts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContactsArrayMessage displayName. + * @member {string} displayName + * @memberof proto.Message.ContactsArrayMessage + * @instance + */ + ContactsArrayMessage.prototype.displayName = ""; + + /** + * ContactsArrayMessage contacts. + * @member {Array.} contacts + * @memberof proto.Message.ContactsArrayMessage + * @instance + */ + ContactsArrayMessage.prototype.contacts = $util.emptyArray; + + /** + * ContactsArrayMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ContactsArrayMessage + * @instance + */ + ContactsArrayMessage.prototype.contextInfo = null; + + /** + * Creates a new ContactsArrayMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {proto.Message.IContactsArrayMessage=} [properties] Properties to set + * @returns {proto.Message.ContactsArrayMessage} ContactsArrayMessage instance + */ + ContactsArrayMessage.create = function create(properties) { + return new ContactsArrayMessage(properties); + }; + + /** + * Encodes the specified ContactsArrayMessage message. Does not implicitly {@link proto.Message.ContactsArrayMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {proto.Message.IContactsArrayMessage} message ContactsArrayMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContactsArrayMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.contacts != null && message.contacts.length) + for (var i = 0; i < message.contacts.length; ++i) + $root.proto.Message.ContactMessage.encode(message.contacts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ContactsArrayMessage message, length delimited. Does not implicitly {@link proto.Message.ContactsArrayMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {proto.Message.IContactsArrayMessage} message ContactsArrayMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContactsArrayMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContactsArrayMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ContactsArrayMessage} ContactsArrayMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContactsArrayMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ContactsArrayMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayName = reader.string(); + break; + case 2: + if (!(message.contacts && message.contacts.length)) + message.contacts = []; + message.contacts.push($root.proto.Message.ContactMessage.decode(reader, reader.uint32())); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContactsArrayMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ContactsArrayMessage} ContactsArrayMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContactsArrayMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContactsArrayMessage message. + * @function verify + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContactsArrayMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.contacts != null && message.hasOwnProperty("contacts")) { + if (!Array.isArray(message.contacts)) + return "contacts: array expected"; + for (var i = 0; i < message.contacts.length; ++i) { + var error = $root.proto.Message.ContactMessage.verify(message.contacts[i]); + if (error) + return "contacts." + error; + } + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a ContactsArrayMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ContactsArrayMessage} ContactsArrayMessage + */ + ContactsArrayMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ContactsArrayMessage) + return object; + var message = new $root.proto.Message.ContactsArrayMessage(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.contacts) { + if (!Array.isArray(object.contacts)) + throw TypeError(".proto.Message.ContactsArrayMessage.contacts: array expected"); + message.contacts = []; + for (var i = 0; i < object.contacts.length; ++i) { + if (typeof object.contacts[i] !== "object") + throw TypeError(".proto.Message.ContactsArrayMessage.contacts: object expected"); + message.contacts[i] = $root.proto.Message.ContactMessage.fromObject(object.contacts[i]); + } + } + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ContactsArrayMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a ContactsArrayMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ContactsArrayMessage + * @static + * @param {proto.Message.ContactsArrayMessage} message ContactsArrayMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContactsArrayMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contacts = []; + if (options.defaults) { + object.displayName = ""; + object.contextInfo = null; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.contacts && message.contacts.length) { + object.contacts = []; + for (var j = 0; j < message.contacts.length; ++j) + object.contacts[j] = $root.proto.Message.ContactMessage.toObject(message.contacts[j], options); + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this ContactsArrayMessage to JSON. + * @function toJSON + * @memberof proto.Message.ContactsArrayMessage + * @instance + * @returns {Object.} JSON object + */ + ContactsArrayMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContactsArrayMessage; + })(); + + Message.DeclinePaymentRequestMessage = (function() { + + /** + * Properties of a DeclinePaymentRequestMessage. + * @memberof proto.Message + * @interface IDeclinePaymentRequestMessage + * @property {proto.IMessageKey|null} [key] DeclinePaymentRequestMessage key + */ + + /** + * Constructs a new DeclinePaymentRequestMessage. + * @memberof proto.Message + * @classdesc Represents a DeclinePaymentRequestMessage. + * @implements IDeclinePaymentRequestMessage + * @constructor + * @param {proto.Message.IDeclinePaymentRequestMessage=} [properties] Properties to set + */ + function DeclinePaymentRequestMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeclinePaymentRequestMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.DeclinePaymentRequestMessage + * @instance + */ + DeclinePaymentRequestMessage.prototype.key = null; + + /** + * Creates a new DeclinePaymentRequestMessage instance using the specified properties. + * @function create + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {proto.Message.IDeclinePaymentRequestMessage=} [properties] Properties to set + * @returns {proto.Message.DeclinePaymentRequestMessage} DeclinePaymentRequestMessage instance + */ + DeclinePaymentRequestMessage.create = function create(properties) { + return new DeclinePaymentRequestMessage(properties); + }; + + /** + * Encodes the specified DeclinePaymentRequestMessage message. Does not implicitly {@link proto.Message.DeclinePaymentRequestMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {proto.Message.IDeclinePaymentRequestMessage} message DeclinePaymentRequestMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeclinePaymentRequestMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeclinePaymentRequestMessage message, length delimited. Does not implicitly {@link proto.Message.DeclinePaymentRequestMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {proto.Message.IDeclinePaymentRequestMessage} message DeclinePaymentRequestMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeclinePaymentRequestMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeclinePaymentRequestMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.DeclinePaymentRequestMessage} DeclinePaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeclinePaymentRequestMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.DeclinePaymentRequestMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeclinePaymentRequestMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.DeclinePaymentRequestMessage} DeclinePaymentRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeclinePaymentRequestMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeclinePaymentRequestMessage message. + * @function verify + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeclinePaymentRequestMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + return null; + }; + + /** + * Creates a DeclinePaymentRequestMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.DeclinePaymentRequestMessage} DeclinePaymentRequestMessage + */ + DeclinePaymentRequestMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.DeclinePaymentRequestMessage) + return object; + var message = new $root.proto.Message.DeclinePaymentRequestMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.DeclinePaymentRequestMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + return message; + }; + + /** + * Creates a plain object from a DeclinePaymentRequestMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.DeclinePaymentRequestMessage + * @static + * @param {proto.Message.DeclinePaymentRequestMessage} message DeclinePaymentRequestMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeclinePaymentRequestMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.key = null; + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + return object; + }; + + /** + * Converts this DeclinePaymentRequestMessage to JSON. + * @function toJSON + * @memberof proto.Message.DeclinePaymentRequestMessage + * @instance + * @returns {Object.} JSON object + */ + DeclinePaymentRequestMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeclinePaymentRequestMessage; + })(); + + Message.DeviceSentMessage = (function() { + + /** + * Properties of a DeviceSentMessage. + * @memberof proto.Message + * @interface IDeviceSentMessage + * @property {string|null} [destinationJid] DeviceSentMessage destinationJid + * @property {proto.IMessage|null} [message] DeviceSentMessage message + * @property {string|null} [phash] DeviceSentMessage phash + */ + + /** + * Constructs a new DeviceSentMessage. + * @memberof proto.Message + * @classdesc Represents a DeviceSentMessage. + * @implements IDeviceSentMessage + * @constructor + * @param {proto.Message.IDeviceSentMessage=} [properties] Properties to set + */ + function DeviceSentMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeviceSentMessage destinationJid. + * @member {string} destinationJid + * @memberof proto.Message.DeviceSentMessage + * @instance + */ + DeviceSentMessage.prototype.destinationJid = ""; + + /** + * DeviceSentMessage message. + * @member {proto.IMessage|null|undefined} message + * @memberof proto.Message.DeviceSentMessage + * @instance + */ + DeviceSentMessage.prototype.message = null; + + /** + * DeviceSentMessage phash. + * @member {string} phash + * @memberof proto.Message.DeviceSentMessage + * @instance + */ + DeviceSentMessage.prototype.phash = ""; + + /** + * Creates a new DeviceSentMessage instance using the specified properties. + * @function create + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {proto.Message.IDeviceSentMessage=} [properties] Properties to set + * @returns {proto.Message.DeviceSentMessage} DeviceSentMessage instance + */ + DeviceSentMessage.create = function create(properties) { + return new DeviceSentMessage(properties); + }; + + /** + * Encodes the specified DeviceSentMessage message. Does not implicitly {@link proto.Message.DeviceSentMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {proto.Message.IDeviceSentMessage} message DeviceSentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeviceSentMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.destinationJid != null && Object.hasOwnProperty.call(message, "destinationJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.destinationJid); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.proto.Message.encode(message.message, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.phash != null && Object.hasOwnProperty.call(message, "phash")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.phash); + return writer; + }; + + /** + * Encodes the specified DeviceSentMessage message, length delimited. Does not implicitly {@link proto.Message.DeviceSentMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {proto.Message.IDeviceSentMessage} message DeviceSentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeviceSentMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeviceSentMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.DeviceSentMessage} DeviceSentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeviceSentMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.DeviceSentMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.destinationJid = reader.string(); + break; + case 2: + message.message = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 3: + message.phash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeviceSentMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.DeviceSentMessage} DeviceSentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeviceSentMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeviceSentMessage message. + * @function verify + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeviceSentMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.destinationJid != null && message.hasOwnProperty("destinationJid")) + if (!$util.isString(message.destinationJid)) + return "destinationJid: string expected"; + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.proto.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.phash != null && message.hasOwnProperty("phash")) + if (!$util.isString(message.phash)) + return "phash: string expected"; + return null; + }; + + /** + * Creates a DeviceSentMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.DeviceSentMessage} DeviceSentMessage + */ + DeviceSentMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.DeviceSentMessage) + return object; + var message = new $root.proto.Message.DeviceSentMessage(); + if (object.destinationJid != null) + message.destinationJid = String(object.destinationJid); + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".proto.Message.DeviceSentMessage.message: object expected"); + message.message = $root.proto.Message.fromObject(object.message); + } + if (object.phash != null) + message.phash = String(object.phash); + return message; + }; + + /** + * Creates a plain object from a DeviceSentMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.DeviceSentMessage + * @static + * @param {proto.Message.DeviceSentMessage} message DeviceSentMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeviceSentMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.destinationJid = ""; + object.message = null; + object.phash = ""; + } + if (message.destinationJid != null && message.hasOwnProperty("destinationJid")) + object.destinationJid = message.destinationJid; + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.proto.Message.toObject(message.message, options); + if (message.phash != null && message.hasOwnProperty("phash")) + object.phash = message.phash; + return object; + }; + + /** + * Converts this DeviceSentMessage to JSON. + * @function toJSON + * @memberof proto.Message.DeviceSentMessage + * @instance + * @returns {Object.} JSON object + */ + DeviceSentMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeviceSentMessage; + })(); + + Message.DocumentMessage = (function() { + + /** + * Properties of a DocumentMessage. + * @memberof proto.Message + * @interface IDocumentMessage + * @property {string|null} [url] DocumentMessage url + * @property {string|null} [mimetype] DocumentMessage mimetype + * @property {string|null} [title] DocumentMessage title + * @property {Uint8Array|null} [fileSha256] DocumentMessage fileSha256 + * @property {number|Long|null} [fileLength] DocumentMessage fileLength + * @property {number|null} [pageCount] DocumentMessage pageCount + * @property {Uint8Array|null} [mediaKey] DocumentMessage mediaKey + * @property {string|null} [fileName] DocumentMessage fileName + * @property {Uint8Array|null} [fileEncSha256] DocumentMessage fileEncSha256 + * @property {string|null} [directPath] DocumentMessage directPath + * @property {number|Long|null} [mediaKeyTimestamp] DocumentMessage mediaKeyTimestamp + * @property {boolean|null} [contactVcard] DocumentMessage contactVcard + * @property {string|null} [thumbnailDirectPath] DocumentMessage thumbnailDirectPath + * @property {Uint8Array|null} [thumbnailSha256] DocumentMessage thumbnailSha256 + * @property {Uint8Array|null} [thumbnailEncSha256] DocumentMessage thumbnailEncSha256 + * @property {Uint8Array|null} [jpegThumbnail] DocumentMessage jpegThumbnail + * @property {proto.IContextInfo|null} [contextInfo] DocumentMessage contextInfo + * @property {number|null} [thumbnailHeight] DocumentMessage thumbnailHeight + * @property {number|null} [thumbnailWidth] DocumentMessage thumbnailWidth + * @property {string|null} [caption] DocumentMessage caption + */ + + /** + * Constructs a new DocumentMessage. + * @memberof proto.Message + * @classdesc Represents a DocumentMessage. + * @implements IDocumentMessage + * @constructor + * @param {proto.Message.IDocumentMessage=} [properties] Properties to set + */ + function DocumentMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentMessage url. + * @member {string} url + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.url = ""; + + /** + * DocumentMessage mimetype. + * @member {string} mimetype + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.mimetype = ""; + + /** + * DocumentMessage title. + * @member {string} title + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.title = ""; + + /** + * DocumentMessage fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.fileSha256 = $util.newBuffer([]); + + /** + * DocumentMessage fileLength. + * @member {number|Long} fileLength + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * DocumentMessage pageCount. + * @member {number} pageCount + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.pageCount = 0; + + /** + * DocumentMessage mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.mediaKey = $util.newBuffer([]); + + /** + * DocumentMessage fileName. + * @member {string} fileName + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.fileName = ""; + + /** + * DocumentMessage fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * DocumentMessage directPath. + * @member {string} directPath + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.directPath = ""; + + /** + * DocumentMessage mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * DocumentMessage contactVcard. + * @member {boolean} contactVcard + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.contactVcard = false; + + /** + * DocumentMessage thumbnailDirectPath. + * @member {string} thumbnailDirectPath + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.thumbnailDirectPath = ""; + + /** + * DocumentMessage thumbnailSha256. + * @member {Uint8Array} thumbnailSha256 + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.thumbnailSha256 = $util.newBuffer([]); + + /** + * DocumentMessage thumbnailEncSha256. + * @member {Uint8Array} thumbnailEncSha256 + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.thumbnailEncSha256 = $util.newBuffer([]); + + /** + * DocumentMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * DocumentMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.contextInfo = null; + + /** + * DocumentMessage thumbnailHeight. + * @member {number} thumbnailHeight + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.thumbnailHeight = 0; + + /** + * DocumentMessage thumbnailWidth. + * @member {number} thumbnailWidth + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.thumbnailWidth = 0; + + /** + * DocumentMessage caption. + * @member {string} caption + * @memberof proto.Message.DocumentMessage + * @instance + */ + DocumentMessage.prototype.caption = ""; + + /** + * Creates a new DocumentMessage instance using the specified properties. + * @function create + * @memberof proto.Message.DocumentMessage + * @static + * @param {proto.Message.IDocumentMessage=} [properties] Properties to set + * @returns {proto.Message.DocumentMessage} DocumentMessage instance + */ + DocumentMessage.create = function create(properties) { + return new DocumentMessage(properties); + }; + + /** + * Encodes the specified DocumentMessage message. Does not implicitly {@link proto.Message.DocumentMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.DocumentMessage + * @static + * @param {proto.Message.IDocumentMessage} message DocumentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimetype); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.title); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.fileSha256); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.fileLength); + if (message.pageCount != null && Object.hasOwnProperty.call(message, "pageCount")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.pageCount); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.mediaKey); + if (message.fileName != null && Object.hasOwnProperty.call(message, "fileName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.fileName); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.fileEncSha256); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.directPath); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 11, wireType 0 =*/88).int64(message.mediaKeyTimestamp); + if (message.contactVcard != null && Object.hasOwnProperty.call(message, "contactVcard")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.contactVcard); + if (message.thumbnailDirectPath != null && Object.hasOwnProperty.call(message, "thumbnailDirectPath")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.thumbnailDirectPath); + if (message.thumbnailSha256 != null && Object.hasOwnProperty.call(message, "thumbnailSha256")) + writer.uint32(/* id 14, wireType 2 =*/114).bytes(message.thumbnailSha256); + if (message.thumbnailEncSha256 != null && Object.hasOwnProperty.call(message, "thumbnailEncSha256")) + writer.uint32(/* id 15, wireType 2 =*/122).bytes(message.thumbnailEncSha256); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.thumbnailHeight != null && Object.hasOwnProperty.call(message, "thumbnailHeight")) + writer.uint32(/* id 18, wireType 0 =*/144).uint32(message.thumbnailHeight); + if (message.thumbnailWidth != null && Object.hasOwnProperty.call(message, "thumbnailWidth")) + writer.uint32(/* id 19, wireType 0 =*/152).uint32(message.thumbnailWidth); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 20, wireType 2 =*/162).string(message.caption); + return writer; + }; + + /** + * Encodes the specified DocumentMessage message, length delimited. Does not implicitly {@link proto.Message.DocumentMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.DocumentMessage + * @static + * @param {proto.Message.IDocumentMessage} message DocumentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.DocumentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.DocumentMessage} DocumentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.DocumentMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.mimetype = reader.string(); + break; + case 3: + message.title = reader.string(); + break; + case 4: + message.fileSha256 = reader.bytes(); + break; + case 5: + message.fileLength = reader.uint64(); + break; + case 6: + message.pageCount = reader.uint32(); + break; + case 7: + message.mediaKey = reader.bytes(); + break; + case 8: + message.fileName = reader.string(); + break; + case 9: + message.fileEncSha256 = reader.bytes(); + break; + case 10: + message.directPath = reader.string(); + break; + case 11: + message.mediaKeyTimestamp = reader.int64(); + break; + case 12: + message.contactVcard = reader.bool(); + break; + case 13: + message.thumbnailDirectPath = reader.string(); + break; + case 14: + message.thumbnailSha256 = reader.bytes(); + break; + case 15: + message.thumbnailEncSha256 = reader.bytes(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 18: + message.thumbnailHeight = reader.uint32(); + break; + case 19: + message.thumbnailWidth = reader.uint32(); + break; + case 20: + message.caption = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.DocumentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.DocumentMessage} DocumentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentMessage message. + * @function verify + * @memberof proto.Message.DocumentMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.pageCount != null && message.hasOwnProperty("pageCount")) + if (!$util.isInteger(message.pageCount)) + return "pageCount: integer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.fileName != null && message.hasOwnProperty("fileName")) + if (!$util.isString(message.fileName)) + return "fileName: string expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.contactVcard != null && message.hasOwnProperty("contactVcard")) + if (typeof message.contactVcard !== "boolean") + return "contactVcard: boolean expected"; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + if (!$util.isString(message.thumbnailDirectPath)) + return "thumbnailDirectPath: string expected"; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + if (!(message.thumbnailSha256 && typeof message.thumbnailSha256.length === "number" || $util.isString(message.thumbnailSha256))) + return "thumbnailSha256: buffer expected"; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + if (!(message.thumbnailEncSha256 && typeof message.thumbnailEncSha256.length === "number" || $util.isString(message.thumbnailEncSha256))) + return "thumbnailEncSha256: buffer expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.thumbnailHeight != null && message.hasOwnProperty("thumbnailHeight")) + if (!$util.isInteger(message.thumbnailHeight)) + return "thumbnailHeight: integer expected"; + if (message.thumbnailWidth != null && message.hasOwnProperty("thumbnailWidth")) + if (!$util.isInteger(message.thumbnailWidth)) + return "thumbnailWidth: integer expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + return null; + }; + + /** + * Creates a DocumentMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.DocumentMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.DocumentMessage} DocumentMessage + */ + DocumentMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.DocumentMessage) + return object; + var message = new $root.proto.Message.DocumentMessage(); + if (object.url != null) + message.url = String(object.url); + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.title != null) + message.title = String(object.title); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.pageCount != null) + message.pageCount = object.pageCount >>> 0; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.fileName != null) + message.fileName = String(object.fileName); + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.contactVcard != null) + message.contactVcard = Boolean(object.contactVcard); + if (object.thumbnailDirectPath != null) + message.thumbnailDirectPath = String(object.thumbnailDirectPath); + if (object.thumbnailSha256 != null) + if (typeof object.thumbnailSha256 === "string") + $util.base64.decode(object.thumbnailSha256, message.thumbnailSha256 = $util.newBuffer($util.base64.length(object.thumbnailSha256)), 0); + else if (object.thumbnailSha256.length) + message.thumbnailSha256 = object.thumbnailSha256; + if (object.thumbnailEncSha256 != null) + if (typeof object.thumbnailEncSha256 === "string") + $util.base64.decode(object.thumbnailEncSha256, message.thumbnailEncSha256 = $util.newBuffer($util.base64.length(object.thumbnailEncSha256)), 0); + else if (object.thumbnailEncSha256.length) + message.thumbnailEncSha256 = object.thumbnailEncSha256; + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.DocumentMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.thumbnailHeight != null) + message.thumbnailHeight = object.thumbnailHeight >>> 0; + if (object.thumbnailWidth != null) + message.thumbnailWidth = object.thumbnailWidth >>> 0; + if (object.caption != null) + message.caption = String(object.caption); + return message; + }; + + /** + * Creates a plain object from a DocumentMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.DocumentMessage + * @static + * @param {proto.Message.DocumentMessage} message DocumentMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.mimetype = ""; + object.title = ""; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.pageCount = 0; + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + object.fileName = ""; + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + object.contactVcard = false; + object.thumbnailDirectPath = ""; + if (options.bytes === String) + object.thumbnailSha256 = ""; + else { + object.thumbnailSha256 = []; + if (options.bytes !== Array) + object.thumbnailSha256 = $util.newBuffer(object.thumbnailSha256); + } + if (options.bytes === String) + object.thumbnailEncSha256 = ""; + else { + object.thumbnailEncSha256 = []; + if (options.bytes !== Array) + object.thumbnailEncSha256 = $util.newBuffer(object.thumbnailEncSha256); + } + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.contextInfo = null; + object.thumbnailHeight = 0; + object.thumbnailWidth = 0; + object.caption = ""; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.pageCount != null && message.hasOwnProperty("pageCount")) + object.pageCount = message.pageCount; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.fileName != null && message.hasOwnProperty("fileName")) + object.fileName = message.fileName; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.contactVcard != null && message.hasOwnProperty("contactVcard")) + object.contactVcard = message.contactVcard; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + object.thumbnailDirectPath = message.thumbnailDirectPath; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + object.thumbnailSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailSha256, 0, message.thumbnailSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailSha256) : message.thumbnailSha256; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + object.thumbnailEncSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailEncSha256, 0, message.thumbnailEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailEncSha256) : message.thumbnailEncSha256; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.thumbnailHeight != null && message.hasOwnProperty("thumbnailHeight")) + object.thumbnailHeight = message.thumbnailHeight; + if (message.thumbnailWidth != null && message.hasOwnProperty("thumbnailWidth")) + object.thumbnailWidth = message.thumbnailWidth; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + return object; + }; + + /** + * Converts this DocumentMessage to JSON. + * @function toJSON + * @memberof proto.Message.DocumentMessage + * @instance + * @returns {Object.} JSON object + */ + DocumentMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DocumentMessage; + })(); + + Message.EncReactionMessage = (function() { + + /** + * Properties of an EncReactionMessage. + * @memberof proto.Message + * @interface IEncReactionMessage + * @property {proto.IMessageKey|null} [targetMessageKey] EncReactionMessage targetMessageKey + * @property {Uint8Array|null} [encPayload] EncReactionMessage encPayload + * @property {Uint8Array|null} [encIv] EncReactionMessage encIv + */ + + /** + * Constructs a new EncReactionMessage. + * @memberof proto.Message + * @classdesc Represents an EncReactionMessage. + * @implements IEncReactionMessage + * @constructor + * @param {proto.Message.IEncReactionMessage=} [properties] Properties to set + */ + function EncReactionMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EncReactionMessage targetMessageKey. + * @member {proto.IMessageKey|null|undefined} targetMessageKey + * @memberof proto.Message.EncReactionMessage + * @instance + */ + EncReactionMessage.prototype.targetMessageKey = null; + + /** + * EncReactionMessage encPayload. + * @member {Uint8Array} encPayload + * @memberof proto.Message.EncReactionMessage + * @instance + */ + EncReactionMessage.prototype.encPayload = $util.newBuffer([]); + + /** + * EncReactionMessage encIv. + * @member {Uint8Array} encIv + * @memberof proto.Message.EncReactionMessage + * @instance + */ + EncReactionMessage.prototype.encIv = $util.newBuffer([]); + + /** + * Creates a new EncReactionMessage instance using the specified properties. + * @function create + * @memberof proto.Message.EncReactionMessage + * @static + * @param {proto.Message.IEncReactionMessage=} [properties] Properties to set + * @returns {proto.Message.EncReactionMessage} EncReactionMessage instance + */ + EncReactionMessage.create = function create(properties) { + return new EncReactionMessage(properties); + }; + + /** + * Encodes the specified EncReactionMessage message. Does not implicitly {@link proto.Message.EncReactionMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.EncReactionMessage + * @static + * @param {proto.Message.IEncReactionMessage} message EncReactionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncReactionMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetMessageKey != null && Object.hasOwnProperty.call(message, "targetMessageKey")) + $root.proto.MessageKey.encode(message.targetMessageKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.encPayload != null && Object.hasOwnProperty.call(message, "encPayload")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.encPayload); + if (message.encIv != null && Object.hasOwnProperty.call(message, "encIv")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.encIv); + return writer; + }; + + /** + * Encodes the specified EncReactionMessage message, length delimited. Does not implicitly {@link proto.Message.EncReactionMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.EncReactionMessage + * @static + * @param {proto.Message.IEncReactionMessage} message EncReactionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncReactionMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EncReactionMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.EncReactionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.EncReactionMessage} EncReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncReactionMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.EncReactionMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.targetMessageKey = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.encPayload = reader.bytes(); + break; + case 3: + message.encIv = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EncReactionMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.EncReactionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.EncReactionMessage} EncReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncReactionMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EncReactionMessage message. + * @function verify + * @memberof proto.Message.EncReactionMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EncReactionMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.targetMessageKey != null && message.hasOwnProperty("targetMessageKey")) { + var error = $root.proto.MessageKey.verify(message.targetMessageKey); + if (error) + return "targetMessageKey." + error; + } + if (message.encPayload != null && message.hasOwnProperty("encPayload")) + if (!(message.encPayload && typeof message.encPayload.length === "number" || $util.isString(message.encPayload))) + return "encPayload: buffer expected"; + if (message.encIv != null && message.hasOwnProperty("encIv")) + if (!(message.encIv && typeof message.encIv.length === "number" || $util.isString(message.encIv))) + return "encIv: buffer expected"; + return null; + }; + + /** + * Creates an EncReactionMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.EncReactionMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.EncReactionMessage} EncReactionMessage + */ + EncReactionMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.EncReactionMessage) + return object; + var message = new $root.proto.Message.EncReactionMessage(); + if (object.targetMessageKey != null) { + if (typeof object.targetMessageKey !== "object") + throw TypeError(".proto.Message.EncReactionMessage.targetMessageKey: object expected"); + message.targetMessageKey = $root.proto.MessageKey.fromObject(object.targetMessageKey); + } + if (object.encPayload != null) + if (typeof object.encPayload === "string") + $util.base64.decode(object.encPayload, message.encPayload = $util.newBuffer($util.base64.length(object.encPayload)), 0); + else if (object.encPayload.length) + message.encPayload = object.encPayload; + if (object.encIv != null) + if (typeof object.encIv === "string") + $util.base64.decode(object.encIv, message.encIv = $util.newBuffer($util.base64.length(object.encIv)), 0); + else if (object.encIv.length) + message.encIv = object.encIv; + return message; + }; + + /** + * Creates a plain object from an EncReactionMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.EncReactionMessage + * @static + * @param {proto.Message.EncReactionMessage} message EncReactionMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EncReactionMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.targetMessageKey = null; + if (options.bytes === String) + object.encPayload = ""; + else { + object.encPayload = []; + if (options.bytes !== Array) + object.encPayload = $util.newBuffer(object.encPayload); + } + if (options.bytes === String) + object.encIv = ""; + else { + object.encIv = []; + if (options.bytes !== Array) + object.encIv = $util.newBuffer(object.encIv); + } + } + if (message.targetMessageKey != null && message.hasOwnProperty("targetMessageKey")) + object.targetMessageKey = $root.proto.MessageKey.toObject(message.targetMessageKey, options); + if (message.encPayload != null && message.hasOwnProperty("encPayload")) + object.encPayload = options.bytes === String ? $util.base64.encode(message.encPayload, 0, message.encPayload.length) : options.bytes === Array ? Array.prototype.slice.call(message.encPayload) : message.encPayload; + if (message.encIv != null && message.hasOwnProperty("encIv")) + object.encIv = options.bytes === String ? $util.base64.encode(message.encIv, 0, message.encIv.length) : options.bytes === Array ? Array.prototype.slice.call(message.encIv) : message.encIv; + return object; + }; + + /** + * Converts this EncReactionMessage to JSON. + * @function toJSON + * @memberof proto.Message.EncReactionMessage + * @instance + * @returns {Object.} JSON object + */ + EncReactionMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EncReactionMessage; + })(); + + Message.ExtendedTextMessage = (function() { + + /** + * Properties of an ExtendedTextMessage. + * @memberof proto.Message + * @interface IExtendedTextMessage + * @property {string|null} [text] ExtendedTextMessage text + * @property {string|null} [matchedText] ExtendedTextMessage matchedText + * @property {string|null} [canonicalUrl] ExtendedTextMessage canonicalUrl + * @property {string|null} [description] ExtendedTextMessage description + * @property {string|null} [title] ExtendedTextMessage title + * @property {number|null} [textArgb] ExtendedTextMessage textArgb + * @property {number|null} [backgroundArgb] ExtendedTextMessage backgroundArgb + * @property {proto.Message.ExtendedTextMessage.FontType|null} [font] ExtendedTextMessage font + * @property {proto.Message.ExtendedTextMessage.PreviewType|null} [previewType] ExtendedTextMessage previewType + * @property {Uint8Array|null} [jpegThumbnail] ExtendedTextMessage jpegThumbnail + * @property {proto.IContextInfo|null} [contextInfo] ExtendedTextMessage contextInfo + * @property {boolean|null} [doNotPlayInline] ExtendedTextMessage doNotPlayInline + * @property {string|null} [thumbnailDirectPath] ExtendedTextMessage thumbnailDirectPath + * @property {Uint8Array|null} [thumbnailSha256] ExtendedTextMessage thumbnailSha256 + * @property {Uint8Array|null} [thumbnailEncSha256] ExtendedTextMessage thumbnailEncSha256 + * @property {Uint8Array|null} [mediaKey] ExtendedTextMessage mediaKey + * @property {number|Long|null} [mediaKeyTimestamp] ExtendedTextMessage mediaKeyTimestamp + * @property {number|null} [thumbnailHeight] ExtendedTextMessage thumbnailHeight + * @property {number|null} [thumbnailWidth] ExtendedTextMessage thumbnailWidth + * @property {proto.Message.ExtendedTextMessage.InviteLinkGroupType|null} [inviteLinkGroupType] ExtendedTextMessage inviteLinkGroupType + * @property {string|null} [inviteLinkParentGroupSubjectV2] ExtendedTextMessage inviteLinkParentGroupSubjectV2 + * @property {Uint8Array|null} [inviteLinkParentGroupThumbnailV2] ExtendedTextMessage inviteLinkParentGroupThumbnailV2 + * @property {proto.Message.ExtendedTextMessage.InviteLinkGroupType|null} [inviteLinkGroupTypeV2] ExtendedTextMessage inviteLinkGroupTypeV2 + * @property {boolean|null} [viewOnce] ExtendedTextMessage viewOnce + */ + + /** + * Constructs a new ExtendedTextMessage. + * @memberof proto.Message + * @classdesc Represents an ExtendedTextMessage. + * @implements IExtendedTextMessage + * @constructor + * @param {proto.Message.IExtendedTextMessage=} [properties] Properties to set + */ + function ExtendedTextMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtendedTextMessage text. + * @member {string} text + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.text = ""; + + /** + * ExtendedTextMessage matchedText. + * @member {string} matchedText + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.matchedText = ""; + + /** + * ExtendedTextMessage canonicalUrl. + * @member {string} canonicalUrl + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.canonicalUrl = ""; + + /** + * ExtendedTextMessage description. + * @member {string} description + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.description = ""; + + /** + * ExtendedTextMessage title. + * @member {string} title + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.title = ""; + + /** + * ExtendedTextMessage textArgb. + * @member {number} textArgb + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.textArgb = 0; + + /** + * ExtendedTextMessage backgroundArgb. + * @member {number} backgroundArgb + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.backgroundArgb = 0; + + /** + * ExtendedTextMessage font. + * @member {proto.Message.ExtendedTextMessage.FontType} font + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.font = 0; + + /** + * ExtendedTextMessage previewType. + * @member {proto.Message.ExtendedTextMessage.PreviewType} previewType + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.previewType = 0; + + /** + * ExtendedTextMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * ExtendedTextMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.contextInfo = null; + + /** + * ExtendedTextMessage doNotPlayInline. + * @member {boolean} doNotPlayInline + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.doNotPlayInline = false; + + /** + * ExtendedTextMessage thumbnailDirectPath. + * @member {string} thumbnailDirectPath + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.thumbnailDirectPath = ""; + + /** + * ExtendedTextMessage thumbnailSha256. + * @member {Uint8Array} thumbnailSha256 + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.thumbnailSha256 = $util.newBuffer([]); + + /** + * ExtendedTextMessage thumbnailEncSha256. + * @member {Uint8Array} thumbnailEncSha256 + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.thumbnailEncSha256 = $util.newBuffer([]); + + /** + * ExtendedTextMessage mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.mediaKey = $util.newBuffer([]); + + /** + * ExtendedTextMessage mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ExtendedTextMessage thumbnailHeight. + * @member {number} thumbnailHeight + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.thumbnailHeight = 0; + + /** + * ExtendedTextMessage thumbnailWidth. + * @member {number} thumbnailWidth + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.thumbnailWidth = 0; + + /** + * ExtendedTextMessage inviteLinkGroupType. + * @member {proto.Message.ExtendedTextMessage.InviteLinkGroupType} inviteLinkGroupType + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.inviteLinkGroupType = 0; + + /** + * ExtendedTextMessage inviteLinkParentGroupSubjectV2. + * @member {string} inviteLinkParentGroupSubjectV2 + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.inviteLinkParentGroupSubjectV2 = ""; + + /** + * ExtendedTextMessage inviteLinkParentGroupThumbnailV2. + * @member {Uint8Array} inviteLinkParentGroupThumbnailV2 + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.inviteLinkParentGroupThumbnailV2 = $util.newBuffer([]); + + /** + * ExtendedTextMessage inviteLinkGroupTypeV2. + * @member {proto.Message.ExtendedTextMessage.InviteLinkGroupType} inviteLinkGroupTypeV2 + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.inviteLinkGroupTypeV2 = 0; + + /** + * ExtendedTextMessage viewOnce. + * @member {boolean} viewOnce + * @memberof proto.Message.ExtendedTextMessage + * @instance + */ + ExtendedTextMessage.prototype.viewOnce = false; + + /** + * Creates a new ExtendedTextMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {proto.Message.IExtendedTextMessage=} [properties] Properties to set + * @returns {proto.Message.ExtendedTextMessage} ExtendedTextMessage instance + */ + ExtendedTextMessage.create = function create(properties) { + return new ExtendedTextMessage(properties); + }; + + /** + * Encodes the specified ExtendedTextMessage message. Does not implicitly {@link proto.Message.ExtendedTextMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {proto.Message.IExtendedTextMessage} message ExtendedTextMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtendedTextMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.matchedText != null && Object.hasOwnProperty.call(message, "matchedText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.matchedText); + if (message.canonicalUrl != null && Object.hasOwnProperty.call(message, "canonicalUrl")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.canonicalUrl); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.title); + if (message.textArgb != null && Object.hasOwnProperty.call(message, "textArgb")) + writer.uint32(/* id 7, wireType 5 =*/61).fixed32(message.textArgb); + if (message.backgroundArgb != null && Object.hasOwnProperty.call(message, "backgroundArgb")) + writer.uint32(/* id 8, wireType 5 =*/69).fixed32(message.backgroundArgb); + if (message.font != null && Object.hasOwnProperty.call(message, "font")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.font); + if (message.previewType != null && Object.hasOwnProperty.call(message, "previewType")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.previewType); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.doNotPlayInline != null && Object.hasOwnProperty.call(message, "doNotPlayInline")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.doNotPlayInline); + if (message.thumbnailDirectPath != null && Object.hasOwnProperty.call(message, "thumbnailDirectPath")) + writer.uint32(/* id 19, wireType 2 =*/154).string(message.thumbnailDirectPath); + if (message.thumbnailSha256 != null && Object.hasOwnProperty.call(message, "thumbnailSha256")) + writer.uint32(/* id 20, wireType 2 =*/162).bytes(message.thumbnailSha256); + if (message.thumbnailEncSha256 != null && Object.hasOwnProperty.call(message, "thumbnailEncSha256")) + writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.thumbnailEncSha256); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 22, wireType 2 =*/178).bytes(message.mediaKey); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 23, wireType 0 =*/184).int64(message.mediaKeyTimestamp); + if (message.thumbnailHeight != null && Object.hasOwnProperty.call(message, "thumbnailHeight")) + writer.uint32(/* id 24, wireType 0 =*/192).uint32(message.thumbnailHeight); + if (message.thumbnailWidth != null && Object.hasOwnProperty.call(message, "thumbnailWidth")) + writer.uint32(/* id 25, wireType 0 =*/200).uint32(message.thumbnailWidth); + if (message.inviteLinkGroupType != null && Object.hasOwnProperty.call(message, "inviteLinkGroupType")) + writer.uint32(/* id 26, wireType 0 =*/208).int32(message.inviteLinkGroupType); + if (message.inviteLinkParentGroupSubjectV2 != null && Object.hasOwnProperty.call(message, "inviteLinkParentGroupSubjectV2")) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.inviteLinkParentGroupSubjectV2); + if (message.inviteLinkParentGroupThumbnailV2 != null && Object.hasOwnProperty.call(message, "inviteLinkParentGroupThumbnailV2")) + writer.uint32(/* id 28, wireType 2 =*/226).bytes(message.inviteLinkParentGroupThumbnailV2); + if (message.inviteLinkGroupTypeV2 != null && Object.hasOwnProperty.call(message, "inviteLinkGroupTypeV2")) + writer.uint32(/* id 29, wireType 0 =*/232).int32(message.inviteLinkGroupTypeV2); + if (message.viewOnce != null && Object.hasOwnProperty.call(message, "viewOnce")) + writer.uint32(/* id 30, wireType 0 =*/240).bool(message.viewOnce); + return writer; + }; + + /** + * Encodes the specified ExtendedTextMessage message, length delimited. Does not implicitly {@link proto.Message.ExtendedTextMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {proto.Message.IExtendedTextMessage} message ExtendedTextMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtendedTextMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtendedTextMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ExtendedTextMessage} ExtendedTextMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtendedTextMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ExtendedTextMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + case 2: + message.matchedText = reader.string(); + break; + case 4: + message.canonicalUrl = reader.string(); + break; + case 5: + message.description = reader.string(); + break; + case 6: + message.title = reader.string(); + break; + case 7: + message.textArgb = reader.fixed32(); + break; + case 8: + message.backgroundArgb = reader.fixed32(); + break; + case 9: + message.font = reader.int32(); + break; + case 10: + message.previewType = reader.int32(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 18: + message.doNotPlayInline = reader.bool(); + break; + case 19: + message.thumbnailDirectPath = reader.string(); + break; + case 20: + message.thumbnailSha256 = reader.bytes(); + break; + case 21: + message.thumbnailEncSha256 = reader.bytes(); + break; + case 22: + message.mediaKey = reader.bytes(); + break; + case 23: + message.mediaKeyTimestamp = reader.int64(); + break; + case 24: + message.thumbnailHeight = reader.uint32(); + break; + case 25: + message.thumbnailWidth = reader.uint32(); + break; + case 26: + message.inviteLinkGroupType = reader.int32(); + break; + case 27: + message.inviteLinkParentGroupSubjectV2 = reader.string(); + break; + case 28: + message.inviteLinkParentGroupThumbnailV2 = reader.bytes(); + break; + case 29: + message.inviteLinkGroupTypeV2 = reader.int32(); + break; + case 30: + message.viewOnce = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtendedTextMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ExtendedTextMessage} ExtendedTextMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtendedTextMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtendedTextMessage message. + * @function verify + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtendedTextMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.matchedText != null && message.hasOwnProperty("matchedText")) + if (!$util.isString(message.matchedText)) + return "matchedText: string expected"; + if (message.canonicalUrl != null && message.hasOwnProperty("canonicalUrl")) + if (!$util.isString(message.canonicalUrl)) + return "canonicalUrl: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.textArgb != null && message.hasOwnProperty("textArgb")) + if (!$util.isInteger(message.textArgb)) + return "textArgb: integer expected"; + if (message.backgroundArgb != null && message.hasOwnProperty("backgroundArgb")) + if (!$util.isInteger(message.backgroundArgb)) + return "backgroundArgb: integer expected"; + if (message.font != null && message.hasOwnProperty("font")) + switch (message.font) { + default: + return "font: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + break; + } + if (message.previewType != null && message.hasOwnProperty("previewType")) + switch (message.previewType) { + default: + return "previewType: enum value expected"; + case 0: + case 1: + break; + } + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.doNotPlayInline != null && message.hasOwnProperty("doNotPlayInline")) + if (typeof message.doNotPlayInline !== "boolean") + return "doNotPlayInline: boolean expected"; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + if (!$util.isString(message.thumbnailDirectPath)) + return "thumbnailDirectPath: string expected"; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + if (!(message.thumbnailSha256 && typeof message.thumbnailSha256.length === "number" || $util.isString(message.thumbnailSha256))) + return "thumbnailSha256: buffer expected"; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + if (!(message.thumbnailEncSha256 && typeof message.thumbnailEncSha256.length === "number" || $util.isString(message.thumbnailEncSha256))) + return "thumbnailEncSha256: buffer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.thumbnailHeight != null && message.hasOwnProperty("thumbnailHeight")) + if (!$util.isInteger(message.thumbnailHeight)) + return "thumbnailHeight: integer expected"; + if (message.thumbnailWidth != null && message.hasOwnProperty("thumbnailWidth")) + if (!$util.isInteger(message.thumbnailWidth)) + return "thumbnailWidth: integer expected"; + if (message.inviteLinkGroupType != null && message.hasOwnProperty("inviteLinkGroupType")) + switch (message.inviteLinkGroupType) { + default: + return "inviteLinkGroupType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.inviteLinkParentGroupSubjectV2 != null && message.hasOwnProperty("inviteLinkParentGroupSubjectV2")) + if (!$util.isString(message.inviteLinkParentGroupSubjectV2)) + return "inviteLinkParentGroupSubjectV2: string expected"; + if (message.inviteLinkParentGroupThumbnailV2 != null && message.hasOwnProperty("inviteLinkParentGroupThumbnailV2")) + if (!(message.inviteLinkParentGroupThumbnailV2 && typeof message.inviteLinkParentGroupThumbnailV2.length === "number" || $util.isString(message.inviteLinkParentGroupThumbnailV2))) + return "inviteLinkParentGroupThumbnailV2: buffer expected"; + if (message.inviteLinkGroupTypeV2 != null && message.hasOwnProperty("inviteLinkGroupTypeV2")) + switch (message.inviteLinkGroupTypeV2) { + default: + return "inviteLinkGroupTypeV2: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + if (typeof message.viewOnce !== "boolean") + return "viewOnce: boolean expected"; + return null; + }; + + /** + * Creates an ExtendedTextMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ExtendedTextMessage} ExtendedTextMessage + */ + ExtendedTextMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ExtendedTextMessage) + return object; + var message = new $root.proto.Message.ExtendedTextMessage(); + if (object.text != null) + message.text = String(object.text); + if (object.matchedText != null) + message.matchedText = String(object.matchedText); + if (object.canonicalUrl != null) + message.canonicalUrl = String(object.canonicalUrl); + if (object.description != null) + message.description = String(object.description); + if (object.title != null) + message.title = String(object.title); + if (object.textArgb != null) + message.textArgb = object.textArgb >>> 0; + if (object.backgroundArgb != null) + message.backgroundArgb = object.backgroundArgb >>> 0; + switch (object.font) { + case "SANS_SERIF": + case 0: + message.font = 0; + break; + case "SERIF": + case 1: + message.font = 1; + break; + case "NORICAN_REGULAR": + case 2: + message.font = 2; + break; + case "BRYNDAN_WRITE": + case 3: + message.font = 3; + break; + case "BEBASNEUE_REGULAR": + case 4: + message.font = 4; + break; + case "OSWALD_HEAVY": + case 5: + message.font = 5; + break; + case "DAMION_REGULAR": + case 6: + message.font = 6; + break; + case "MORNINGBREEZE_REGULAR": + case 7: + message.font = 7; + break; + case "CALISTOGA_REGULAR": + case 8: + message.font = 8; + break; + case "EXO2_EXTRABOLD": + case 9: + message.font = 9; + break; + case "COURIERPRIME_BOLD": + case 10: + message.font = 10; + break; + } + switch (object.previewType) { + case "NONE": + case 0: + message.previewType = 0; + break; + case "VIDEO": + case 1: + message.previewType = 1; + break; + } + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ExtendedTextMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.doNotPlayInline != null) + message.doNotPlayInline = Boolean(object.doNotPlayInline); + if (object.thumbnailDirectPath != null) + message.thumbnailDirectPath = String(object.thumbnailDirectPath); + if (object.thumbnailSha256 != null) + if (typeof object.thumbnailSha256 === "string") + $util.base64.decode(object.thumbnailSha256, message.thumbnailSha256 = $util.newBuffer($util.base64.length(object.thumbnailSha256)), 0); + else if (object.thumbnailSha256.length) + message.thumbnailSha256 = object.thumbnailSha256; + if (object.thumbnailEncSha256 != null) + if (typeof object.thumbnailEncSha256 === "string") + $util.base64.decode(object.thumbnailEncSha256, message.thumbnailEncSha256 = $util.newBuffer($util.base64.length(object.thumbnailEncSha256)), 0); + else if (object.thumbnailEncSha256.length) + message.thumbnailEncSha256 = object.thumbnailEncSha256; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.thumbnailHeight != null) + message.thumbnailHeight = object.thumbnailHeight >>> 0; + if (object.thumbnailWidth != null) + message.thumbnailWidth = object.thumbnailWidth >>> 0; + switch (object.inviteLinkGroupType) { + case "DEFAULT": + case 0: + message.inviteLinkGroupType = 0; + break; + case "PARENT": + case 1: + message.inviteLinkGroupType = 1; + break; + case "SUB": + case 2: + message.inviteLinkGroupType = 2; + break; + case "DEFAULT_SUB": + case 3: + message.inviteLinkGroupType = 3; + break; + } + if (object.inviteLinkParentGroupSubjectV2 != null) + message.inviteLinkParentGroupSubjectV2 = String(object.inviteLinkParentGroupSubjectV2); + if (object.inviteLinkParentGroupThumbnailV2 != null) + if (typeof object.inviteLinkParentGroupThumbnailV2 === "string") + $util.base64.decode(object.inviteLinkParentGroupThumbnailV2, message.inviteLinkParentGroupThumbnailV2 = $util.newBuffer($util.base64.length(object.inviteLinkParentGroupThumbnailV2)), 0); + else if (object.inviteLinkParentGroupThumbnailV2.length) + message.inviteLinkParentGroupThumbnailV2 = object.inviteLinkParentGroupThumbnailV2; + switch (object.inviteLinkGroupTypeV2) { + case "DEFAULT": + case 0: + message.inviteLinkGroupTypeV2 = 0; + break; + case "PARENT": + case 1: + message.inviteLinkGroupTypeV2 = 1; + break; + case "SUB": + case 2: + message.inviteLinkGroupTypeV2 = 2; + break; + case "DEFAULT_SUB": + case 3: + message.inviteLinkGroupTypeV2 = 3; + break; + } + if (object.viewOnce != null) + message.viewOnce = Boolean(object.viewOnce); + return message; + }; + + /** + * Creates a plain object from an ExtendedTextMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ExtendedTextMessage + * @static + * @param {proto.Message.ExtendedTextMessage} message ExtendedTextMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtendedTextMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.matchedText = ""; + object.canonicalUrl = ""; + object.description = ""; + object.title = ""; + object.textArgb = 0; + object.backgroundArgb = 0; + object.font = options.enums === String ? "SANS_SERIF" : 0; + object.previewType = options.enums === String ? "NONE" : 0; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.contextInfo = null; + object.doNotPlayInline = false; + object.thumbnailDirectPath = ""; + if (options.bytes === String) + object.thumbnailSha256 = ""; + else { + object.thumbnailSha256 = []; + if (options.bytes !== Array) + object.thumbnailSha256 = $util.newBuffer(object.thumbnailSha256); + } + if (options.bytes === String) + object.thumbnailEncSha256 = ""; + else { + object.thumbnailEncSha256 = []; + if (options.bytes !== Array) + object.thumbnailEncSha256 = $util.newBuffer(object.thumbnailEncSha256); + } + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + object.thumbnailHeight = 0; + object.thumbnailWidth = 0; + object.inviteLinkGroupType = options.enums === String ? "DEFAULT" : 0; + object.inviteLinkParentGroupSubjectV2 = ""; + if (options.bytes === String) + object.inviteLinkParentGroupThumbnailV2 = ""; + else { + object.inviteLinkParentGroupThumbnailV2 = []; + if (options.bytes !== Array) + object.inviteLinkParentGroupThumbnailV2 = $util.newBuffer(object.inviteLinkParentGroupThumbnailV2); + } + object.inviteLinkGroupTypeV2 = options.enums === String ? "DEFAULT" : 0; + object.viewOnce = false; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.matchedText != null && message.hasOwnProperty("matchedText")) + object.matchedText = message.matchedText; + if (message.canonicalUrl != null && message.hasOwnProperty("canonicalUrl")) + object.canonicalUrl = message.canonicalUrl; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.textArgb != null && message.hasOwnProperty("textArgb")) + object.textArgb = message.textArgb; + if (message.backgroundArgb != null && message.hasOwnProperty("backgroundArgb")) + object.backgroundArgb = message.backgroundArgb; + if (message.font != null && message.hasOwnProperty("font")) + object.font = options.enums === String ? $root.proto.Message.ExtendedTextMessage.FontType[message.font] : message.font; + if (message.previewType != null && message.hasOwnProperty("previewType")) + object.previewType = options.enums === String ? $root.proto.Message.ExtendedTextMessage.PreviewType[message.previewType] : message.previewType; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.doNotPlayInline != null && message.hasOwnProperty("doNotPlayInline")) + object.doNotPlayInline = message.doNotPlayInline; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + object.thumbnailDirectPath = message.thumbnailDirectPath; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + object.thumbnailSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailSha256, 0, message.thumbnailSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailSha256) : message.thumbnailSha256; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + object.thumbnailEncSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailEncSha256, 0, message.thumbnailEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailEncSha256) : message.thumbnailEncSha256; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.thumbnailHeight != null && message.hasOwnProperty("thumbnailHeight")) + object.thumbnailHeight = message.thumbnailHeight; + if (message.thumbnailWidth != null && message.hasOwnProperty("thumbnailWidth")) + object.thumbnailWidth = message.thumbnailWidth; + if (message.inviteLinkGroupType != null && message.hasOwnProperty("inviteLinkGroupType")) + object.inviteLinkGroupType = options.enums === String ? $root.proto.Message.ExtendedTextMessage.InviteLinkGroupType[message.inviteLinkGroupType] : message.inviteLinkGroupType; + if (message.inviteLinkParentGroupSubjectV2 != null && message.hasOwnProperty("inviteLinkParentGroupSubjectV2")) + object.inviteLinkParentGroupSubjectV2 = message.inviteLinkParentGroupSubjectV2; + if (message.inviteLinkParentGroupThumbnailV2 != null && message.hasOwnProperty("inviteLinkParentGroupThumbnailV2")) + object.inviteLinkParentGroupThumbnailV2 = options.bytes === String ? $util.base64.encode(message.inviteLinkParentGroupThumbnailV2, 0, message.inviteLinkParentGroupThumbnailV2.length) : options.bytes === Array ? Array.prototype.slice.call(message.inviteLinkParentGroupThumbnailV2) : message.inviteLinkParentGroupThumbnailV2; + if (message.inviteLinkGroupTypeV2 != null && message.hasOwnProperty("inviteLinkGroupTypeV2")) + object.inviteLinkGroupTypeV2 = options.enums === String ? $root.proto.Message.ExtendedTextMessage.InviteLinkGroupType[message.inviteLinkGroupTypeV2] : message.inviteLinkGroupTypeV2; + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + object.viewOnce = message.viewOnce; + return object; + }; + + /** + * Converts this ExtendedTextMessage to JSON. + * @function toJSON + * @memberof proto.Message.ExtendedTextMessage + * @instance + * @returns {Object.} JSON object + */ + ExtendedTextMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * FontType enum. + * @name proto.Message.ExtendedTextMessage.FontType + * @enum {number} + * @property {number} SANS_SERIF=0 SANS_SERIF value + * @property {number} SERIF=1 SERIF value + * @property {number} NORICAN_REGULAR=2 NORICAN_REGULAR value + * @property {number} BRYNDAN_WRITE=3 BRYNDAN_WRITE value + * @property {number} BEBASNEUE_REGULAR=4 BEBASNEUE_REGULAR value + * @property {number} OSWALD_HEAVY=5 OSWALD_HEAVY value + * @property {number} DAMION_REGULAR=6 DAMION_REGULAR value + * @property {number} MORNINGBREEZE_REGULAR=7 MORNINGBREEZE_REGULAR value + * @property {number} CALISTOGA_REGULAR=8 CALISTOGA_REGULAR value + * @property {number} EXO2_EXTRABOLD=9 EXO2_EXTRABOLD value + * @property {number} COURIERPRIME_BOLD=10 COURIERPRIME_BOLD value + */ + ExtendedTextMessage.FontType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SANS_SERIF"] = 0; + values[valuesById[1] = "SERIF"] = 1; + values[valuesById[2] = "NORICAN_REGULAR"] = 2; + values[valuesById[3] = "BRYNDAN_WRITE"] = 3; + values[valuesById[4] = "BEBASNEUE_REGULAR"] = 4; + values[valuesById[5] = "OSWALD_HEAVY"] = 5; + values[valuesById[6] = "DAMION_REGULAR"] = 6; + values[valuesById[7] = "MORNINGBREEZE_REGULAR"] = 7; + values[valuesById[8] = "CALISTOGA_REGULAR"] = 8; + values[valuesById[9] = "EXO2_EXTRABOLD"] = 9; + values[valuesById[10] = "COURIERPRIME_BOLD"] = 10; + return values; + })(); + + /** + * InviteLinkGroupType enum. + * @name proto.Message.ExtendedTextMessage.InviteLinkGroupType + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} PARENT=1 PARENT value + * @property {number} SUB=2 SUB value + * @property {number} DEFAULT_SUB=3 DEFAULT_SUB value + */ + ExtendedTextMessage.InviteLinkGroupType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "PARENT"] = 1; + values[valuesById[2] = "SUB"] = 2; + values[valuesById[3] = "DEFAULT_SUB"] = 3; + return values; + })(); + + /** + * PreviewType enum. + * @name proto.Message.ExtendedTextMessage.PreviewType + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} VIDEO=1 VIDEO value + */ + ExtendedTextMessage.PreviewType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "VIDEO"] = 1; + return values; + })(); + + return ExtendedTextMessage; + })(); + + Message.FutureProofMessage = (function() { + + /** + * Properties of a FutureProofMessage. + * @memberof proto.Message + * @interface IFutureProofMessage + * @property {proto.IMessage|null} [message] FutureProofMessage message + */ + + /** + * Constructs a new FutureProofMessage. + * @memberof proto.Message + * @classdesc Represents a FutureProofMessage. + * @implements IFutureProofMessage + * @constructor + * @param {proto.Message.IFutureProofMessage=} [properties] Properties to set + */ + function FutureProofMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FutureProofMessage message. + * @member {proto.IMessage|null|undefined} message + * @memberof proto.Message.FutureProofMessage + * @instance + */ + FutureProofMessage.prototype.message = null; + + /** + * Creates a new FutureProofMessage instance using the specified properties. + * @function create + * @memberof proto.Message.FutureProofMessage + * @static + * @param {proto.Message.IFutureProofMessage=} [properties] Properties to set + * @returns {proto.Message.FutureProofMessage} FutureProofMessage instance + */ + FutureProofMessage.create = function create(properties) { + return new FutureProofMessage(properties); + }; + + /** + * Encodes the specified FutureProofMessage message. Does not implicitly {@link proto.Message.FutureProofMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.FutureProofMessage + * @static + * @param {proto.Message.IFutureProofMessage} message FutureProofMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FutureProofMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.proto.Message.encode(message.message, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FutureProofMessage message, length delimited. Does not implicitly {@link proto.Message.FutureProofMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.FutureProofMessage + * @static + * @param {proto.Message.IFutureProofMessage} message FutureProofMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FutureProofMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FutureProofMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.FutureProofMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.FutureProofMessage} FutureProofMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FutureProofMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.FutureProofMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = $root.proto.Message.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FutureProofMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.FutureProofMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.FutureProofMessage} FutureProofMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FutureProofMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FutureProofMessage message. + * @function verify + * @memberof proto.Message.FutureProofMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FutureProofMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.proto.Message.verify(message.message); + if (error) + return "message." + error; + } + return null; + }; + + /** + * Creates a FutureProofMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.FutureProofMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.FutureProofMessage} FutureProofMessage + */ + FutureProofMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.FutureProofMessage) + return object; + var message = new $root.proto.Message.FutureProofMessage(); + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".proto.Message.FutureProofMessage.message: object expected"); + message.message = $root.proto.Message.fromObject(object.message); + } + return message; + }; + + /** + * Creates a plain object from a FutureProofMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.FutureProofMessage + * @static + * @param {proto.Message.FutureProofMessage} message FutureProofMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FutureProofMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.message = null; + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.proto.Message.toObject(message.message, options); + return object; + }; + + /** + * Converts this FutureProofMessage to JSON. + * @function toJSON + * @memberof proto.Message.FutureProofMessage + * @instance + * @returns {Object.} JSON object + */ + FutureProofMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FutureProofMessage; + })(); + + Message.GroupInviteMessage = (function() { + + /** + * Properties of a GroupInviteMessage. + * @memberof proto.Message + * @interface IGroupInviteMessage + * @property {string|null} [groupJid] GroupInviteMessage groupJid + * @property {string|null} [inviteCode] GroupInviteMessage inviteCode + * @property {number|Long|null} [inviteExpiration] GroupInviteMessage inviteExpiration + * @property {string|null} [groupName] GroupInviteMessage groupName + * @property {Uint8Array|null} [jpegThumbnail] GroupInviteMessage jpegThumbnail + * @property {string|null} [caption] GroupInviteMessage caption + * @property {proto.IContextInfo|null} [contextInfo] GroupInviteMessage contextInfo + * @property {proto.Message.GroupInviteMessage.GroupType|null} [groupType] GroupInviteMessage groupType + */ + + /** + * Constructs a new GroupInviteMessage. + * @memberof proto.Message + * @classdesc Represents a GroupInviteMessage. + * @implements IGroupInviteMessage + * @constructor + * @param {proto.Message.IGroupInviteMessage=} [properties] Properties to set + */ + function GroupInviteMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GroupInviteMessage groupJid. + * @member {string} groupJid + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.groupJid = ""; + + /** + * GroupInviteMessage inviteCode. + * @member {string} inviteCode + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.inviteCode = ""; + + /** + * GroupInviteMessage inviteExpiration. + * @member {number|Long} inviteExpiration + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.inviteExpiration = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * GroupInviteMessage groupName. + * @member {string} groupName + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.groupName = ""; + + /** + * GroupInviteMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * GroupInviteMessage caption. + * @member {string} caption + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.caption = ""; + + /** + * GroupInviteMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.contextInfo = null; + + /** + * GroupInviteMessage groupType. + * @member {proto.Message.GroupInviteMessage.GroupType} groupType + * @memberof proto.Message.GroupInviteMessage + * @instance + */ + GroupInviteMessage.prototype.groupType = 0; + + /** + * Creates a new GroupInviteMessage instance using the specified properties. + * @function create + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {proto.Message.IGroupInviteMessage=} [properties] Properties to set + * @returns {proto.Message.GroupInviteMessage} GroupInviteMessage instance + */ + GroupInviteMessage.create = function create(properties) { + return new GroupInviteMessage(properties); + }; + + /** + * Encodes the specified GroupInviteMessage message. Does not implicitly {@link proto.Message.GroupInviteMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {proto.Message.IGroupInviteMessage} message GroupInviteMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroupInviteMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.groupJid != null && Object.hasOwnProperty.call(message, "groupJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.groupJid); + if (message.inviteCode != null && Object.hasOwnProperty.call(message, "inviteCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inviteCode); + if (message.inviteExpiration != null && Object.hasOwnProperty.call(message, "inviteExpiration")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.inviteExpiration); + if (message.groupName != null && Object.hasOwnProperty.call(message, "groupName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.groupName); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.jpegThumbnail); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.caption); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.groupType != null && Object.hasOwnProperty.call(message, "groupType")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.groupType); + return writer; + }; + + /** + * Encodes the specified GroupInviteMessage message, length delimited. Does not implicitly {@link proto.Message.GroupInviteMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {proto.Message.IGroupInviteMessage} message GroupInviteMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroupInviteMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GroupInviteMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.GroupInviteMessage} GroupInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroupInviteMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.GroupInviteMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupJid = reader.string(); + break; + case 2: + message.inviteCode = reader.string(); + break; + case 3: + message.inviteExpiration = reader.int64(); + break; + case 4: + message.groupName = reader.string(); + break; + case 5: + message.jpegThumbnail = reader.bytes(); + break; + case 6: + message.caption = reader.string(); + break; + case 7: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 8: + message.groupType = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GroupInviteMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.GroupInviteMessage} GroupInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroupInviteMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GroupInviteMessage message. + * @function verify + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GroupInviteMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.groupJid != null && message.hasOwnProperty("groupJid")) + if (!$util.isString(message.groupJid)) + return "groupJid: string expected"; + if (message.inviteCode != null && message.hasOwnProperty("inviteCode")) + if (!$util.isString(message.inviteCode)) + return "inviteCode: string expected"; + if (message.inviteExpiration != null && message.hasOwnProperty("inviteExpiration")) + if (!$util.isInteger(message.inviteExpiration) && !(message.inviteExpiration && $util.isInteger(message.inviteExpiration.low) && $util.isInteger(message.inviteExpiration.high))) + return "inviteExpiration: integer|Long expected"; + if (message.groupName != null && message.hasOwnProperty("groupName")) + if (!$util.isString(message.groupName)) + return "groupName: string expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.groupType != null && message.hasOwnProperty("groupType")) + switch (message.groupType) { + default: + return "groupType: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a GroupInviteMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.GroupInviteMessage} GroupInviteMessage + */ + GroupInviteMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.GroupInviteMessage) + return object; + var message = new $root.proto.Message.GroupInviteMessage(); + if (object.groupJid != null) + message.groupJid = String(object.groupJid); + if (object.inviteCode != null) + message.inviteCode = String(object.inviteCode); + if (object.inviteExpiration != null) + if ($util.Long) + (message.inviteExpiration = $util.Long.fromValue(object.inviteExpiration)).unsigned = false; + else if (typeof object.inviteExpiration === "string") + message.inviteExpiration = parseInt(object.inviteExpiration, 10); + else if (typeof object.inviteExpiration === "number") + message.inviteExpiration = object.inviteExpiration; + else if (typeof object.inviteExpiration === "object") + message.inviteExpiration = new $util.LongBits(object.inviteExpiration.low >>> 0, object.inviteExpiration.high >>> 0).toNumber(); + if (object.groupName != null) + message.groupName = String(object.groupName); + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.caption != null) + message.caption = String(object.caption); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.GroupInviteMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + switch (object.groupType) { + case "DEFAULT": + case 0: + message.groupType = 0; + break; + case "PARENT": + case 1: + message.groupType = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a GroupInviteMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.GroupInviteMessage + * @static + * @param {proto.Message.GroupInviteMessage} message GroupInviteMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GroupInviteMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.groupJid = ""; + object.inviteCode = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.inviteExpiration = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.inviteExpiration = options.longs === String ? "0" : 0; + object.groupName = ""; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.caption = ""; + object.contextInfo = null; + object.groupType = options.enums === String ? "DEFAULT" : 0; + } + if (message.groupJid != null && message.hasOwnProperty("groupJid")) + object.groupJid = message.groupJid; + if (message.inviteCode != null && message.hasOwnProperty("inviteCode")) + object.inviteCode = message.inviteCode; + if (message.inviteExpiration != null && message.hasOwnProperty("inviteExpiration")) + if (typeof message.inviteExpiration === "number") + object.inviteExpiration = options.longs === String ? String(message.inviteExpiration) : message.inviteExpiration; + else + object.inviteExpiration = options.longs === String ? $util.Long.prototype.toString.call(message.inviteExpiration) : options.longs === Number ? new $util.LongBits(message.inviteExpiration.low >>> 0, message.inviteExpiration.high >>> 0).toNumber() : message.inviteExpiration; + if (message.groupName != null && message.hasOwnProperty("groupName")) + object.groupName = message.groupName; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.groupType != null && message.hasOwnProperty("groupType")) + object.groupType = options.enums === String ? $root.proto.Message.GroupInviteMessage.GroupType[message.groupType] : message.groupType; + return object; + }; + + /** + * Converts this GroupInviteMessage to JSON. + * @function toJSON + * @memberof proto.Message.GroupInviteMessage + * @instance + * @returns {Object.} JSON object + */ + GroupInviteMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * GroupType enum. + * @name proto.Message.GroupInviteMessage.GroupType + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} PARENT=1 PARENT value + */ + GroupInviteMessage.GroupType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "PARENT"] = 1; + return values; + })(); + + return GroupInviteMessage; + })(); + + Message.HighlyStructuredMessage = (function() { + + /** + * Properties of a HighlyStructuredMessage. + * @memberof proto.Message + * @interface IHighlyStructuredMessage + * @property {string|null} [namespace] HighlyStructuredMessage namespace + * @property {string|null} [elementName] HighlyStructuredMessage elementName + * @property {Array.|null} [params] HighlyStructuredMessage params + * @property {string|null} [fallbackLg] HighlyStructuredMessage fallbackLg + * @property {string|null} [fallbackLc] HighlyStructuredMessage fallbackLc + * @property {Array.|null} [localizableParams] HighlyStructuredMessage localizableParams + * @property {string|null} [deterministicLg] HighlyStructuredMessage deterministicLg + * @property {string|null} [deterministicLc] HighlyStructuredMessage deterministicLc + * @property {proto.Message.ITemplateMessage|null} [hydratedHsm] HighlyStructuredMessage hydratedHsm + */ + + /** + * Constructs a new HighlyStructuredMessage. + * @memberof proto.Message + * @classdesc Represents a HighlyStructuredMessage. + * @implements IHighlyStructuredMessage + * @constructor + * @param {proto.Message.IHighlyStructuredMessage=} [properties] Properties to set + */ + function HighlyStructuredMessage(properties) { + this.params = []; + this.localizableParams = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HighlyStructuredMessage namespace. + * @member {string} namespace + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.namespace = ""; + + /** + * HighlyStructuredMessage elementName. + * @member {string} elementName + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.elementName = ""; + + /** + * HighlyStructuredMessage params. + * @member {Array.} params + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.params = $util.emptyArray; + + /** + * HighlyStructuredMessage fallbackLg. + * @member {string} fallbackLg + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.fallbackLg = ""; + + /** + * HighlyStructuredMessage fallbackLc. + * @member {string} fallbackLc + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.fallbackLc = ""; + + /** + * HighlyStructuredMessage localizableParams. + * @member {Array.} localizableParams + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.localizableParams = $util.emptyArray; + + /** + * HighlyStructuredMessage deterministicLg. + * @member {string} deterministicLg + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.deterministicLg = ""; + + /** + * HighlyStructuredMessage deterministicLc. + * @member {string} deterministicLc + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.deterministicLc = ""; + + /** + * HighlyStructuredMessage hydratedHsm. + * @member {proto.Message.ITemplateMessage|null|undefined} hydratedHsm + * @memberof proto.Message.HighlyStructuredMessage + * @instance + */ + HighlyStructuredMessage.prototype.hydratedHsm = null; + + /** + * Creates a new HighlyStructuredMessage instance using the specified properties. + * @function create + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {proto.Message.IHighlyStructuredMessage=} [properties] Properties to set + * @returns {proto.Message.HighlyStructuredMessage} HighlyStructuredMessage instance + */ + HighlyStructuredMessage.create = function create(properties) { + return new HighlyStructuredMessage(properties); + }; + + /** + * Encodes the specified HighlyStructuredMessage message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {proto.Message.IHighlyStructuredMessage} message HighlyStructuredMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HighlyStructuredMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.namespace != null && Object.hasOwnProperty.call(message, "namespace")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namespace); + if (message.elementName != null && Object.hasOwnProperty.call(message, "elementName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.elementName); + if (message.params != null && message.params.length) + for (var i = 0; i < message.params.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.params[i]); + if (message.fallbackLg != null && Object.hasOwnProperty.call(message, "fallbackLg")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fallbackLg); + if (message.fallbackLc != null && Object.hasOwnProperty.call(message, "fallbackLc")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.fallbackLc); + if (message.localizableParams != null && message.localizableParams.length) + for (var i = 0; i < message.localizableParams.length; ++i) + $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.encode(message.localizableParams[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.deterministicLg != null && Object.hasOwnProperty.call(message, "deterministicLg")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.deterministicLg); + if (message.deterministicLc != null && Object.hasOwnProperty.call(message, "deterministicLc")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.deterministicLc); + if (message.hydratedHsm != null && Object.hasOwnProperty.call(message, "hydratedHsm")) + $root.proto.Message.TemplateMessage.encode(message.hydratedHsm, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HighlyStructuredMessage message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {proto.Message.IHighlyStructuredMessage} message HighlyStructuredMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HighlyStructuredMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HighlyStructuredMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HighlyStructuredMessage} HighlyStructuredMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HighlyStructuredMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HighlyStructuredMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namespace = reader.string(); + break; + case 2: + message.elementName = reader.string(); + break; + case 3: + if (!(message.params && message.params.length)) + message.params = []; + message.params.push(reader.string()); + break; + case 4: + message.fallbackLg = reader.string(); + break; + case 5: + message.fallbackLc = reader.string(); + break; + case 6: + if (!(message.localizableParams && message.localizableParams.length)) + message.localizableParams = []; + message.localizableParams.push($root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.decode(reader, reader.uint32())); + break; + case 7: + message.deterministicLg = reader.string(); + break; + case 8: + message.deterministicLc = reader.string(); + break; + case 9: + message.hydratedHsm = $root.proto.Message.TemplateMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HighlyStructuredMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HighlyStructuredMessage} HighlyStructuredMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HighlyStructuredMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HighlyStructuredMessage message. + * @function verify + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HighlyStructuredMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.namespace != null && message.hasOwnProperty("namespace")) + if (!$util.isString(message.namespace)) + return "namespace: string expected"; + if (message.elementName != null && message.hasOwnProperty("elementName")) + if (!$util.isString(message.elementName)) + return "elementName: string expected"; + if (message.params != null && message.hasOwnProperty("params")) { + if (!Array.isArray(message.params)) + return "params: array expected"; + for (var i = 0; i < message.params.length; ++i) + if (!$util.isString(message.params[i])) + return "params: string[] expected"; + } + if (message.fallbackLg != null && message.hasOwnProperty("fallbackLg")) + if (!$util.isString(message.fallbackLg)) + return "fallbackLg: string expected"; + if (message.fallbackLc != null && message.hasOwnProperty("fallbackLc")) + if (!$util.isString(message.fallbackLc)) + return "fallbackLc: string expected"; + if (message.localizableParams != null && message.hasOwnProperty("localizableParams")) { + if (!Array.isArray(message.localizableParams)) + return "localizableParams: array expected"; + for (var i = 0; i < message.localizableParams.length; ++i) { + var error = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.verify(message.localizableParams[i]); + if (error) + return "localizableParams." + error; + } + } + if (message.deterministicLg != null && message.hasOwnProperty("deterministicLg")) + if (!$util.isString(message.deterministicLg)) + return "deterministicLg: string expected"; + if (message.deterministicLc != null && message.hasOwnProperty("deterministicLc")) + if (!$util.isString(message.deterministicLc)) + return "deterministicLc: string expected"; + if (message.hydratedHsm != null && message.hasOwnProperty("hydratedHsm")) { + var error = $root.proto.Message.TemplateMessage.verify(message.hydratedHsm); + if (error) + return "hydratedHsm." + error; + } + return null; + }; + + /** + * Creates a HighlyStructuredMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HighlyStructuredMessage} HighlyStructuredMessage + */ + HighlyStructuredMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HighlyStructuredMessage) + return object; + var message = new $root.proto.Message.HighlyStructuredMessage(); + if (object.namespace != null) + message.namespace = String(object.namespace); + if (object.elementName != null) + message.elementName = String(object.elementName); + if (object.params) { + if (!Array.isArray(object.params)) + throw TypeError(".proto.Message.HighlyStructuredMessage.params: array expected"); + message.params = []; + for (var i = 0; i < object.params.length; ++i) + message.params[i] = String(object.params[i]); + } + if (object.fallbackLg != null) + message.fallbackLg = String(object.fallbackLg); + if (object.fallbackLc != null) + message.fallbackLc = String(object.fallbackLc); + if (object.localizableParams) { + if (!Array.isArray(object.localizableParams)) + throw TypeError(".proto.Message.HighlyStructuredMessage.localizableParams: array expected"); + message.localizableParams = []; + for (var i = 0; i < object.localizableParams.length; ++i) { + if (typeof object.localizableParams[i] !== "object") + throw TypeError(".proto.Message.HighlyStructuredMessage.localizableParams: object expected"); + message.localizableParams[i] = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.fromObject(object.localizableParams[i]); + } + } + if (object.deterministicLg != null) + message.deterministicLg = String(object.deterministicLg); + if (object.deterministicLc != null) + message.deterministicLc = String(object.deterministicLc); + if (object.hydratedHsm != null) { + if (typeof object.hydratedHsm !== "object") + throw TypeError(".proto.Message.HighlyStructuredMessage.hydratedHsm: object expected"); + message.hydratedHsm = $root.proto.Message.TemplateMessage.fromObject(object.hydratedHsm); + } + return message; + }; + + /** + * Creates a plain object from a HighlyStructuredMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HighlyStructuredMessage + * @static + * @param {proto.Message.HighlyStructuredMessage} message HighlyStructuredMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HighlyStructuredMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.params = []; + object.localizableParams = []; + } + if (options.defaults) { + object.namespace = ""; + object.elementName = ""; + object.fallbackLg = ""; + object.fallbackLc = ""; + object.deterministicLg = ""; + object.deterministicLc = ""; + object.hydratedHsm = null; + } + if (message.namespace != null && message.hasOwnProperty("namespace")) + object.namespace = message.namespace; + if (message.elementName != null && message.hasOwnProperty("elementName")) + object.elementName = message.elementName; + if (message.params && message.params.length) { + object.params = []; + for (var j = 0; j < message.params.length; ++j) + object.params[j] = message.params[j]; + } + if (message.fallbackLg != null && message.hasOwnProperty("fallbackLg")) + object.fallbackLg = message.fallbackLg; + if (message.fallbackLc != null && message.hasOwnProperty("fallbackLc")) + object.fallbackLc = message.fallbackLc; + if (message.localizableParams && message.localizableParams.length) { + object.localizableParams = []; + for (var j = 0; j < message.localizableParams.length; ++j) + object.localizableParams[j] = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.toObject(message.localizableParams[j], options); + } + if (message.deterministicLg != null && message.hasOwnProperty("deterministicLg")) + object.deterministicLg = message.deterministicLg; + if (message.deterministicLc != null && message.hasOwnProperty("deterministicLc")) + object.deterministicLc = message.deterministicLc; + if (message.hydratedHsm != null && message.hasOwnProperty("hydratedHsm")) + object.hydratedHsm = $root.proto.Message.TemplateMessage.toObject(message.hydratedHsm, options); + return object; + }; + + /** + * Converts this HighlyStructuredMessage to JSON. + * @function toJSON + * @memberof proto.Message.HighlyStructuredMessage + * @instance + * @returns {Object.} JSON object + */ + HighlyStructuredMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + HighlyStructuredMessage.HSMLocalizableParameter = (function() { + + /** + * Properties of a HSMLocalizableParameter. + * @memberof proto.Message.HighlyStructuredMessage + * @interface IHSMLocalizableParameter + * @property {string|null} ["default"] HSMLocalizableParameter default + * @property {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency|null} [currency] HSMLocalizableParameter currency + * @property {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime|null} [dateTime] HSMLocalizableParameter dateTime + */ + + /** + * Constructs a new HSMLocalizableParameter. + * @memberof proto.Message.HighlyStructuredMessage + * @classdesc Represents a HSMLocalizableParameter. + * @implements IHSMLocalizableParameter + * @constructor + * @param {proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter=} [properties] Properties to set + */ + function HSMLocalizableParameter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HSMLocalizableParameter default. + * @member {string} default + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @instance + */ + HSMLocalizableParameter.prototype["default"] = ""; + + /** + * HSMLocalizableParameter currency. + * @member {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency|null|undefined} currency + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @instance + */ + HSMLocalizableParameter.prototype.currency = null; + + /** + * HSMLocalizableParameter dateTime. + * @member {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime|null|undefined} dateTime + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @instance + */ + HSMLocalizableParameter.prototype.dateTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HSMLocalizableParameter paramOneof. + * @member {"currency"|"dateTime"|undefined} paramOneof + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @instance + */ + Object.defineProperty(HSMLocalizableParameter.prototype, "paramOneof", { + get: $util.oneOfGetter($oneOfFields = ["currency", "dateTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HSMLocalizableParameter instance using the specified properties. + * @function create + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter=} [properties] Properties to set + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter} HSMLocalizableParameter instance + */ + HSMLocalizableParameter.create = function create(properties) { + return new HSMLocalizableParameter(properties); + }; + + /** + * Encodes the specified HSMLocalizableParameter message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.verify|verify} messages. + * @function encode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter} message HSMLocalizableParameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMLocalizableParameter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["default"] != null && Object.hasOwnProperty.call(message, "default")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message["default"]); + if (message.currency != null && Object.hasOwnProperty.call(message, "currency")) + $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.encode(message.currency, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dateTime != null && Object.hasOwnProperty.call(message, "dateTime")) + $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.encode(message.dateTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HSMLocalizableParameter message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {proto.Message.HighlyStructuredMessage.IHSMLocalizableParameter} message HSMLocalizableParameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMLocalizableParameter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HSMLocalizableParameter message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter} HSMLocalizableParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMLocalizableParameter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["default"] = reader.string(); + break; + case 2: + message.currency = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.decode(reader, reader.uint32()); + break; + case 3: + message.dateTime = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HSMLocalizableParameter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter} HSMLocalizableParameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMLocalizableParameter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HSMLocalizableParameter message. + * @function verify + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HSMLocalizableParameter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message["default"] != null && message.hasOwnProperty("default")) + if (!$util.isString(message["default"])) + return "default: string expected"; + if (message.currency != null && message.hasOwnProperty("currency")) { + properties.paramOneof = 1; + { + var error = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.verify(message.currency); + if (error) + return "currency." + error; + } + } + if (message.dateTime != null && message.hasOwnProperty("dateTime")) { + if (properties.paramOneof === 1) + return "paramOneof: multiple values"; + properties.paramOneof = 1; + { + var error = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.verify(message.dateTime); + if (error) + return "dateTime." + error; + } + } + return null; + }; + + /** + * Creates a HSMLocalizableParameter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter} HSMLocalizableParameter + */ + HSMLocalizableParameter.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter) + return object; + var message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter(); + if (object["default"] != null) + message["default"] = String(object["default"]); + if (object.currency != null) { + if (typeof object.currency !== "object") + throw TypeError(".proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.currency: object expected"); + message.currency = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.fromObject(object.currency); + } + if (object.dateTime != null) { + if (typeof object.dateTime !== "object") + throw TypeError(".proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.dateTime: object expected"); + message.dateTime = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.fromObject(object.dateTime); + } + return message; + }; + + /** + * Creates a plain object from a HSMLocalizableParameter message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter} message HSMLocalizableParameter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HSMLocalizableParameter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object["default"] = ""; + if (message["default"] != null && message.hasOwnProperty("default")) + object["default"] = message["default"]; + if (message.currency != null && message.hasOwnProperty("currency")) { + object.currency = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.toObject(message.currency, options); + if (options.oneofs) + object.paramOneof = "currency"; + } + if (message.dateTime != null && message.hasOwnProperty("dateTime")) { + object.dateTime = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.toObject(message.dateTime, options); + if (options.oneofs) + object.paramOneof = "dateTime"; + } + return object; + }; + + /** + * Converts this HSMLocalizableParameter to JSON. + * @function toJSON + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @instance + * @returns {Object.} JSON object + */ + HSMLocalizableParameter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + HSMLocalizableParameter.HSMCurrency = (function() { + + /** + * Properties of a HSMCurrency. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @interface IHSMCurrency + * @property {string|null} [currencyCode] HSMCurrency currencyCode + * @property {number|Long|null} [amount1000] HSMCurrency amount1000 + */ + + /** + * Constructs a new HSMCurrency. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @classdesc Represents a HSMCurrency. + * @implements IHSMCurrency + * @constructor + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency=} [properties] Properties to set + */ + function HSMCurrency(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HSMCurrency currencyCode. + * @member {string} currencyCode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @instance + */ + HSMCurrency.prototype.currencyCode = ""; + + /** + * HSMCurrency amount1000. + * @member {number|Long} amount1000 + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @instance + */ + HSMCurrency.prototype.amount1000 = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new HSMCurrency instance using the specified properties. + * @function create + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency=} [properties] Properties to set + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency} HSMCurrency instance + */ + HSMCurrency.create = function create(properties) { + return new HSMCurrency(properties); + }; + + /** + * Encodes the specified HSMCurrency message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.verify|verify} messages. + * @function encode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency} message HSMCurrency message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMCurrency.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.amount1000 != null && Object.hasOwnProperty.call(message, "amount1000")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.amount1000); + return writer; + }; + + /** + * Encodes the specified HSMCurrency message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMCurrency} message HSMCurrency message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMCurrency.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HSMCurrency message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency} HSMCurrency + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMCurrency.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.amount1000 = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HSMCurrency message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency} HSMCurrency + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMCurrency.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HSMCurrency message. + * @function verify + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HSMCurrency.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.amount1000 != null && message.hasOwnProperty("amount1000")) + if (!$util.isInteger(message.amount1000) && !(message.amount1000 && $util.isInteger(message.amount1000.low) && $util.isInteger(message.amount1000.high))) + return "amount1000: integer|Long expected"; + return null; + }; + + /** + * Creates a HSMCurrency message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency} HSMCurrency + */ + HSMCurrency.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency) + return object; + var message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.amount1000 != null) + if ($util.Long) + (message.amount1000 = $util.Long.fromValue(object.amount1000)).unsigned = false; + else if (typeof object.amount1000 === "string") + message.amount1000 = parseInt(object.amount1000, 10); + else if (typeof object.amount1000 === "number") + message.amount1000 = object.amount1000; + else if (typeof object.amount1000 === "object") + message.amount1000 = new $util.LongBits(object.amount1000.low >>> 0, object.amount1000.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a HSMCurrency message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency} message HSMCurrency + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HSMCurrency.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.amount1000 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.amount1000 = options.longs === String ? "0" : 0; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.amount1000 != null && message.hasOwnProperty("amount1000")) + if (typeof message.amount1000 === "number") + object.amount1000 = options.longs === String ? String(message.amount1000) : message.amount1000; + else + object.amount1000 = options.longs === String ? $util.Long.prototype.toString.call(message.amount1000) : options.longs === Number ? new $util.LongBits(message.amount1000.low >>> 0, message.amount1000.high >>> 0).toNumber() : message.amount1000; + return object; + }; + + /** + * Converts this HSMCurrency to JSON. + * @function toJSON + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + * @instance + * @returns {Object.} JSON object + */ + HSMCurrency.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HSMCurrency; + })(); + + HSMLocalizableParameter.HSMDateTime = (function() { + + /** + * Properties of a HSMDateTime. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @interface IHSMDateTime + * @property {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent|null} [component] HSMDateTime component + * @property {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch|null} [unixEpoch] HSMDateTime unixEpoch + */ + + /** + * Constructs a new HSMDateTime. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter + * @classdesc Represents a HSMDateTime. + * @implements IHSMDateTime + * @constructor + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime=} [properties] Properties to set + */ + function HSMDateTime(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HSMDateTime component. + * @member {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent|null|undefined} component + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @instance + */ + HSMDateTime.prototype.component = null; + + /** + * HSMDateTime unixEpoch. + * @member {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch|null|undefined} unixEpoch + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @instance + */ + HSMDateTime.prototype.unixEpoch = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HSMDateTime datetimeOneof. + * @member {"component"|"unixEpoch"|undefined} datetimeOneof + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @instance + */ + Object.defineProperty(HSMDateTime.prototype, "datetimeOneof", { + get: $util.oneOfGetter($oneOfFields = ["component", "unixEpoch"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HSMDateTime instance using the specified properties. + * @function create + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime=} [properties] Properties to set + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime} HSMDateTime instance + */ + HSMDateTime.create = function create(properties) { + return new HSMDateTime(properties); + }; + + /** + * Encodes the specified HSMDateTime message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.verify|verify} messages. + * @function encode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime} message HSMDateTime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMDateTime.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.component != null && Object.hasOwnProperty.call(message, "component")) + $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.encode(message.component, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.unixEpoch != null && Object.hasOwnProperty.call(message, "unixEpoch")) + $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.encode(message.unixEpoch, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HSMDateTime message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.IHSMDateTime} message HSMDateTime message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMDateTime.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HSMDateTime message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime} HSMDateTime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMDateTime.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.component = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.decode(reader, reader.uint32()); + break; + case 2: + message.unixEpoch = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HSMDateTime message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime} HSMDateTime + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMDateTime.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HSMDateTime message. + * @function verify + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HSMDateTime.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.component != null && message.hasOwnProperty("component")) { + properties.datetimeOneof = 1; + { + var error = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.verify(message.component); + if (error) + return "component." + error; + } + } + if (message.unixEpoch != null && message.hasOwnProperty("unixEpoch")) { + if (properties.datetimeOneof === 1) + return "datetimeOneof: multiple values"; + properties.datetimeOneof = 1; + { + var error = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.verify(message.unixEpoch); + if (error) + return "unixEpoch." + error; + } + } + return null; + }; + + /** + * Creates a HSMDateTime message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime} HSMDateTime + */ + HSMDateTime.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime) + return object; + var message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime(); + if (object.component != null) { + if (typeof object.component !== "object") + throw TypeError(".proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.component: object expected"); + message.component = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.fromObject(object.component); + } + if (object.unixEpoch != null) { + if (typeof object.unixEpoch !== "object") + throw TypeError(".proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.unixEpoch: object expected"); + message.unixEpoch = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.fromObject(object.unixEpoch); + } + return message; + }; + + /** + * Creates a plain object from a HSMDateTime message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime} message HSMDateTime + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HSMDateTime.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.component != null && message.hasOwnProperty("component")) { + object.component = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.toObject(message.component, options); + if (options.oneofs) + object.datetimeOneof = "component"; + } + if (message.unixEpoch != null && message.hasOwnProperty("unixEpoch")) { + object.unixEpoch = $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.toObject(message.unixEpoch, options); + if (options.oneofs) + object.datetimeOneof = "unixEpoch"; + } + return object; + }; + + /** + * Converts this HSMDateTime to JSON. + * @function toJSON + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @instance + * @returns {Object.} JSON object + */ + HSMDateTime.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + HSMDateTime.HSMDateTimeComponent = (function() { + + /** + * Properties of a HSMDateTimeComponent. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @interface IHSMDateTimeComponent + * @property {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType|null} [dayOfWeek] HSMDateTimeComponent dayOfWeek + * @property {number|null} [year] HSMDateTimeComponent year + * @property {number|null} [month] HSMDateTimeComponent month + * @property {number|null} [dayOfMonth] HSMDateTimeComponent dayOfMonth + * @property {number|null} [hour] HSMDateTimeComponent hour + * @property {number|null} [minute] HSMDateTimeComponent minute + * @property {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType|null} [calendar] HSMDateTimeComponent calendar + */ + + /** + * Constructs a new HSMDateTimeComponent. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @classdesc Represents a HSMDateTimeComponent. + * @implements IHSMDateTimeComponent + * @constructor + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent=} [properties] Properties to set + */ + function HSMDateTimeComponent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HSMDateTimeComponent dayOfWeek. + * @member {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType} dayOfWeek + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.dayOfWeek = 1; + + /** + * HSMDateTimeComponent year. + * @member {number} year + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.year = 0; + + /** + * HSMDateTimeComponent month. + * @member {number} month + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.month = 0; + + /** + * HSMDateTimeComponent dayOfMonth. + * @member {number} dayOfMonth + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.dayOfMonth = 0; + + /** + * HSMDateTimeComponent hour. + * @member {number} hour + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.hour = 0; + + /** + * HSMDateTimeComponent minute. + * @member {number} minute + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.minute = 0; + + /** + * HSMDateTimeComponent calendar. + * @member {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType} calendar + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + */ + HSMDateTimeComponent.prototype.calendar = 1; + + /** + * Creates a new HSMDateTimeComponent instance using the specified properties. + * @function create + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent=} [properties] Properties to set + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent} HSMDateTimeComponent instance + */ + HSMDateTimeComponent.create = function create(properties) { + return new HSMDateTimeComponent(properties); + }; + + /** + * Encodes the specified HSMDateTimeComponent message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.verify|verify} messages. + * @function encode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent} message HSMDateTimeComponent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMDateTimeComponent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dayOfWeek != null && Object.hasOwnProperty.call(message, "dayOfWeek")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.dayOfWeek); + if (message.year != null && Object.hasOwnProperty.call(message, "year")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.year); + if (message.month != null && Object.hasOwnProperty.call(message, "month")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.month); + if (message.dayOfMonth != null && Object.hasOwnProperty.call(message, "dayOfMonth")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.dayOfMonth); + if (message.hour != null && Object.hasOwnProperty.call(message, "hour")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.hour); + if (message.minute != null && Object.hasOwnProperty.call(message, "minute")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.minute); + if (message.calendar != null && Object.hasOwnProperty.call(message, "calendar")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.calendar); + return writer; + }; + + /** + * Encodes the specified HSMDateTimeComponent message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeComponent} message HSMDateTimeComponent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMDateTimeComponent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HSMDateTimeComponent message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent} HSMDateTimeComponent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMDateTimeComponent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dayOfWeek = reader.int32(); + break; + case 2: + message.year = reader.uint32(); + break; + case 3: + message.month = reader.uint32(); + break; + case 4: + message.dayOfMonth = reader.uint32(); + break; + case 5: + message.hour = reader.uint32(); + break; + case 6: + message.minute = reader.uint32(); + break; + case 7: + message.calendar = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HSMDateTimeComponent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent} HSMDateTimeComponent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMDateTimeComponent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HSMDateTimeComponent message. + * @function verify + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HSMDateTimeComponent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dayOfWeek != null && message.hasOwnProperty("dayOfWeek")) + switch (message.dayOfWeek) { + default: + return "dayOfWeek: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.year != null && message.hasOwnProperty("year")) + if (!$util.isInteger(message.year)) + return "year: integer expected"; + if (message.month != null && message.hasOwnProperty("month")) + if (!$util.isInteger(message.month)) + return "month: integer expected"; + if (message.dayOfMonth != null && message.hasOwnProperty("dayOfMonth")) + if (!$util.isInteger(message.dayOfMonth)) + return "dayOfMonth: integer expected"; + if (message.hour != null && message.hasOwnProperty("hour")) + if (!$util.isInteger(message.hour)) + return "hour: integer expected"; + if (message.minute != null && message.hasOwnProperty("minute")) + if (!$util.isInteger(message.minute)) + return "minute: integer expected"; + if (message.calendar != null && message.hasOwnProperty("calendar")) + switch (message.calendar) { + default: + return "calendar: enum value expected"; + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a HSMDateTimeComponent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent} HSMDateTimeComponent + */ + HSMDateTimeComponent.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent) + return object; + var message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent(); + switch (object.dayOfWeek) { + case "MONDAY": + case 1: + message.dayOfWeek = 1; + break; + case "TUESDAY": + case 2: + message.dayOfWeek = 2; + break; + case "WEDNESDAY": + case 3: + message.dayOfWeek = 3; + break; + case "THURSDAY": + case 4: + message.dayOfWeek = 4; + break; + case "FRIDAY": + case 5: + message.dayOfWeek = 5; + break; + case "SATURDAY": + case 6: + message.dayOfWeek = 6; + break; + case "SUNDAY": + case 7: + message.dayOfWeek = 7; + break; + } + if (object.year != null) + message.year = object.year >>> 0; + if (object.month != null) + message.month = object.month >>> 0; + if (object.dayOfMonth != null) + message.dayOfMonth = object.dayOfMonth >>> 0; + if (object.hour != null) + message.hour = object.hour >>> 0; + if (object.minute != null) + message.minute = object.minute >>> 0; + switch (object.calendar) { + case "GREGORIAN": + case 1: + message.calendar = 1; + break; + case "SOLAR_HIJRI": + case 2: + message.calendar = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a HSMDateTimeComponent message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent} message HSMDateTimeComponent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HSMDateTimeComponent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dayOfWeek = options.enums === String ? "MONDAY" : 1; + object.year = 0; + object.month = 0; + object.dayOfMonth = 0; + object.hour = 0; + object.minute = 0; + object.calendar = options.enums === String ? "GREGORIAN" : 1; + } + if (message.dayOfWeek != null && message.hasOwnProperty("dayOfWeek")) + object.dayOfWeek = options.enums === String ? $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType[message.dayOfWeek] : message.dayOfWeek; + if (message.year != null && message.hasOwnProperty("year")) + object.year = message.year; + if (message.month != null && message.hasOwnProperty("month")) + object.month = message.month; + if (message.dayOfMonth != null && message.hasOwnProperty("dayOfMonth")) + object.dayOfMonth = message.dayOfMonth; + if (message.hour != null && message.hasOwnProperty("hour")) + object.hour = message.hour; + if (message.minute != null && message.hasOwnProperty("minute")) + object.minute = message.minute; + if (message.calendar != null && message.hasOwnProperty("calendar")) + object.calendar = options.enums === String ? $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType[message.calendar] : message.calendar; + return object; + }; + + /** + * Converts this HSMDateTimeComponent to JSON. + * @function toJSON + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + * @instance + * @returns {Object.} JSON object + */ + HSMDateTimeComponent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CalendarType enum. + * @name proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + * @enum {number} + * @property {number} GREGORIAN=1 GREGORIAN value + * @property {number} SOLAR_HIJRI=2 SOLAR_HIJRI value + */ + HSMDateTimeComponent.CalendarType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "GREGORIAN"] = 1; + values[valuesById[2] = "SOLAR_HIJRI"] = 2; + return values; + })(); + + /** + * DayOfWeekType enum. + * @name proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + * @enum {number} + * @property {number} MONDAY=1 MONDAY value + * @property {number} TUESDAY=2 TUESDAY value + * @property {number} WEDNESDAY=3 WEDNESDAY value + * @property {number} THURSDAY=4 THURSDAY value + * @property {number} FRIDAY=5 FRIDAY value + * @property {number} SATURDAY=6 SATURDAY value + * @property {number} SUNDAY=7 SUNDAY value + */ + HSMDateTimeComponent.DayOfWeekType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "MONDAY"] = 1; + values[valuesById[2] = "TUESDAY"] = 2; + values[valuesById[3] = "WEDNESDAY"] = 3; + values[valuesById[4] = "THURSDAY"] = 4; + values[valuesById[5] = "FRIDAY"] = 5; + values[valuesById[6] = "SATURDAY"] = 6; + values[valuesById[7] = "SUNDAY"] = 7; + return values; + })(); + + return HSMDateTimeComponent; + })(); + + HSMDateTime.HSMDateTimeUnixEpoch = (function() { + + /** + * Properties of a HSMDateTimeUnixEpoch. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @interface IHSMDateTimeUnixEpoch + * @property {number|Long|null} [timestamp] HSMDateTimeUnixEpoch timestamp + */ + + /** + * Constructs a new HSMDateTimeUnixEpoch. + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + * @classdesc Represents a HSMDateTimeUnixEpoch. + * @implements IHSMDateTimeUnixEpoch + * @constructor + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch=} [properties] Properties to set + */ + function HSMDateTimeUnixEpoch(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HSMDateTimeUnixEpoch timestamp. + * @member {number|Long} timestamp + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @instance + */ + HSMDateTimeUnixEpoch.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new HSMDateTimeUnixEpoch instance using the specified properties. + * @function create + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch=} [properties] Properties to set + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch} HSMDateTimeUnixEpoch instance + */ + HSMDateTimeUnixEpoch.create = function create(properties) { + return new HSMDateTimeUnixEpoch(properties); + }; + + /** + * Encodes the specified HSMDateTimeUnixEpoch message. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.verify|verify} messages. + * @function encode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch} message HSMDateTimeUnixEpoch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMDateTimeUnixEpoch.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified HSMDateTimeUnixEpoch message, length delimited. Does not implicitly {@link proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.IHSMDateTimeUnixEpoch} message HSMDateTimeUnixEpoch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HSMDateTimeUnixEpoch.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HSMDateTimeUnixEpoch message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch} HSMDateTimeUnixEpoch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMDateTimeUnixEpoch.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HSMDateTimeUnixEpoch message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch} HSMDateTimeUnixEpoch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HSMDateTimeUnixEpoch.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HSMDateTimeUnixEpoch message. + * @function verify + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HSMDateTimeUnixEpoch.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a HSMDateTimeUnixEpoch message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch} HSMDateTimeUnixEpoch + */ + HSMDateTimeUnixEpoch.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch) + return object; + var message = new $root.proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch(); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a HSMDateTimeUnixEpoch message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @static + * @param {proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch} message HSMDateTimeUnixEpoch + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HSMDateTimeUnixEpoch.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + return object; + }; + + /** + * Converts this HSMDateTimeUnixEpoch to JSON. + * @function toJSON + * @memberof proto.Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + * @instance + * @returns {Object.} JSON object + */ + HSMDateTimeUnixEpoch.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HSMDateTimeUnixEpoch; + })(); + + return HSMDateTime; + })(); + + return HSMLocalizableParameter; + })(); + + return HighlyStructuredMessage; + })(); + + Message.HistorySyncNotification = (function() { + + /** + * Properties of a HistorySyncNotification. + * @memberof proto.Message + * @interface IHistorySyncNotification + * @property {Uint8Array|null} [fileSha256] HistorySyncNotification fileSha256 + * @property {number|Long|null} [fileLength] HistorySyncNotification fileLength + * @property {Uint8Array|null} [mediaKey] HistorySyncNotification mediaKey + * @property {Uint8Array|null} [fileEncSha256] HistorySyncNotification fileEncSha256 + * @property {string|null} [directPath] HistorySyncNotification directPath + * @property {proto.Message.HistorySyncNotification.HistorySyncType|null} [syncType] HistorySyncNotification syncType + * @property {number|null} [chunkOrder] HistorySyncNotification chunkOrder + * @property {string|null} [originalMessageId] HistorySyncNotification originalMessageId + * @property {number|null} [progress] HistorySyncNotification progress + * @property {number|Long|null} [oldestMsgInChunkTimestampSec] HistorySyncNotification oldestMsgInChunkTimestampSec + */ + + /** + * Constructs a new HistorySyncNotification. + * @memberof proto.Message + * @classdesc Represents a HistorySyncNotification. + * @implements IHistorySyncNotification + * @constructor + * @param {proto.Message.IHistorySyncNotification=} [properties] Properties to set + */ + function HistorySyncNotification(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HistorySyncNotification fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.fileSha256 = $util.newBuffer([]); + + /** + * HistorySyncNotification fileLength. + * @member {number|Long} fileLength + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * HistorySyncNotification mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.mediaKey = $util.newBuffer([]); + + /** + * HistorySyncNotification fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * HistorySyncNotification directPath. + * @member {string} directPath + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.directPath = ""; + + /** + * HistorySyncNotification syncType. + * @member {proto.Message.HistorySyncNotification.HistorySyncType} syncType + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.syncType = 0; + + /** + * HistorySyncNotification chunkOrder. + * @member {number} chunkOrder + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.chunkOrder = 0; + + /** + * HistorySyncNotification originalMessageId. + * @member {string} originalMessageId + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.originalMessageId = ""; + + /** + * HistorySyncNotification progress. + * @member {number} progress + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.progress = 0; + + /** + * HistorySyncNotification oldestMsgInChunkTimestampSec. + * @member {number|Long} oldestMsgInChunkTimestampSec + * @memberof proto.Message.HistorySyncNotification + * @instance + */ + HistorySyncNotification.prototype.oldestMsgInChunkTimestampSec = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new HistorySyncNotification instance using the specified properties. + * @function create + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {proto.Message.IHistorySyncNotification=} [properties] Properties to set + * @returns {proto.Message.HistorySyncNotification} HistorySyncNotification instance + */ + HistorySyncNotification.create = function create(properties) { + return new HistorySyncNotification(properties); + }; + + /** + * Encodes the specified HistorySyncNotification message. Does not implicitly {@link proto.Message.HistorySyncNotification.verify|verify} messages. + * @function encode + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {proto.Message.IHistorySyncNotification} message HistorySyncNotification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncNotification.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.fileSha256); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.fileLength); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.mediaKey); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.fileEncSha256); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.directPath); + if (message.syncType != null && Object.hasOwnProperty.call(message, "syncType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.syncType); + if (message.chunkOrder != null && Object.hasOwnProperty.call(message, "chunkOrder")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.chunkOrder); + if (message.originalMessageId != null && Object.hasOwnProperty.call(message, "originalMessageId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.originalMessageId); + if (message.progress != null && Object.hasOwnProperty.call(message, "progress")) + writer.uint32(/* id 9, wireType 0 =*/72).uint32(message.progress); + if (message.oldestMsgInChunkTimestampSec != null && Object.hasOwnProperty.call(message, "oldestMsgInChunkTimestampSec")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.oldestMsgInChunkTimestampSec); + return writer; + }; + + /** + * Encodes the specified HistorySyncNotification message, length delimited. Does not implicitly {@link proto.Message.HistorySyncNotification.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {proto.Message.IHistorySyncNotification} message HistorySyncNotification message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncNotification.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HistorySyncNotification message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.HistorySyncNotification} HistorySyncNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncNotification.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.HistorySyncNotification(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fileSha256 = reader.bytes(); + break; + case 2: + message.fileLength = reader.uint64(); + break; + case 3: + message.mediaKey = reader.bytes(); + break; + case 4: + message.fileEncSha256 = reader.bytes(); + break; + case 5: + message.directPath = reader.string(); + break; + case 6: + message.syncType = reader.int32(); + break; + case 7: + message.chunkOrder = reader.uint32(); + break; + case 8: + message.originalMessageId = reader.string(); + break; + case 9: + message.progress = reader.uint32(); + break; + case 10: + message.oldestMsgInChunkTimestampSec = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HistorySyncNotification message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.HistorySyncNotification} HistorySyncNotification + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncNotification.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HistorySyncNotification message. + * @function verify + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HistorySyncNotification.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.syncType != null && message.hasOwnProperty("syncType")) + switch (message.syncType) { + default: + return "syncType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.chunkOrder != null && message.hasOwnProperty("chunkOrder")) + if (!$util.isInteger(message.chunkOrder)) + return "chunkOrder: integer expected"; + if (message.originalMessageId != null && message.hasOwnProperty("originalMessageId")) + if (!$util.isString(message.originalMessageId)) + return "originalMessageId: string expected"; + if (message.progress != null && message.hasOwnProperty("progress")) + if (!$util.isInteger(message.progress)) + return "progress: integer expected"; + if (message.oldestMsgInChunkTimestampSec != null && message.hasOwnProperty("oldestMsgInChunkTimestampSec")) + if (!$util.isInteger(message.oldestMsgInChunkTimestampSec) && !(message.oldestMsgInChunkTimestampSec && $util.isInteger(message.oldestMsgInChunkTimestampSec.low) && $util.isInteger(message.oldestMsgInChunkTimestampSec.high))) + return "oldestMsgInChunkTimestampSec: integer|Long expected"; + return null; + }; + + /** + * Creates a HistorySyncNotification message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.HistorySyncNotification} HistorySyncNotification + */ + HistorySyncNotification.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.HistorySyncNotification) + return object; + var message = new $root.proto.Message.HistorySyncNotification(); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.directPath != null) + message.directPath = String(object.directPath); + switch (object.syncType) { + case "INITIAL_BOOTSTRAP": + case 0: + message.syncType = 0; + break; + case "INITIAL_STATUS_V3": + case 1: + message.syncType = 1; + break; + case "FULL": + case 2: + message.syncType = 2; + break; + case "RECENT": + case 3: + message.syncType = 3; + break; + case "PUSH_NAME": + case 4: + message.syncType = 4; + break; + case "NON_BLOCKING_DATA": + case 5: + message.syncType = 5; + break; + case "ON_DEMAND": + case 6: + message.syncType = 6; + break; + } + if (object.chunkOrder != null) + message.chunkOrder = object.chunkOrder >>> 0; + if (object.originalMessageId != null) + message.originalMessageId = String(object.originalMessageId); + if (object.progress != null) + message.progress = object.progress >>> 0; + if (object.oldestMsgInChunkTimestampSec != null) + if ($util.Long) + (message.oldestMsgInChunkTimestampSec = $util.Long.fromValue(object.oldestMsgInChunkTimestampSec)).unsigned = false; + else if (typeof object.oldestMsgInChunkTimestampSec === "string") + message.oldestMsgInChunkTimestampSec = parseInt(object.oldestMsgInChunkTimestampSec, 10); + else if (typeof object.oldestMsgInChunkTimestampSec === "number") + message.oldestMsgInChunkTimestampSec = object.oldestMsgInChunkTimestampSec; + else if (typeof object.oldestMsgInChunkTimestampSec === "object") + message.oldestMsgInChunkTimestampSec = new $util.LongBits(object.oldestMsgInChunkTimestampSec.low >>> 0, object.oldestMsgInChunkTimestampSec.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a HistorySyncNotification message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.HistorySyncNotification + * @static + * @param {proto.Message.HistorySyncNotification} message HistorySyncNotification + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HistorySyncNotification.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + object.directPath = ""; + object.syncType = options.enums === String ? "INITIAL_BOOTSTRAP" : 0; + object.chunkOrder = 0; + object.originalMessageId = ""; + object.progress = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.oldestMsgInChunkTimestampSec = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.oldestMsgInChunkTimestampSec = options.longs === String ? "0" : 0; + } + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.syncType != null && message.hasOwnProperty("syncType")) + object.syncType = options.enums === String ? $root.proto.Message.HistorySyncNotification.HistorySyncType[message.syncType] : message.syncType; + if (message.chunkOrder != null && message.hasOwnProperty("chunkOrder")) + object.chunkOrder = message.chunkOrder; + if (message.originalMessageId != null && message.hasOwnProperty("originalMessageId")) + object.originalMessageId = message.originalMessageId; + if (message.progress != null && message.hasOwnProperty("progress")) + object.progress = message.progress; + if (message.oldestMsgInChunkTimestampSec != null && message.hasOwnProperty("oldestMsgInChunkTimestampSec")) + if (typeof message.oldestMsgInChunkTimestampSec === "number") + object.oldestMsgInChunkTimestampSec = options.longs === String ? String(message.oldestMsgInChunkTimestampSec) : message.oldestMsgInChunkTimestampSec; + else + object.oldestMsgInChunkTimestampSec = options.longs === String ? $util.Long.prototype.toString.call(message.oldestMsgInChunkTimestampSec) : options.longs === Number ? new $util.LongBits(message.oldestMsgInChunkTimestampSec.low >>> 0, message.oldestMsgInChunkTimestampSec.high >>> 0).toNumber() : message.oldestMsgInChunkTimestampSec; + return object; + }; + + /** + * Converts this HistorySyncNotification to JSON. + * @function toJSON + * @memberof proto.Message.HistorySyncNotification + * @instance + * @returns {Object.} JSON object + */ + HistorySyncNotification.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * HistorySyncType enum. + * @name proto.Message.HistorySyncNotification.HistorySyncType + * @enum {number} + * @property {number} INITIAL_BOOTSTRAP=0 INITIAL_BOOTSTRAP value + * @property {number} INITIAL_STATUS_V3=1 INITIAL_STATUS_V3 value + * @property {number} FULL=2 FULL value + * @property {number} RECENT=3 RECENT value + * @property {number} PUSH_NAME=4 PUSH_NAME value + * @property {number} NON_BLOCKING_DATA=5 NON_BLOCKING_DATA value + * @property {number} ON_DEMAND=6 ON_DEMAND value + */ + HistorySyncNotification.HistorySyncType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INITIAL_BOOTSTRAP"] = 0; + values[valuesById[1] = "INITIAL_STATUS_V3"] = 1; + values[valuesById[2] = "FULL"] = 2; + values[valuesById[3] = "RECENT"] = 3; + values[valuesById[4] = "PUSH_NAME"] = 4; + values[valuesById[5] = "NON_BLOCKING_DATA"] = 5; + values[valuesById[6] = "ON_DEMAND"] = 6; + return values; + })(); + + return HistorySyncNotification; + })(); + + Message.ImageMessage = (function() { + + /** + * Properties of an ImageMessage. + * @memberof proto.Message + * @interface IImageMessage + * @property {string|null} [url] ImageMessage url + * @property {string|null} [mimetype] ImageMessage mimetype + * @property {string|null} [caption] ImageMessage caption + * @property {Uint8Array|null} [fileSha256] ImageMessage fileSha256 + * @property {number|Long|null} [fileLength] ImageMessage fileLength + * @property {number|null} [height] ImageMessage height + * @property {number|null} [width] ImageMessage width + * @property {Uint8Array|null} [mediaKey] ImageMessage mediaKey + * @property {Uint8Array|null} [fileEncSha256] ImageMessage fileEncSha256 + * @property {Array.|null} [interactiveAnnotations] ImageMessage interactiveAnnotations + * @property {string|null} [directPath] ImageMessage directPath + * @property {number|Long|null} [mediaKeyTimestamp] ImageMessage mediaKeyTimestamp + * @property {Uint8Array|null} [jpegThumbnail] ImageMessage jpegThumbnail + * @property {proto.IContextInfo|null} [contextInfo] ImageMessage contextInfo + * @property {Uint8Array|null} [firstScanSidecar] ImageMessage firstScanSidecar + * @property {number|null} [firstScanLength] ImageMessage firstScanLength + * @property {number|null} [experimentGroupId] ImageMessage experimentGroupId + * @property {Uint8Array|null} [scansSidecar] ImageMessage scansSidecar + * @property {Array.|null} [scanLengths] ImageMessage scanLengths + * @property {Uint8Array|null} [midQualityFileSha256] ImageMessage midQualityFileSha256 + * @property {Uint8Array|null} [midQualityFileEncSha256] ImageMessage midQualityFileEncSha256 + * @property {boolean|null} [viewOnce] ImageMessage viewOnce + * @property {string|null} [thumbnailDirectPath] ImageMessage thumbnailDirectPath + * @property {Uint8Array|null} [thumbnailSha256] ImageMessage thumbnailSha256 + * @property {Uint8Array|null} [thumbnailEncSha256] ImageMessage thumbnailEncSha256 + * @property {string|null} [staticUrl] ImageMessage staticUrl + */ + + /** + * Constructs a new ImageMessage. + * @memberof proto.Message + * @classdesc Represents an ImageMessage. + * @implements IImageMessage + * @constructor + * @param {proto.Message.IImageMessage=} [properties] Properties to set + */ + function ImageMessage(properties) { + this.interactiveAnnotations = []; + this.scanLengths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImageMessage url. + * @member {string} url + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.url = ""; + + /** + * ImageMessage mimetype. + * @member {string} mimetype + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.mimetype = ""; + + /** + * ImageMessage caption. + * @member {string} caption + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.caption = ""; + + /** + * ImageMessage fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.fileSha256 = $util.newBuffer([]); + + /** + * ImageMessage fileLength. + * @member {number|Long} fileLength + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * ImageMessage height. + * @member {number} height + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.height = 0; + + /** + * ImageMessage width. + * @member {number} width + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.width = 0; + + /** + * ImageMessage mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.mediaKey = $util.newBuffer([]); + + /** + * ImageMessage fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * ImageMessage interactiveAnnotations. + * @member {Array.} interactiveAnnotations + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.interactiveAnnotations = $util.emptyArray; + + /** + * ImageMessage directPath. + * @member {string} directPath + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.directPath = ""; + + /** + * ImageMessage mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ImageMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * ImageMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.contextInfo = null; + + /** + * ImageMessage firstScanSidecar. + * @member {Uint8Array} firstScanSidecar + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.firstScanSidecar = $util.newBuffer([]); + + /** + * ImageMessage firstScanLength. + * @member {number} firstScanLength + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.firstScanLength = 0; + + /** + * ImageMessage experimentGroupId. + * @member {number} experimentGroupId + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.experimentGroupId = 0; + + /** + * ImageMessage scansSidecar. + * @member {Uint8Array} scansSidecar + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.scansSidecar = $util.newBuffer([]); + + /** + * ImageMessage scanLengths. + * @member {Array.} scanLengths + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.scanLengths = $util.emptyArray; + + /** + * ImageMessage midQualityFileSha256. + * @member {Uint8Array} midQualityFileSha256 + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.midQualityFileSha256 = $util.newBuffer([]); + + /** + * ImageMessage midQualityFileEncSha256. + * @member {Uint8Array} midQualityFileEncSha256 + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.midQualityFileEncSha256 = $util.newBuffer([]); + + /** + * ImageMessage viewOnce. + * @member {boolean} viewOnce + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.viewOnce = false; + + /** + * ImageMessage thumbnailDirectPath. + * @member {string} thumbnailDirectPath + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.thumbnailDirectPath = ""; + + /** + * ImageMessage thumbnailSha256. + * @member {Uint8Array} thumbnailSha256 + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.thumbnailSha256 = $util.newBuffer([]); + + /** + * ImageMessage thumbnailEncSha256. + * @member {Uint8Array} thumbnailEncSha256 + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.thumbnailEncSha256 = $util.newBuffer([]); + + /** + * ImageMessage staticUrl. + * @member {string} staticUrl + * @memberof proto.Message.ImageMessage + * @instance + */ + ImageMessage.prototype.staticUrl = ""; + + /** + * Creates a new ImageMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ImageMessage + * @static + * @param {proto.Message.IImageMessage=} [properties] Properties to set + * @returns {proto.Message.ImageMessage} ImageMessage instance + */ + ImageMessage.create = function create(properties) { + return new ImageMessage(properties); + }; + + /** + * Encodes the specified ImageMessage message. Does not implicitly {@link proto.Message.ImageMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ImageMessage + * @static + * @param {proto.Message.IImageMessage} message ImageMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImageMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimetype); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.caption); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.fileSha256); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.fileLength); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.width); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.mediaKey); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.fileEncSha256); + if (message.interactiveAnnotations != null && message.interactiveAnnotations.length) + for (var i = 0; i < message.interactiveAnnotations.length; ++i) + $root.proto.InteractiveAnnotation.encode(message.interactiveAnnotations[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.directPath); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 12, wireType 0 =*/96).int64(message.mediaKeyTimestamp); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.firstScanSidecar != null && Object.hasOwnProperty.call(message, "firstScanSidecar")) + writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.firstScanSidecar); + if (message.firstScanLength != null && Object.hasOwnProperty.call(message, "firstScanLength")) + writer.uint32(/* id 19, wireType 0 =*/152).uint32(message.firstScanLength); + if (message.experimentGroupId != null && Object.hasOwnProperty.call(message, "experimentGroupId")) + writer.uint32(/* id 20, wireType 0 =*/160).uint32(message.experimentGroupId); + if (message.scansSidecar != null && Object.hasOwnProperty.call(message, "scansSidecar")) + writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.scansSidecar); + if (message.scanLengths != null && message.scanLengths.length) + for (var i = 0; i < message.scanLengths.length; ++i) + writer.uint32(/* id 22, wireType 0 =*/176).uint32(message.scanLengths[i]); + if (message.midQualityFileSha256 != null && Object.hasOwnProperty.call(message, "midQualityFileSha256")) + writer.uint32(/* id 23, wireType 2 =*/186).bytes(message.midQualityFileSha256); + if (message.midQualityFileEncSha256 != null && Object.hasOwnProperty.call(message, "midQualityFileEncSha256")) + writer.uint32(/* id 24, wireType 2 =*/194).bytes(message.midQualityFileEncSha256); + if (message.viewOnce != null && Object.hasOwnProperty.call(message, "viewOnce")) + writer.uint32(/* id 25, wireType 0 =*/200).bool(message.viewOnce); + if (message.thumbnailDirectPath != null && Object.hasOwnProperty.call(message, "thumbnailDirectPath")) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.thumbnailDirectPath); + if (message.thumbnailSha256 != null && Object.hasOwnProperty.call(message, "thumbnailSha256")) + writer.uint32(/* id 27, wireType 2 =*/218).bytes(message.thumbnailSha256); + if (message.thumbnailEncSha256 != null && Object.hasOwnProperty.call(message, "thumbnailEncSha256")) + writer.uint32(/* id 28, wireType 2 =*/226).bytes(message.thumbnailEncSha256); + if (message.staticUrl != null && Object.hasOwnProperty.call(message, "staticUrl")) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.staticUrl); + return writer; + }; + + /** + * Encodes the specified ImageMessage message, length delimited. Does not implicitly {@link proto.Message.ImageMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ImageMessage + * @static + * @param {proto.Message.IImageMessage} message ImageMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImageMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImageMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ImageMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ImageMessage} ImageMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImageMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ImageMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.mimetype = reader.string(); + break; + case 3: + message.caption = reader.string(); + break; + case 4: + message.fileSha256 = reader.bytes(); + break; + case 5: + message.fileLength = reader.uint64(); + break; + case 6: + message.height = reader.uint32(); + break; + case 7: + message.width = reader.uint32(); + break; + case 8: + message.mediaKey = reader.bytes(); + break; + case 9: + message.fileEncSha256 = reader.bytes(); + break; + case 10: + if (!(message.interactiveAnnotations && message.interactiveAnnotations.length)) + message.interactiveAnnotations = []; + message.interactiveAnnotations.push($root.proto.InteractiveAnnotation.decode(reader, reader.uint32())); + break; + case 11: + message.directPath = reader.string(); + break; + case 12: + message.mediaKeyTimestamp = reader.int64(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 18: + message.firstScanSidecar = reader.bytes(); + break; + case 19: + message.firstScanLength = reader.uint32(); + break; + case 20: + message.experimentGroupId = reader.uint32(); + break; + case 21: + message.scansSidecar = reader.bytes(); + break; + case 22: + if (!(message.scanLengths && message.scanLengths.length)) + message.scanLengths = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.scanLengths.push(reader.uint32()); + } else + message.scanLengths.push(reader.uint32()); + break; + case 23: + message.midQualityFileSha256 = reader.bytes(); + break; + case 24: + message.midQualityFileEncSha256 = reader.bytes(); + break; + case 25: + message.viewOnce = reader.bool(); + break; + case 26: + message.thumbnailDirectPath = reader.string(); + break; + case 27: + message.thumbnailSha256 = reader.bytes(); + break; + case 28: + message.thumbnailEncSha256 = reader.bytes(); + break; + case 29: + message.staticUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImageMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ImageMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ImageMessage} ImageMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImageMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImageMessage message. + * @function verify + * @memberof proto.Message.ImageMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImageMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.interactiveAnnotations != null && message.hasOwnProperty("interactiveAnnotations")) { + if (!Array.isArray(message.interactiveAnnotations)) + return "interactiveAnnotations: array expected"; + for (var i = 0; i < message.interactiveAnnotations.length; ++i) { + var error = $root.proto.InteractiveAnnotation.verify(message.interactiveAnnotations[i]); + if (error) + return "interactiveAnnotations." + error; + } + } + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.firstScanSidecar != null && message.hasOwnProperty("firstScanSidecar")) + if (!(message.firstScanSidecar && typeof message.firstScanSidecar.length === "number" || $util.isString(message.firstScanSidecar))) + return "firstScanSidecar: buffer expected"; + if (message.firstScanLength != null && message.hasOwnProperty("firstScanLength")) + if (!$util.isInteger(message.firstScanLength)) + return "firstScanLength: integer expected"; + if (message.experimentGroupId != null && message.hasOwnProperty("experimentGroupId")) + if (!$util.isInteger(message.experimentGroupId)) + return "experimentGroupId: integer expected"; + if (message.scansSidecar != null && message.hasOwnProperty("scansSidecar")) + if (!(message.scansSidecar && typeof message.scansSidecar.length === "number" || $util.isString(message.scansSidecar))) + return "scansSidecar: buffer expected"; + if (message.scanLengths != null && message.hasOwnProperty("scanLengths")) { + if (!Array.isArray(message.scanLengths)) + return "scanLengths: array expected"; + for (var i = 0; i < message.scanLengths.length; ++i) + if (!$util.isInteger(message.scanLengths[i])) + return "scanLengths: integer[] expected"; + } + if (message.midQualityFileSha256 != null && message.hasOwnProperty("midQualityFileSha256")) + if (!(message.midQualityFileSha256 && typeof message.midQualityFileSha256.length === "number" || $util.isString(message.midQualityFileSha256))) + return "midQualityFileSha256: buffer expected"; + if (message.midQualityFileEncSha256 != null && message.hasOwnProperty("midQualityFileEncSha256")) + if (!(message.midQualityFileEncSha256 && typeof message.midQualityFileEncSha256.length === "number" || $util.isString(message.midQualityFileEncSha256))) + return "midQualityFileEncSha256: buffer expected"; + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + if (typeof message.viewOnce !== "boolean") + return "viewOnce: boolean expected"; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + if (!$util.isString(message.thumbnailDirectPath)) + return "thumbnailDirectPath: string expected"; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + if (!(message.thumbnailSha256 && typeof message.thumbnailSha256.length === "number" || $util.isString(message.thumbnailSha256))) + return "thumbnailSha256: buffer expected"; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + if (!(message.thumbnailEncSha256 && typeof message.thumbnailEncSha256.length === "number" || $util.isString(message.thumbnailEncSha256))) + return "thumbnailEncSha256: buffer expected"; + if (message.staticUrl != null && message.hasOwnProperty("staticUrl")) + if (!$util.isString(message.staticUrl)) + return "staticUrl: string expected"; + return null; + }; + + /** + * Creates an ImageMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ImageMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ImageMessage} ImageMessage + */ + ImageMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ImageMessage) + return object; + var message = new $root.proto.Message.ImageMessage(); + if (object.url != null) + message.url = String(object.url); + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.caption != null) + message.caption = String(object.caption); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.height != null) + message.height = object.height >>> 0; + if (object.width != null) + message.width = object.width >>> 0; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.interactiveAnnotations) { + if (!Array.isArray(object.interactiveAnnotations)) + throw TypeError(".proto.Message.ImageMessage.interactiveAnnotations: array expected"); + message.interactiveAnnotations = []; + for (var i = 0; i < object.interactiveAnnotations.length; ++i) { + if (typeof object.interactiveAnnotations[i] !== "object") + throw TypeError(".proto.Message.ImageMessage.interactiveAnnotations: object expected"); + message.interactiveAnnotations[i] = $root.proto.InteractiveAnnotation.fromObject(object.interactiveAnnotations[i]); + } + } + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ImageMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.firstScanSidecar != null) + if (typeof object.firstScanSidecar === "string") + $util.base64.decode(object.firstScanSidecar, message.firstScanSidecar = $util.newBuffer($util.base64.length(object.firstScanSidecar)), 0); + else if (object.firstScanSidecar.length) + message.firstScanSidecar = object.firstScanSidecar; + if (object.firstScanLength != null) + message.firstScanLength = object.firstScanLength >>> 0; + if (object.experimentGroupId != null) + message.experimentGroupId = object.experimentGroupId >>> 0; + if (object.scansSidecar != null) + if (typeof object.scansSidecar === "string") + $util.base64.decode(object.scansSidecar, message.scansSidecar = $util.newBuffer($util.base64.length(object.scansSidecar)), 0); + else if (object.scansSidecar.length) + message.scansSidecar = object.scansSidecar; + if (object.scanLengths) { + if (!Array.isArray(object.scanLengths)) + throw TypeError(".proto.Message.ImageMessage.scanLengths: array expected"); + message.scanLengths = []; + for (var i = 0; i < object.scanLengths.length; ++i) + message.scanLengths[i] = object.scanLengths[i] >>> 0; + } + if (object.midQualityFileSha256 != null) + if (typeof object.midQualityFileSha256 === "string") + $util.base64.decode(object.midQualityFileSha256, message.midQualityFileSha256 = $util.newBuffer($util.base64.length(object.midQualityFileSha256)), 0); + else if (object.midQualityFileSha256.length) + message.midQualityFileSha256 = object.midQualityFileSha256; + if (object.midQualityFileEncSha256 != null) + if (typeof object.midQualityFileEncSha256 === "string") + $util.base64.decode(object.midQualityFileEncSha256, message.midQualityFileEncSha256 = $util.newBuffer($util.base64.length(object.midQualityFileEncSha256)), 0); + else if (object.midQualityFileEncSha256.length) + message.midQualityFileEncSha256 = object.midQualityFileEncSha256; + if (object.viewOnce != null) + message.viewOnce = Boolean(object.viewOnce); + if (object.thumbnailDirectPath != null) + message.thumbnailDirectPath = String(object.thumbnailDirectPath); + if (object.thumbnailSha256 != null) + if (typeof object.thumbnailSha256 === "string") + $util.base64.decode(object.thumbnailSha256, message.thumbnailSha256 = $util.newBuffer($util.base64.length(object.thumbnailSha256)), 0); + else if (object.thumbnailSha256.length) + message.thumbnailSha256 = object.thumbnailSha256; + if (object.thumbnailEncSha256 != null) + if (typeof object.thumbnailEncSha256 === "string") + $util.base64.decode(object.thumbnailEncSha256, message.thumbnailEncSha256 = $util.newBuffer($util.base64.length(object.thumbnailEncSha256)), 0); + else if (object.thumbnailEncSha256.length) + message.thumbnailEncSha256 = object.thumbnailEncSha256; + if (object.staticUrl != null) + message.staticUrl = String(object.staticUrl); + return message; + }; + + /** + * Creates a plain object from an ImageMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ImageMessage + * @static + * @param {proto.Message.ImageMessage} message ImageMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImageMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.interactiveAnnotations = []; + object.scanLengths = []; + } + if (options.defaults) { + object.url = ""; + object.mimetype = ""; + object.caption = ""; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.height = 0; + object.width = 0; + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.contextInfo = null; + if (options.bytes === String) + object.firstScanSidecar = ""; + else { + object.firstScanSidecar = []; + if (options.bytes !== Array) + object.firstScanSidecar = $util.newBuffer(object.firstScanSidecar); + } + object.firstScanLength = 0; + object.experimentGroupId = 0; + if (options.bytes === String) + object.scansSidecar = ""; + else { + object.scansSidecar = []; + if (options.bytes !== Array) + object.scansSidecar = $util.newBuffer(object.scansSidecar); + } + if (options.bytes === String) + object.midQualityFileSha256 = ""; + else { + object.midQualityFileSha256 = []; + if (options.bytes !== Array) + object.midQualityFileSha256 = $util.newBuffer(object.midQualityFileSha256); + } + if (options.bytes === String) + object.midQualityFileEncSha256 = ""; + else { + object.midQualityFileEncSha256 = []; + if (options.bytes !== Array) + object.midQualityFileEncSha256 = $util.newBuffer(object.midQualityFileEncSha256); + } + object.viewOnce = false; + object.thumbnailDirectPath = ""; + if (options.bytes === String) + object.thumbnailSha256 = ""; + else { + object.thumbnailSha256 = []; + if (options.bytes !== Array) + object.thumbnailSha256 = $util.newBuffer(object.thumbnailSha256); + } + if (options.bytes === String) + object.thumbnailEncSha256 = ""; + else { + object.thumbnailEncSha256 = []; + if (options.bytes !== Array) + object.thumbnailEncSha256 = $util.newBuffer(object.thumbnailEncSha256); + } + object.staticUrl = ""; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.interactiveAnnotations && message.interactiveAnnotations.length) { + object.interactiveAnnotations = []; + for (var j = 0; j < message.interactiveAnnotations.length; ++j) + object.interactiveAnnotations[j] = $root.proto.InteractiveAnnotation.toObject(message.interactiveAnnotations[j], options); + } + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.firstScanSidecar != null && message.hasOwnProperty("firstScanSidecar")) + object.firstScanSidecar = options.bytes === String ? $util.base64.encode(message.firstScanSidecar, 0, message.firstScanSidecar.length) : options.bytes === Array ? Array.prototype.slice.call(message.firstScanSidecar) : message.firstScanSidecar; + if (message.firstScanLength != null && message.hasOwnProperty("firstScanLength")) + object.firstScanLength = message.firstScanLength; + if (message.experimentGroupId != null && message.hasOwnProperty("experimentGroupId")) + object.experimentGroupId = message.experimentGroupId; + if (message.scansSidecar != null && message.hasOwnProperty("scansSidecar")) + object.scansSidecar = options.bytes === String ? $util.base64.encode(message.scansSidecar, 0, message.scansSidecar.length) : options.bytes === Array ? Array.prototype.slice.call(message.scansSidecar) : message.scansSidecar; + if (message.scanLengths && message.scanLengths.length) { + object.scanLengths = []; + for (var j = 0; j < message.scanLengths.length; ++j) + object.scanLengths[j] = message.scanLengths[j]; + } + if (message.midQualityFileSha256 != null && message.hasOwnProperty("midQualityFileSha256")) + object.midQualityFileSha256 = options.bytes === String ? $util.base64.encode(message.midQualityFileSha256, 0, message.midQualityFileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.midQualityFileSha256) : message.midQualityFileSha256; + if (message.midQualityFileEncSha256 != null && message.hasOwnProperty("midQualityFileEncSha256")) + object.midQualityFileEncSha256 = options.bytes === String ? $util.base64.encode(message.midQualityFileEncSha256, 0, message.midQualityFileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.midQualityFileEncSha256) : message.midQualityFileEncSha256; + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + object.viewOnce = message.viewOnce; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + object.thumbnailDirectPath = message.thumbnailDirectPath; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + object.thumbnailSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailSha256, 0, message.thumbnailSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailSha256) : message.thumbnailSha256; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + object.thumbnailEncSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailEncSha256, 0, message.thumbnailEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailEncSha256) : message.thumbnailEncSha256; + if (message.staticUrl != null && message.hasOwnProperty("staticUrl")) + object.staticUrl = message.staticUrl; + return object; + }; + + /** + * Converts this ImageMessage to JSON. + * @function toJSON + * @memberof proto.Message.ImageMessage + * @instance + * @returns {Object.} JSON object + */ + ImageMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ImageMessage; + })(); + + Message.InitialSecurityNotificationSettingSync = (function() { + + /** + * Properties of an InitialSecurityNotificationSettingSync. + * @memberof proto.Message + * @interface IInitialSecurityNotificationSettingSync + * @property {boolean|null} [securityNotificationEnabled] InitialSecurityNotificationSettingSync securityNotificationEnabled + */ + + /** + * Constructs a new InitialSecurityNotificationSettingSync. + * @memberof proto.Message + * @classdesc Represents an InitialSecurityNotificationSettingSync. + * @implements IInitialSecurityNotificationSettingSync + * @constructor + * @param {proto.Message.IInitialSecurityNotificationSettingSync=} [properties] Properties to set + */ + function InitialSecurityNotificationSettingSync(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InitialSecurityNotificationSettingSync securityNotificationEnabled. + * @member {boolean} securityNotificationEnabled + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @instance + */ + InitialSecurityNotificationSettingSync.prototype.securityNotificationEnabled = false; + + /** + * Creates a new InitialSecurityNotificationSettingSync instance using the specified properties. + * @function create + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {proto.Message.IInitialSecurityNotificationSettingSync=} [properties] Properties to set + * @returns {proto.Message.InitialSecurityNotificationSettingSync} InitialSecurityNotificationSettingSync instance + */ + InitialSecurityNotificationSettingSync.create = function create(properties) { + return new InitialSecurityNotificationSettingSync(properties); + }; + + /** + * Encodes the specified InitialSecurityNotificationSettingSync message. Does not implicitly {@link proto.Message.InitialSecurityNotificationSettingSync.verify|verify} messages. + * @function encode + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {proto.Message.IInitialSecurityNotificationSettingSync} message InitialSecurityNotificationSettingSync message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InitialSecurityNotificationSettingSync.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.securityNotificationEnabled != null && Object.hasOwnProperty.call(message, "securityNotificationEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.securityNotificationEnabled); + return writer; + }; + + /** + * Encodes the specified InitialSecurityNotificationSettingSync message, length delimited. Does not implicitly {@link proto.Message.InitialSecurityNotificationSettingSync.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {proto.Message.IInitialSecurityNotificationSettingSync} message InitialSecurityNotificationSettingSync message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InitialSecurityNotificationSettingSync.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InitialSecurityNotificationSettingSync message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InitialSecurityNotificationSettingSync} InitialSecurityNotificationSettingSync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InitialSecurityNotificationSettingSync.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InitialSecurityNotificationSettingSync(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.securityNotificationEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InitialSecurityNotificationSettingSync message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InitialSecurityNotificationSettingSync} InitialSecurityNotificationSettingSync + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InitialSecurityNotificationSettingSync.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InitialSecurityNotificationSettingSync message. + * @function verify + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InitialSecurityNotificationSettingSync.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.securityNotificationEnabled != null && message.hasOwnProperty("securityNotificationEnabled")) + if (typeof message.securityNotificationEnabled !== "boolean") + return "securityNotificationEnabled: boolean expected"; + return null; + }; + + /** + * Creates an InitialSecurityNotificationSettingSync message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InitialSecurityNotificationSettingSync} InitialSecurityNotificationSettingSync + */ + InitialSecurityNotificationSettingSync.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InitialSecurityNotificationSettingSync) + return object; + var message = new $root.proto.Message.InitialSecurityNotificationSettingSync(); + if (object.securityNotificationEnabled != null) + message.securityNotificationEnabled = Boolean(object.securityNotificationEnabled); + return message; + }; + + /** + * Creates a plain object from an InitialSecurityNotificationSettingSync message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @static + * @param {proto.Message.InitialSecurityNotificationSettingSync} message InitialSecurityNotificationSettingSync + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InitialSecurityNotificationSettingSync.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.securityNotificationEnabled = false; + if (message.securityNotificationEnabled != null && message.hasOwnProperty("securityNotificationEnabled")) + object.securityNotificationEnabled = message.securityNotificationEnabled; + return object; + }; + + /** + * Converts this InitialSecurityNotificationSettingSync to JSON. + * @function toJSON + * @memberof proto.Message.InitialSecurityNotificationSettingSync + * @instance + * @returns {Object.} JSON object + */ + InitialSecurityNotificationSettingSync.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return InitialSecurityNotificationSettingSync; + })(); + + Message.InteractiveMessage = (function() { + + /** + * Properties of an InteractiveMessage. + * @memberof proto.Message + * @interface IInteractiveMessage + * @property {proto.Message.InteractiveMessage.IHeader|null} [header] InteractiveMessage header + * @property {proto.Message.InteractiveMessage.IBody|null} [body] InteractiveMessage body + * @property {proto.Message.InteractiveMessage.IFooter|null} [footer] InteractiveMessage footer + * @property {proto.IContextInfo|null} [contextInfo] InteractiveMessage contextInfo + * @property {proto.Message.InteractiveMessage.IShopMessage|null} [shopStorefrontMessage] InteractiveMessage shopStorefrontMessage + * @property {proto.Message.InteractiveMessage.ICollectionMessage|null} [collectionMessage] InteractiveMessage collectionMessage + * @property {proto.Message.InteractiveMessage.INativeFlowMessage|null} [nativeFlowMessage] InteractiveMessage nativeFlowMessage + */ + + /** + * Constructs a new InteractiveMessage. + * @memberof proto.Message + * @classdesc Represents an InteractiveMessage. + * @implements IInteractiveMessage + * @constructor + * @param {proto.Message.IInteractiveMessage=} [properties] Properties to set + */ + function InteractiveMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InteractiveMessage header. + * @member {proto.Message.InteractiveMessage.IHeader|null|undefined} header + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.header = null; + + /** + * InteractiveMessage body. + * @member {proto.Message.InteractiveMessage.IBody|null|undefined} body + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.body = null; + + /** + * InteractiveMessage footer. + * @member {proto.Message.InteractiveMessage.IFooter|null|undefined} footer + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.footer = null; + + /** + * InteractiveMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.contextInfo = null; + + /** + * InteractiveMessage shopStorefrontMessage. + * @member {proto.Message.InteractiveMessage.IShopMessage|null|undefined} shopStorefrontMessage + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.shopStorefrontMessage = null; + + /** + * InteractiveMessage collectionMessage. + * @member {proto.Message.InteractiveMessage.ICollectionMessage|null|undefined} collectionMessage + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.collectionMessage = null; + + /** + * InteractiveMessage nativeFlowMessage. + * @member {proto.Message.InteractiveMessage.INativeFlowMessage|null|undefined} nativeFlowMessage + * @memberof proto.Message.InteractiveMessage + * @instance + */ + InteractiveMessage.prototype.nativeFlowMessage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InteractiveMessage interactiveMessage. + * @member {"shopStorefrontMessage"|"collectionMessage"|"nativeFlowMessage"|undefined} interactiveMessage + * @memberof proto.Message.InteractiveMessage + * @instance + */ + Object.defineProperty(InteractiveMessage.prototype, "interactiveMessage", { + get: $util.oneOfGetter($oneOfFields = ["shopStorefrontMessage", "collectionMessage", "nativeFlowMessage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InteractiveMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage + * @static + * @param {proto.Message.IInteractiveMessage=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage} InteractiveMessage instance + */ + InteractiveMessage.create = function create(properties) { + return new InteractiveMessage(properties); + }; + + /** + * Encodes the specified InteractiveMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage + * @static + * @param {proto.Message.IInteractiveMessage} message InteractiveMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InteractiveMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + $root.proto.Message.InteractiveMessage.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.proto.Message.InteractiveMessage.Body.encode(message.body, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.footer != null && Object.hasOwnProperty.call(message, "footer")) + $root.proto.Message.InteractiveMessage.Footer.encode(message.footer, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.shopStorefrontMessage != null && Object.hasOwnProperty.call(message, "shopStorefrontMessage")) + $root.proto.Message.InteractiveMessage.ShopMessage.encode(message.shopStorefrontMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.collectionMessage != null && Object.hasOwnProperty.call(message, "collectionMessage")) + $root.proto.Message.InteractiveMessage.CollectionMessage.encode(message.collectionMessage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.nativeFlowMessage != null && Object.hasOwnProperty.call(message, "nativeFlowMessage")) + $root.proto.Message.InteractiveMessage.NativeFlowMessage.encode(message.nativeFlowMessage, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InteractiveMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage + * @static + * @param {proto.Message.IInteractiveMessage} message InteractiveMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InteractiveMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InteractiveMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage} InteractiveMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InteractiveMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = $root.proto.Message.InteractiveMessage.Header.decode(reader, reader.uint32()); + break; + case 2: + message.body = $root.proto.Message.InteractiveMessage.Body.decode(reader, reader.uint32()); + break; + case 3: + message.footer = $root.proto.Message.InteractiveMessage.Footer.decode(reader, reader.uint32()); + break; + case 15: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 4: + message.shopStorefrontMessage = $root.proto.Message.InteractiveMessage.ShopMessage.decode(reader, reader.uint32()); + break; + case 5: + message.collectionMessage = $root.proto.Message.InteractiveMessage.CollectionMessage.decode(reader, reader.uint32()); + break; + case 6: + message.nativeFlowMessage = $root.proto.Message.InteractiveMessage.NativeFlowMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InteractiveMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage} InteractiveMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InteractiveMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InteractiveMessage message. + * @function verify + * @memberof proto.Message.InteractiveMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InteractiveMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.header != null && message.hasOwnProperty("header")) { + var error = $root.proto.Message.InteractiveMessage.Header.verify(message.header); + if (error) + return "header." + error; + } + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.proto.Message.InteractiveMessage.Body.verify(message.body); + if (error) + return "body." + error; + } + if (message.footer != null && message.hasOwnProperty("footer")) { + var error = $root.proto.Message.InteractiveMessage.Footer.verify(message.footer); + if (error) + return "footer." + error; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.shopStorefrontMessage != null && message.hasOwnProperty("shopStorefrontMessage")) { + properties.interactiveMessage = 1; + { + var error = $root.proto.Message.InteractiveMessage.ShopMessage.verify(message.shopStorefrontMessage); + if (error) + return "shopStorefrontMessage." + error; + } + } + if (message.collectionMessage != null && message.hasOwnProperty("collectionMessage")) { + if (properties.interactiveMessage === 1) + return "interactiveMessage: multiple values"; + properties.interactiveMessage = 1; + { + var error = $root.proto.Message.InteractiveMessage.CollectionMessage.verify(message.collectionMessage); + if (error) + return "collectionMessage." + error; + } + } + if (message.nativeFlowMessage != null && message.hasOwnProperty("nativeFlowMessage")) { + if (properties.interactiveMessage === 1) + return "interactiveMessage: multiple values"; + properties.interactiveMessage = 1; + { + var error = $root.proto.Message.InteractiveMessage.NativeFlowMessage.verify(message.nativeFlowMessage); + if (error) + return "nativeFlowMessage." + error; + } + } + return null; + }; + + /** + * Creates an InteractiveMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage} InteractiveMessage + */ + InteractiveMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage) + return object; + var message = new $root.proto.Message.InteractiveMessage(); + if (object.header != null) { + if (typeof object.header !== "object") + throw TypeError(".proto.Message.InteractiveMessage.header: object expected"); + message.header = $root.proto.Message.InteractiveMessage.Header.fromObject(object.header); + } + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".proto.Message.InteractiveMessage.body: object expected"); + message.body = $root.proto.Message.InteractiveMessage.Body.fromObject(object.body); + } + if (object.footer != null) { + if (typeof object.footer !== "object") + throw TypeError(".proto.Message.InteractiveMessage.footer: object expected"); + message.footer = $root.proto.Message.InteractiveMessage.Footer.fromObject(object.footer); + } + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.InteractiveMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.shopStorefrontMessage != null) { + if (typeof object.shopStorefrontMessage !== "object") + throw TypeError(".proto.Message.InteractiveMessage.shopStorefrontMessage: object expected"); + message.shopStorefrontMessage = $root.proto.Message.InteractiveMessage.ShopMessage.fromObject(object.shopStorefrontMessage); + } + if (object.collectionMessage != null) { + if (typeof object.collectionMessage !== "object") + throw TypeError(".proto.Message.InteractiveMessage.collectionMessage: object expected"); + message.collectionMessage = $root.proto.Message.InteractiveMessage.CollectionMessage.fromObject(object.collectionMessage); + } + if (object.nativeFlowMessage != null) { + if (typeof object.nativeFlowMessage !== "object") + throw TypeError(".proto.Message.InteractiveMessage.nativeFlowMessage: object expected"); + message.nativeFlowMessage = $root.proto.Message.InteractiveMessage.NativeFlowMessage.fromObject(object.nativeFlowMessage); + } + return message; + }; + + /** + * Creates a plain object from an InteractiveMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage + * @static + * @param {proto.Message.InteractiveMessage} message InteractiveMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InteractiveMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.header = null; + object.body = null; + object.footer = null; + object.contextInfo = null; + } + if (message.header != null && message.hasOwnProperty("header")) + object.header = $root.proto.Message.InteractiveMessage.Header.toObject(message.header, options); + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.proto.Message.InteractiveMessage.Body.toObject(message.body, options); + if (message.footer != null && message.hasOwnProperty("footer")) + object.footer = $root.proto.Message.InteractiveMessage.Footer.toObject(message.footer, options); + if (message.shopStorefrontMessage != null && message.hasOwnProperty("shopStorefrontMessage")) { + object.shopStorefrontMessage = $root.proto.Message.InteractiveMessage.ShopMessage.toObject(message.shopStorefrontMessage, options); + if (options.oneofs) + object.interactiveMessage = "shopStorefrontMessage"; + } + if (message.collectionMessage != null && message.hasOwnProperty("collectionMessage")) { + object.collectionMessage = $root.proto.Message.InteractiveMessage.CollectionMessage.toObject(message.collectionMessage, options); + if (options.oneofs) + object.interactiveMessage = "collectionMessage"; + } + if (message.nativeFlowMessage != null && message.hasOwnProperty("nativeFlowMessage")) { + object.nativeFlowMessage = $root.proto.Message.InteractiveMessage.NativeFlowMessage.toObject(message.nativeFlowMessage, options); + if (options.oneofs) + object.interactiveMessage = "nativeFlowMessage"; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this InteractiveMessage to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage + * @instance + * @returns {Object.} JSON object + */ + InteractiveMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + InteractiveMessage.Body = (function() { + + /** + * Properties of a Body. + * @memberof proto.Message.InteractiveMessage + * @interface IBody + * @property {string|null} [text] Body text + */ + + /** + * Constructs a new Body. + * @memberof proto.Message.InteractiveMessage + * @classdesc Represents a Body. + * @implements IBody + * @constructor + * @param {proto.Message.InteractiveMessage.IBody=} [properties] Properties to set + */ + function Body(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Body text. + * @member {string} text + * @memberof proto.Message.InteractiveMessage.Body + * @instance + */ + Body.prototype.text = ""; + + /** + * Creates a new Body instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {proto.Message.InteractiveMessage.IBody=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.Body} Body instance + */ + Body.create = function create(properties) { + return new Body(properties); + }; + + /** + * Encodes the specified Body message. Does not implicitly {@link proto.Message.InteractiveMessage.Body.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {proto.Message.InteractiveMessage.IBody} message Body message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Body.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + return writer; + }; + + /** + * Encodes the specified Body message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Body.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {proto.Message.InteractiveMessage.IBody} message Body message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Body.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Body message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.Body} Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Body.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.Body(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Body message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.Body} Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Body.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Body message. + * @function verify + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Body.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a Body message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.Body} Body + */ + Body.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.Body) + return object; + var message = new $root.proto.Message.InteractiveMessage.Body(); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a Body message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.Body + * @static + * @param {proto.Message.InteractiveMessage.Body} message Body + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Body.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this Body to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.Body + * @instance + * @returns {Object.} JSON object + */ + Body.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Body; + })(); + + InteractiveMessage.CollectionMessage = (function() { + + /** + * Properties of a CollectionMessage. + * @memberof proto.Message.InteractiveMessage + * @interface ICollectionMessage + * @property {string|null} [bizJid] CollectionMessage bizJid + * @property {string|null} [id] CollectionMessage id + * @property {number|null} [messageVersion] CollectionMessage messageVersion + */ + + /** + * Constructs a new CollectionMessage. + * @memberof proto.Message.InteractiveMessage + * @classdesc Represents a CollectionMessage. + * @implements ICollectionMessage + * @constructor + * @param {proto.Message.InteractiveMessage.ICollectionMessage=} [properties] Properties to set + */ + function CollectionMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CollectionMessage bizJid. + * @member {string} bizJid + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @instance + */ + CollectionMessage.prototype.bizJid = ""; + + /** + * CollectionMessage id. + * @member {string} id + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @instance + */ + CollectionMessage.prototype.id = ""; + + /** + * CollectionMessage messageVersion. + * @member {number} messageVersion + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @instance + */ + CollectionMessage.prototype.messageVersion = 0; + + /** + * Creates a new CollectionMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {proto.Message.InteractiveMessage.ICollectionMessage=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.CollectionMessage} CollectionMessage instance + */ + CollectionMessage.create = function create(properties) { + return new CollectionMessage(properties); + }; + + /** + * Encodes the specified CollectionMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.CollectionMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {proto.Message.InteractiveMessage.ICollectionMessage} message CollectionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectionMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bizJid != null && Object.hasOwnProperty.call(message, "bizJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.bizJid); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + if (message.messageVersion != null && Object.hasOwnProperty.call(message, "messageVersion")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageVersion); + return writer; + }; + + /** + * Encodes the specified CollectionMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.CollectionMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {proto.Message.InteractiveMessage.ICollectionMessage} message CollectionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CollectionMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CollectionMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.CollectionMessage} CollectionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectionMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.CollectionMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bizJid = reader.string(); + break; + case 2: + message.id = reader.string(); + break; + case 3: + message.messageVersion = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CollectionMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.CollectionMessage} CollectionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CollectionMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CollectionMessage message. + * @function verify + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CollectionMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bizJid != null && message.hasOwnProperty("bizJid")) + if (!$util.isString(message.bizJid)) + return "bizJid: string expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.messageVersion != null && message.hasOwnProperty("messageVersion")) + if (!$util.isInteger(message.messageVersion)) + return "messageVersion: integer expected"; + return null; + }; + + /** + * Creates a CollectionMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.CollectionMessage} CollectionMessage + */ + CollectionMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.CollectionMessage) + return object; + var message = new $root.proto.Message.InteractiveMessage.CollectionMessage(); + if (object.bizJid != null) + message.bizJid = String(object.bizJid); + if (object.id != null) + message.id = String(object.id); + if (object.messageVersion != null) + message.messageVersion = object.messageVersion | 0; + return message; + }; + + /** + * Creates a plain object from a CollectionMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @static + * @param {proto.Message.InteractiveMessage.CollectionMessage} message CollectionMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CollectionMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.bizJid = ""; + object.id = ""; + object.messageVersion = 0; + } + if (message.bizJid != null && message.hasOwnProperty("bizJid")) + object.bizJid = message.bizJid; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.messageVersion != null && message.hasOwnProperty("messageVersion")) + object.messageVersion = message.messageVersion; + return object; + }; + + /** + * Converts this CollectionMessage to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.CollectionMessage + * @instance + * @returns {Object.} JSON object + */ + CollectionMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CollectionMessage; + })(); + + InteractiveMessage.Footer = (function() { + + /** + * Properties of a Footer. + * @memberof proto.Message.InteractiveMessage + * @interface IFooter + * @property {string|null} [text] Footer text + */ + + /** + * Constructs a new Footer. + * @memberof proto.Message.InteractiveMessage + * @classdesc Represents a Footer. + * @implements IFooter + * @constructor + * @param {proto.Message.InteractiveMessage.IFooter=} [properties] Properties to set + */ + function Footer(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Footer text. + * @member {string} text + * @memberof proto.Message.InteractiveMessage.Footer + * @instance + */ + Footer.prototype.text = ""; + + /** + * Creates a new Footer instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {proto.Message.InteractiveMessage.IFooter=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.Footer} Footer instance + */ + Footer.create = function create(properties) { + return new Footer(properties); + }; + + /** + * Encodes the specified Footer message. Does not implicitly {@link proto.Message.InteractiveMessage.Footer.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {proto.Message.InteractiveMessage.IFooter} message Footer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Footer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + return writer; + }; + + /** + * Encodes the specified Footer message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Footer.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {proto.Message.InteractiveMessage.IFooter} message Footer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Footer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Footer message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.Footer} Footer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Footer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.Footer(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Footer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.Footer} Footer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Footer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Footer message. + * @function verify + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Footer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a Footer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.Footer} Footer + */ + Footer.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.Footer) + return object; + var message = new $root.proto.Message.InteractiveMessage.Footer(); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a Footer message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.Footer + * @static + * @param {proto.Message.InteractiveMessage.Footer} message Footer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Footer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this Footer to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.Footer + * @instance + * @returns {Object.} JSON object + */ + Footer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Footer; + })(); + + InteractiveMessage.Header = (function() { + + /** + * Properties of a Header. + * @memberof proto.Message.InteractiveMessage + * @interface IHeader + * @property {string|null} [title] Header title + * @property {string|null} [subtitle] Header subtitle + * @property {boolean|null} [hasMediaAttachment] Header hasMediaAttachment + * @property {proto.Message.IDocumentMessage|null} [documentMessage] Header documentMessage + * @property {proto.Message.IImageMessage|null} [imageMessage] Header imageMessage + * @property {Uint8Array|null} [jpegThumbnail] Header jpegThumbnail + * @property {proto.Message.IVideoMessage|null} [videoMessage] Header videoMessage + */ + + /** + * Constructs a new Header. + * @memberof proto.Message.InteractiveMessage + * @classdesc Represents a Header. + * @implements IHeader + * @constructor + * @param {proto.Message.InteractiveMessage.IHeader=} [properties] Properties to set + */ + function Header(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Header title. + * @member {string} title + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.title = ""; + + /** + * Header subtitle. + * @member {string} subtitle + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.subtitle = ""; + + /** + * Header hasMediaAttachment. + * @member {boolean} hasMediaAttachment + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.hasMediaAttachment = false; + + /** + * Header documentMessage. + * @member {proto.Message.IDocumentMessage|null|undefined} documentMessage + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.documentMessage = null; + + /** + * Header imageMessage. + * @member {proto.Message.IImageMessage|null|undefined} imageMessage + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.imageMessage = null; + + /** + * Header jpegThumbnail. + * @member {Uint8Array|null|undefined} jpegThumbnail + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.jpegThumbnail = null; + + /** + * Header videoMessage. + * @member {proto.Message.IVideoMessage|null|undefined} videoMessage + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Header.prototype.videoMessage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Header media. + * @member {"documentMessage"|"imageMessage"|"jpegThumbnail"|"videoMessage"|undefined} media + * @memberof proto.Message.InteractiveMessage.Header + * @instance + */ + Object.defineProperty(Header.prototype, "media", { + get: $util.oneOfGetter($oneOfFields = ["documentMessage", "imageMessage", "jpegThumbnail", "videoMessage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Header instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {proto.Message.InteractiveMessage.IHeader=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.Header} Header instance + */ + Header.create = function create(properties) { + return new Header(properties); + }; + + /** + * Encodes the specified Header message. Does not implicitly {@link proto.Message.InteractiveMessage.Header.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {proto.Message.InteractiveMessage.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.documentMessage != null && Object.hasOwnProperty.call(message, "documentMessage")) + $root.proto.Message.DocumentMessage.encode(message.documentMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.imageMessage != null && Object.hasOwnProperty.call(message, "imageMessage")) + $root.proto.Message.ImageMessage.encode(message.imageMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.hasMediaAttachment != null && Object.hasOwnProperty.call(message, "hasMediaAttachment")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.hasMediaAttachment); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.jpegThumbnail); + if (message.videoMessage != null && Object.hasOwnProperty.call(message, "videoMessage")) + $root.proto.Message.VideoMessage.encode(message.videoMessage, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Header message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Header.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {proto.Message.InteractiveMessage.IHeader} message Header message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Header.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Header message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.Header(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.subtitle = reader.string(); + break; + case 5: + message.hasMediaAttachment = reader.bool(); + break; + case 3: + message.documentMessage = $root.proto.Message.DocumentMessage.decode(reader, reader.uint32()); + break; + case 4: + message.imageMessage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 6: + message.jpegThumbnail = reader.bytes(); + break; + case 7: + message.videoMessage = $root.proto.Message.VideoMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Header message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.Header} Header + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Header.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Header message. + * @function verify + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Header.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.hasMediaAttachment != null && message.hasOwnProperty("hasMediaAttachment")) + if (typeof message.hasMediaAttachment !== "boolean") + return "hasMediaAttachment: boolean expected"; + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + properties.media = 1; + { + var error = $root.proto.Message.DocumentMessage.verify(message.documentMessage); + if (error) + return "documentMessage." + error; + } + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + if (properties.media === 1) + return "media: multiple values"; + properties.media = 1; + { + var error = $root.proto.Message.ImageMessage.verify(message.imageMessage); + if (error) + return "imageMessage." + error; + } + } + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) { + if (properties.media === 1) + return "media: multiple values"; + properties.media = 1; + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + if (properties.media === 1) + return "media: multiple values"; + properties.media = 1; + { + var error = $root.proto.Message.VideoMessage.verify(message.videoMessage); + if (error) + return "videoMessage." + error; + } + } + return null; + }; + + /** + * Creates a Header message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.Header} Header + */ + Header.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.Header) + return object; + var message = new $root.proto.Message.InteractiveMessage.Header(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.hasMediaAttachment != null) + message.hasMediaAttachment = Boolean(object.hasMediaAttachment); + if (object.documentMessage != null) { + if (typeof object.documentMessage !== "object") + throw TypeError(".proto.Message.InteractiveMessage.Header.documentMessage: object expected"); + message.documentMessage = $root.proto.Message.DocumentMessage.fromObject(object.documentMessage); + } + if (object.imageMessage != null) { + if (typeof object.imageMessage !== "object") + throw TypeError(".proto.Message.InteractiveMessage.Header.imageMessage: object expected"); + message.imageMessage = $root.proto.Message.ImageMessage.fromObject(object.imageMessage); + } + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.videoMessage != null) { + if (typeof object.videoMessage !== "object") + throw TypeError(".proto.Message.InteractiveMessage.Header.videoMessage: object expected"); + message.videoMessage = $root.proto.Message.VideoMessage.fromObject(object.videoMessage); + } + return message; + }; + + /** + * Creates a plain object from a Header message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.Header + * @static + * @param {proto.Message.InteractiveMessage.Header} message Header + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Header.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.hasMediaAttachment = false; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + object.documentMessage = $root.proto.Message.DocumentMessage.toObject(message.documentMessage, options); + if (options.oneofs) + object.media = "documentMessage"; + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + object.imageMessage = $root.proto.Message.ImageMessage.toObject(message.imageMessage, options); + if (options.oneofs) + object.media = "imageMessage"; + } + if (message.hasMediaAttachment != null && message.hasOwnProperty("hasMediaAttachment")) + object.hasMediaAttachment = message.hasMediaAttachment; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) { + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (options.oneofs) + object.media = "jpegThumbnail"; + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + object.videoMessage = $root.proto.Message.VideoMessage.toObject(message.videoMessage, options); + if (options.oneofs) + object.media = "videoMessage"; + } + return object; + }; + + /** + * Converts this Header to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.Header + * @instance + * @returns {Object.} JSON object + */ + Header.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Header; + })(); + + InteractiveMessage.NativeFlowMessage = (function() { + + /** + * Properties of a NativeFlowMessage. + * @memberof proto.Message.InteractiveMessage + * @interface INativeFlowMessage + * @property {Array.|null} [buttons] NativeFlowMessage buttons + * @property {string|null} [messageParamsJson] NativeFlowMessage messageParamsJson + * @property {number|null} [messageVersion] NativeFlowMessage messageVersion + */ + + /** + * Constructs a new NativeFlowMessage. + * @memberof proto.Message.InteractiveMessage + * @classdesc Represents a NativeFlowMessage. + * @implements INativeFlowMessage + * @constructor + * @param {proto.Message.InteractiveMessage.INativeFlowMessage=} [properties] Properties to set + */ + function NativeFlowMessage(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NativeFlowMessage buttons. + * @member {Array.} buttons + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @instance + */ + NativeFlowMessage.prototype.buttons = $util.emptyArray; + + /** + * NativeFlowMessage messageParamsJson. + * @member {string} messageParamsJson + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @instance + */ + NativeFlowMessage.prototype.messageParamsJson = ""; + + /** + * NativeFlowMessage messageVersion. + * @member {number} messageVersion + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @instance + */ + NativeFlowMessage.prototype.messageVersion = 0; + + /** + * Creates a new NativeFlowMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {proto.Message.InteractiveMessage.INativeFlowMessage=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage} NativeFlowMessage instance + */ + NativeFlowMessage.create = function create(properties) { + return new NativeFlowMessage(properties); + }; + + /** + * Encodes the specified NativeFlowMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {proto.Message.InteractiveMessage.INativeFlowMessage} message NativeFlowMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.encode(message.buttons[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.messageParamsJson != null && Object.hasOwnProperty.call(message, "messageParamsJson")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.messageParamsJson); + if (message.messageVersion != null && Object.hasOwnProperty.call(message, "messageVersion")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageVersion); + return writer; + }; + + /** + * Encodes the specified NativeFlowMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {proto.Message.InteractiveMessage.INativeFlowMessage} message NativeFlowMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NativeFlowMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage} NativeFlowMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.NativeFlowMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.decode(reader, reader.uint32())); + break; + case 2: + message.messageParamsJson = reader.string(); + break; + case 3: + message.messageVersion = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NativeFlowMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage} NativeFlowMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NativeFlowMessage message. + * @function verify + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NativeFlowMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + if (message.messageParamsJson != null && message.hasOwnProperty("messageParamsJson")) + if (!$util.isString(message.messageParamsJson)) + return "messageParamsJson: string expected"; + if (message.messageVersion != null && message.hasOwnProperty("messageVersion")) + if (!$util.isInteger(message.messageVersion)) + return "messageVersion: integer expected"; + return null; + }; + + /** + * Creates a NativeFlowMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage} NativeFlowMessage + */ + NativeFlowMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.NativeFlowMessage) + return object; + var message = new $root.proto.Message.InteractiveMessage.NativeFlowMessage(); + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".proto.Message.InteractiveMessage.NativeFlowMessage.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".proto.Message.InteractiveMessage.NativeFlowMessage.buttons: object expected"); + message.buttons[i] = $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.fromObject(object.buttons[i]); + } + } + if (object.messageParamsJson != null) + message.messageParamsJson = String(object.messageParamsJson); + if (object.messageVersion != null) + message.messageVersion = object.messageVersion | 0; + return message; + }; + + /** + * Creates a plain object from a NativeFlowMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @static + * @param {proto.Message.InteractiveMessage.NativeFlowMessage} message NativeFlowMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NativeFlowMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.messageParamsJson = ""; + object.messageVersion = 0; + } + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.toObject(message.buttons[j], options); + } + if (message.messageParamsJson != null && message.hasOwnProperty("messageParamsJson")) + object.messageParamsJson = message.messageParamsJson; + if (message.messageVersion != null && message.hasOwnProperty("messageVersion")) + object.messageVersion = message.messageVersion; + return object; + }; + + /** + * Converts this NativeFlowMessage to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @instance + * @returns {Object.} JSON object + */ + NativeFlowMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + NativeFlowMessage.NativeFlowButton = (function() { + + /** + * Properties of a NativeFlowButton. + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @interface INativeFlowButton + * @property {string|null} [name] NativeFlowButton name + * @property {string|null} [buttonParamsJson] NativeFlowButton buttonParamsJson + */ + + /** + * Constructs a new NativeFlowButton. + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage + * @classdesc Represents a NativeFlowButton. + * @implements INativeFlowButton + * @constructor + * @param {proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton=} [properties] Properties to set + */ + function NativeFlowButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NativeFlowButton name. + * @member {string} name + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @instance + */ + NativeFlowButton.prototype.name = ""; + + /** + * NativeFlowButton buttonParamsJson. + * @member {string} buttonParamsJson + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @instance + */ + NativeFlowButton.prototype.buttonParamsJson = ""; + + /** + * Creates a new NativeFlowButton instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton} NativeFlowButton instance + */ + NativeFlowButton.create = function create(properties) { + return new NativeFlowButton(properties); + }; + + /** + * Encodes the specified NativeFlowButton message. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton} message NativeFlowButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.buttonParamsJson != null && Object.hasOwnProperty.call(message, "buttonParamsJson")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.buttonParamsJson); + return writer; + }; + + /** + * Encodes the specified NativeFlowButton message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton} message NativeFlowButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NativeFlowButton message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton} NativeFlowButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.buttonParamsJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NativeFlowButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton} NativeFlowButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NativeFlowButton message. + * @function verify + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NativeFlowButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.buttonParamsJson != null && message.hasOwnProperty("buttonParamsJson")) + if (!$util.isString(message.buttonParamsJson)) + return "buttonParamsJson: string expected"; + return null; + }; + + /** + * Creates a NativeFlowButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton} NativeFlowButton + */ + NativeFlowButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton) + return object; + var message = new $root.proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton(); + if (object.name != null) + message.name = String(object.name); + if (object.buttonParamsJson != null) + message.buttonParamsJson = String(object.buttonParamsJson); + return message; + }; + + /** + * Creates a plain object from a NativeFlowButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @static + * @param {proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton} message NativeFlowButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NativeFlowButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.buttonParamsJson = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.buttonParamsJson != null && message.hasOwnProperty("buttonParamsJson")) + object.buttonParamsJson = message.buttonParamsJson; + return object; + }; + + /** + * Converts this NativeFlowButton to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton + * @instance + * @returns {Object.} JSON object + */ + NativeFlowButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NativeFlowButton; + })(); + + return NativeFlowMessage; + })(); + + InteractiveMessage.ShopMessage = (function() { + + /** + * Properties of a ShopMessage. + * @memberof proto.Message.InteractiveMessage + * @interface IShopMessage + * @property {string|null} [id] ShopMessage id + * @property {proto.Message.InteractiveMessage.ShopMessage.Surface|null} [surface] ShopMessage surface + * @property {number|null} [messageVersion] ShopMessage messageVersion + */ + + /** + * Constructs a new ShopMessage. + * @memberof proto.Message.InteractiveMessage + * @classdesc Represents a ShopMessage. + * @implements IShopMessage + * @constructor + * @param {proto.Message.InteractiveMessage.IShopMessage=} [properties] Properties to set + */ + function ShopMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ShopMessage id. + * @member {string} id + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @instance + */ + ShopMessage.prototype.id = ""; + + /** + * ShopMessage surface. + * @member {proto.Message.InteractiveMessage.ShopMessage.Surface} surface + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @instance + */ + ShopMessage.prototype.surface = 0; + + /** + * ShopMessage messageVersion. + * @member {number} messageVersion + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @instance + */ + ShopMessage.prototype.messageVersion = 0; + + /** + * Creates a new ShopMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {proto.Message.InteractiveMessage.IShopMessage=} [properties] Properties to set + * @returns {proto.Message.InteractiveMessage.ShopMessage} ShopMessage instance + */ + ShopMessage.create = function create(properties) { + return new ShopMessage(properties); + }; + + /** + * Encodes the specified ShopMessage message. Does not implicitly {@link proto.Message.InteractiveMessage.ShopMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {proto.Message.InteractiveMessage.IShopMessage} message ShopMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShopMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.surface != null && Object.hasOwnProperty.call(message, "surface")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.surface); + if (message.messageVersion != null && Object.hasOwnProperty.call(message, "messageVersion")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageVersion); + return writer; + }; + + /** + * Encodes the specified ShopMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.ShopMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {proto.Message.InteractiveMessage.IShopMessage} message ShopMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShopMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShopMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveMessage.ShopMessage} ShopMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShopMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.ShopMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.surface = reader.int32(); + break; + case 3: + message.messageVersion = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShopMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveMessage.ShopMessage} ShopMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShopMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShopMessage message. + * @function verify + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShopMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.surface != null && message.hasOwnProperty("surface")) + switch (message.surface) { + default: + return "surface: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.messageVersion != null && message.hasOwnProperty("messageVersion")) + if (!$util.isInteger(message.messageVersion)) + return "messageVersion: integer expected"; + return null; + }; + + /** + * Creates a ShopMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveMessage.ShopMessage} ShopMessage + */ + ShopMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveMessage.ShopMessage) + return object; + var message = new $root.proto.Message.InteractiveMessage.ShopMessage(); + if (object.id != null) + message.id = String(object.id); + switch (object.surface) { + case "UNKNOWN_SURFACE": + case 0: + message.surface = 0; + break; + case "FB": + case 1: + message.surface = 1; + break; + case "IG": + case 2: + message.surface = 2; + break; + case "WA": + case 3: + message.surface = 3; + break; + } + if (object.messageVersion != null) + message.messageVersion = object.messageVersion | 0; + return message; + }; + + /** + * Creates a plain object from a ShopMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @static + * @param {proto.Message.InteractiveMessage.ShopMessage} message ShopMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShopMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.surface = options.enums === String ? "UNKNOWN_SURFACE" : 0; + object.messageVersion = 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.surface != null && message.hasOwnProperty("surface")) + object.surface = options.enums === String ? $root.proto.Message.InteractiveMessage.ShopMessage.Surface[message.surface] : message.surface; + if (message.messageVersion != null && message.hasOwnProperty("messageVersion")) + object.messageVersion = message.messageVersion; + return object; + }; + + /** + * Converts this ShopMessage to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveMessage.ShopMessage + * @instance + * @returns {Object.} JSON object + */ + ShopMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Surface enum. + * @name proto.Message.InteractiveMessage.ShopMessage.Surface + * @enum {number} + * @property {number} UNKNOWN_SURFACE=0 UNKNOWN_SURFACE value + * @property {number} FB=1 FB value + * @property {number} IG=2 IG value + * @property {number} WA=3 WA value + */ + ShopMessage.Surface = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_SURFACE"] = 0; + values[valuesById[1] = "FB"] = 1; + values[valuesById[2] = "IG"] = 2; + values[valuesById[3] = "WA"] = 3; + return values; + })(); + + return ShopMessage; + })(); + + return InteractiveMessage; + })(); + + Message.InteractiveResponseMessage = (function() { + + /** + * Properties of an InteractiveResponseMessage. + * @memberof proto.Message + * @interface IInteractiveResponseMessage + * @property {proto.Message.InteractiveResponseMessage.IBody|null} [body] InteractiveResponseMessage body + * @property {proto.IContextInfo|null} [contextInfo] InteractiveResponseMessage contextInfo + * @property {proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage|null} [nativeFlowResponseMessage] InteractiveResponseMessage nativeFlowResponseMessage + */ + + /** + * Constructs a new InteractiveResponseMessage. + * @memberof proto.Message + * @classdesc Represents an InteractiveResponseMessage. + * @implements IInteractiveResponseMessage + * @constructor + * @param {proto.Message.IInteractiveResponseMessage=} [properties] Properties to set + */ + function InteractiveResponseMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InteractiveResponseMessage body. + * @member {proto.Message.InteractiveResponseMessage.IBody|null|undefined} body + * @memberof proto.Message.InteractiveResponseMessage + * @instance + */ + InteractiveResponseMessage.prototype.body = null; + + /** + * InteractiveResponseMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.InteractiveResponseMessage + * @instance + */ + InteractiveResponseMessage.prototype.contextInfo = null; + + /** + * InteractiveResponseMessage nativeFlowResponseMessage. + * @member {proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage|null|undefined} nativeFlowResponseMessage + * @memberof proto.Message.InteractiveResponseMessage + * @instance + */ + InteractiveResponseMessage.prototype.nativeFlowResponseMessage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InteractiveResponseMessage interactiveResponseMessage. + * @member {"nativeFlowResponseMessage"|undefined} interactiveResponseMessage + * @memberof proto.Message.InteractiveResponseMessage + * @instance + */ + Object.defineProperty(InteractiveResponseMessage.prototype, "interactiveResponseMessage", { + get: $util.oneOfGetter($oneOfFields = ["nativeFlowResponseMessage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InteractiveResponseMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {proto.Message.IInteractiveResponseMessage=} [properties] Properties to set + * @returns {proto.Message.InteractiveResponseMessage} InteractiveResponseMessage instance + */ + InteractiveResponseMessage.create = function create(properties) { + return new InteractiveResponseMessage(properties); + }; + + /** + * Encodes the specified InteractiveResponseMessage message. Does not implicitly {@link proto.Message.InteractiveResponseMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {proto.Message.IInteractiveResponseMessage} message InteractiveResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InteractiveResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.proto.Message.InteractiveResponseMessage.Body.encode(message.body, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nativeFlowResponseMessage != null && Object.hasOwnProperty.call(message, "nativeFlowResponseMessage")) + $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.encode(message.nativeFlowResponseMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InteractiveResponseMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {proto.Message.IInteractiveResponseMessage} message InteractiveResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InteractiveResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InteractiveResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveResponseMessage} InteractiveResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InteractiveResponseMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body = $root.proto.Message.InteractiveResponseMessage.Body.decode(reader, reader.uint32()); + break; + case 15: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 2: + message.nativeFlowResponseMessage = $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InteractiveResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveResponseMessage} InteractiveResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InteractiveResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InteractiveResponseMessage message. + * @function verify + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InteractiveResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.proto.Message.InteractiveResponseMessage.Body.verify(message.body); + if (error) + return "body." + error; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.nativeFlowResponseMessage != null && message.hasOwnProperty("nativeFlowResponseMessage")) { + properties.interactiveResponseMessage = 1; + { + var error = $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.verify(message.nativeFlowResponseMessage); + if (error) + return "nativeFlowResponseMessage." + error; + } + } + return null; + }; + + /** + * Creates an InteractiveResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveResponseMessage} InteractiveResponseMessage + */ + InteractiveResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveResponseMessage) + return object; + var message = new $root.proto.Message.InteractiveResponseMessage(); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".proto.Message.InteractiveResponseMessage.body: object expected"); + message.body = $root.proto.Message.InteractiveResponseMessage.Body.fromObject(object.body); + } + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.InteractiveResponseMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.nativeFlowResponseMessage != null) { + if (typeof object.nativeFlowResponseMessage !== "object") + throw TypeError(".proto.Message.InteractiveResponseMessage.nativeFlowResponseMessage: object expected"); + message.nativeFlowResponseMessage = $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.fromObject(object.nativeFlowResponseMessage); + } + return message; + }; + + /** + * Creates a plain object from an InteractiveResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveResponseMessage + * @static + * @param {proto.Message.InteractiveResponseMessage} message InteractiveResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InteractiveResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.body = null; + object.contextInfo = null; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.proto.Message.InteractiveResponseMessage.Body.toObject(message.body, options); + if (message.nativeFlowResponseMessage != null && message.hasOwnProperty("nativeFlowResponseMessage")) { + object.nativeFlowResponseMessage = $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.toObject(message.nativeFlowResponseMessage, options); + if (options.oneofs) + object.interactiveResponseMessage = "nativeFlowResponseMessage"; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this InteractiveResponseMessage to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveResponseMessage + * @instance + * @returns {Object.} JSON object + */ + InteractiveResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + InteractiveResponseMessage.Body = (function() { + + /** + * Properties of a Body. + * @memberof proto.Message.InteractiveResponseMessage + * @interface IBody + * @property {string|null} [text] Body text + */ + + /** + * Constructs a new Body. + * @memberof proto.Message.InteractiveResponseMessage + * @classdesc Represents a Body. + * @implements IBody + * @constructor + * @param {proto.Message.InteractiveResponseMessage.IBody=} [properties] Properties to set + */ + function Body(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Body text. + * @member {string} text + * @memberof proto.Message.InteractiveResponseMessage.Body + * @instance + */ + Body.prototype.text = ""; + + /** + * Creates a new Body instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {proto.Message.InteractiveResponseMessage.IBody=} [properties] Properties to set + * @returns {proto.Message.InteractiveResponseMessage.Body} Body instance + */ + Body.create = function create(properties) { + return new Body(properties); + }; + + /** + * Encodes the specified Body message. Does not implicitly {@link proto.Message.InteractiveResponseMessage.Body.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {proto.Message.InteractiveResponseMessage.IBody} message Body message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Body.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + return writer; + }; + + /** + * Encodes the specified Body message, length delimited. Does not implicitly {@link proto.Message.InteractiveResponseMessage.Body.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {proto.Message.InteractiveResponseMessage.IBody} message Body message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Body.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Body message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveResponseMessage.Body} Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Body.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveResponseMessage.Body(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Body message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveResponseMessage.Body} Body + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Body.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Body message. + * @function verify + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Body.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a Body message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveResponseMessage.Body} Body + */ + Body.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveResponseMessage.Body) + return object; + var message = new $root.proto.Message.InteractiveResponseMessage.Body(); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a Body message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveResponseMessage.Body + * @static + * @param {proto.Message.InteractiveResponseMessage.Body} message Body + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Body.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this Body to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveResponseMessage.Body + * @instance + * @returns {Object.} JSON object + */ + Body.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Body; + })(); + + InteractiveResponseMessage.NativeFlowResponseMessage = (function() { + + /** + * Properties of a NativeFlowResponseMessage. + * @memberof proto.Message.InteractiveResponseMessage + * @interface INativeFlowResponseMessage + * @property {string|null} [name] NativeFlowResponseMessage name + * @property {string|null} [paramsJson] NativeFlowResponseMessage paramsJson + * @property {number|null} [version] NativeFlowResponseMessage version + */ + + /** + * Constructs a new NativeFlowResponseMessage. + * @memberof proto.Message.InteractiveResponseMessage + * @classdesc Represents a NativeFlowResponseMessage. + * @implements INativeFlowResponseMessage + * @constructor + * @param {proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage=} [properties] Properties to set + */ + function NativeFlowResponseMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NativeFlowResponseMessage name. + * @member {string} name + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @instance + */ + NativeFlowResponseMessage.prototype.name = ""; + + /** + * NativeFlowResponseMessage paramsJson. + * @member {string} paramsJson + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @instance + */ + NativeFlowResponseMessage.prototype.paramsJson = ""; + + /** + * NativeFlowResponseMessage version. + * @member {number} version + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @instance + */ + NativeFlowResponseMessage.prototype.version = 0; + + /** + * Creates a new NativeFlowResponseMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage=} [properties] Properties to set + * @returns {proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage} NativeFlowResponseMessage instance + */ + NativeFlowResponseMessage.create = function create(properties) { + return new NativeFlowResponseMessage(properties); + }; + + /** + * Encodes the specified NativeFlowResponseMessage message. Does not implicitly {@link proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage} message NativeFlowResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.paramsJson != null && Object.hasOwnProperty.call(message, "paramsJson")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.paramsJson); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.version); + return writer; + }; + + /** + * Encodes the specified NativeFlowResponseMessage message, length delimited. Does not implicitly {@link proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {proto.Message.InteractiveResponseMessage.INativeFlowResponseMessage} message NativeFlowResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NativeFlowResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NativeFlowResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage} NativeFlowResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowResponseMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.paramsJson = reader.string(); + break; + case 3: + message.version = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NativeFlowResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage} NativeFlowResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NativeFlowResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NativeFlowResponseMessage message. + * @function verify + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NativeFlowResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.paramsJson != null && message.hasOwnProperty("paramsJson")) + if (!$util.isString(message.paramsJson)) + return "paramsJson: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; + return null; + }; + + /** + * Creates a NativeFlowResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage} NativeFlowResponseMessage + */ + NativeFlowResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage) + return object; + var message = new $root.proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage(); + if (object.name != null) + message.name = String(object.name); + if (object.paramsJson != null) + message.paramsJson = String(object.paramsJson); + if (object.version != null) + message.version = object.version | 0; + return message; + }; + + /** + * Creates a plain object from a NativeFlowResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @static + * @param {proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage} message NativeFlowResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NativeFlowResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.paramsJson = ""; + object.version = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.paramsJson != null && message.hasOwnProperty("paramsJson")) + object.paramsJson = message.paramsJson; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this NativeFlowResponseMessage to JSON. + * @function toJSON + * @memberof proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage + * @instance + * @returns {Object.} JSON object + */ + NativeFlowResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NativeFlowResponseMessage; + })(); + + return InteractiveResponseMessage; + })(); + + Message.InvoiceMessage = (function() { + + /** + * Properties of an InvoiceMessage. + * @memberof proto.Message + * @interface IInvoiceMessage + * @property {string|null} [note] InvoiceMessage note + * @property {string|null} [token] InvoiceMessage token + * @property {proto.Message.InvoiceMessage.AttachmentType|null} [attachmentType] InvoiceMessage attachmentType + * @property {string|null} [attachmentMimetype] InvoiceMessage attachmentMimetype + * @property {Uint8Array|null} [attachmentMediaKey] InvoiceMessage attachmentMediaKey + * @property {number|Long|null} [attachmentMediaKeyTimestamp] InvoiceMessage attachmentMediaKeyTimestamp + * @property {Uint8Array|null} [attachmentFileSha256] InvoiceMessage attachmentFileSha256 + * @property {Uint8Array|null} [attachmentFileEncSha256] InvoiceMessage attachmentFileEncSha256 + * @property {string|null} [attachmentDirectPath] InvoiceMessage attachmentDirectPath + * @property {Uint8Array|null} [attachmentJpegThumbnail] InvoiceMessage attachmentJpegThumbnail + */ + + /** + * Constructs a new InvoiceMessage. + * @memberof proto.Message + * @classdesc Represents an InvoiceMessage. + * @implements IInvoiceMessage + * @constructor + * @param {proto.Message.IInvoiceMessage=} [properties] Properties to set + */ + function InvoiceMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InvoiceMessage note. + * @member {string} note + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.note = ""; + + /** + * InvoiceMessage token. + * @member {string} token + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.token = ""; + + /** + * InvoiceMessage attachmentType. + * @member {proto.Message.InvoiceMessage.AttachmentType} attachmentType + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentType = 0; + + /** + * InvoiceMessage attachmentMimetype. + * @member {string} attachmentMimetype + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentMimetype = ""; + + /** + * InvoiceMessage attachmentMediaKey. + * @member {Uint8Array} attachmentMediaKey + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentMediaKey = $util.newBuffer([]); + + /** + * InvoiceMessage attachmentMediaKeyTimestamp. + * @member {number|Long} attachmentMediaKeyTimestamp + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentMediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * InvoiceMessage attachmentFileSha256. + * @member {Uint8Array} attachmentFileSha256 + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentFileSha256 = $util.newBuffer([]); + + /** + * InvoiceMessage attachmentFileEncSha256. + * @member {Uint8Array} attachmentFileEncSha256 + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentFileEncSha256 = $util.newBuffer([]); + + /** + * InvoiceMessage attachmentDirectPath. + * @member {string} attachmentDirectPath + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentDirectPath = ""; + + /** + * InvoiceMessage attachmentJpegThumbnail. + * @member {Uint8Array} attachmentJpegThumbnail + * @memberof proto.Message.InvoiceMessage + * @instance + */ + InvoiceMessage.prototype.attachmentJpegThumbnail = $util.newBuffer([]); + + /** + * Creates a new InvoiceMessage instance using the specified properties. + * @function create + * @memberof proto.Message.InvoiceMessage + * @static + * @param {proto.Message.IInvoiceMessage=} [properties] Properties to set + * @returns {proto.Message.InvoiceMessage} InvoiceMessage instance + */ + InvoiceMessage.create = function create(properties) { + return new InvoiceMessage(properties); + }; + + /** + * Encodes the specified InvoiceMessage message. Does not implicitly {@link proto.Message.InvoiceMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.InvoiceMessage + * @static + * @param {proto.Message.IInvoiceMessage} message InvoiceMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InvoiceMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.note != null && Object.hasOwnProperty.call(message, "note")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.note); + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.token); + if (message.attachmentType != null && Object.hasOwnProperty.call(message, "attachmentType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.attachmentType); + if (message.attachmentMimetype != null && Object.hasOwnProperty.call(message, "attachmentMimetype")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.attachmentMimetype); + if (message.attachmentMediaKey != null && Object.hasOwnProperty.call(message, "attachmentMediaKey")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.attachmentMediaKey); + if (message.attachmentMediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "attachmentMediaKeyTimestamp")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.attachmentMediaKeyTimestamp); + if (message.attachmentFileSha256 != null && Object.hasOwnProperty.call(message, "attachmentFileSha256")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.attachmentFileSha256); + if (message.attachmentFileEncSha256 != null && Object.hasOwnProperty.call(message, "attachmentFileEncSha256")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.attachmentFileEncSha256); + if (message.attachmentDirectPath != null && Object.hasOwnProperty.call(message, "attachmentDirectPath")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.attachmentDirectPath); + if (message.attachmentJpegThumbnail != null && Object.hasOwnProperty.call(message, "attachmentJpegThumbnail")) + writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.attachmentJpegThumbnail); + return writer; + }; + + /** + * Encodes the specified InvoiceMessage message, length delimited. Does not implicitly {@link proto.Message.InvoiceMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.InvoiceMessage + * @static + * @param {proto.Message.IInvoiceMessage} message InvoiceMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InvoiceMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InvoiceMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.InvoiceMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.InvoiceMessage} InvoiceMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InvoiceMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InvoiceMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.note = reader.string(); + break; + case 2: + message.token = reader.string(); + break; + case 3: + message.attachmentType = reader.int32(); + break; + case 4: + message.attachmentMimetype = reader.string(); + break; + case 5: + message.attachmentMediaKey = reader.bytes(); + break; + case 6: + message.attachmentMediaKeyTimestamp = reader.int64(); + break; + case 7: + message.attachmentFileSha256 = reader.bytes(); + break; + case 8: + message.attachmentFileEncSha256 = reader.bytes(); + break; + case 9: + message.attachmentDirectPath = reader.string(); + break; + case 10: + message.attachmentJpegThumbnail = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InvoiceMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.InvoiceMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.InvoiceMessage} InvoiceMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InvoiceMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InvoiceMessage message. + * @function verify + * @memberof proto.Message.InvoiceMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InvoiceMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.note != null && message.hasOwnProperty("note")) + if (!$util.isString(message.note)) + return "note: string expected"; + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + if (message.attachmentType != null && message.hasOwnProperty("attachmentType")) + switch (message.attachmentType) { + default: + return "attachmentType: enum value expected"; + case 0: + case 1: + break; + } + if (message.attachmentMimetype != null && message.hasOwnProperty("attachmentMimetype")) + if (!$util.isString(message.attachmentMimetype)) + return "attachmentMimetype: string expected"; + if (message.attachmentMediaKey != null && message.hasOwnProperty("attachmentMediaKey")) + if (!(message.attachmentMediaKey && typeof message.attachmentMediaKey.length === "number" || $util.isString(message.attachmentMediaKey))) + return "attachmentMediaKey: buffer expected"; + if (message.attachmentMediaKeyTimestamp != null && message.hasOwnProperty("attachmentMediaKeyTimestamp")) + if (!$util.isInteger(message.attachmentMediaKeyTimestamp) && !(message.attachmentMediaKeyTimestamp && $util.isInteger(message.attachmentMediaKeyTimestamp.low) && $util.isInteger(message.attachmentMediaKeyTimestamp.high))) + return "attachmentMediaKeyTimestamp: integer|Long expected"; + if (message.attachmentFileSha256 != null && message.hasOwnProperty("attachmentFileSha256")) + if (!(message.attachmentFileSha256 && typeof message.attachmentFileSha256.length === "number" || $util.isString(message.attachmentFileSha256))) + return "attachmentFileSha256: buffer expected"; + if (message.attachmentFileEncSha256 != null && message.hasOwnProperty("attachmentFileEncSha256")) + if (!(message.attachmentFileEncSha256 && typeof message.attachmentFileEncSha256.length === "number" || $util.isString(message.attachmentFileEncSha256))) + return "attachmentFileEncSha256: buffer expected"; + if (message.attachmentDirectPath != null && message.hasOwnProperty("attachmentDirectPath")) + if (!$util.isString(message.attachmentDirectPath)) + return "attachmentDirectPath: string expected"; + if (message.attachmentJpegThumbnail != null && message.hasOwnProperty("attachmentJpegThumbnail")) + if (!(message.attachmentJpegThumbnail && typeof message.attachmentJpegThumbnail.length === "number" || $util.isString(message.attachmentJpegThumbnail))) + return "attachmentJpegThumbnail: buffer expected"; + return null; + }; + + /** + * Creates an InvoiceMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.InvoiceMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.InvoiceMessage} InvoiceMessage + */ + InvoiceMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.InvoiceMessage) + return object; + var message = new $root.proto.Message.InvoiceMessage(); + if (object.note != null) + message.note = String(object.note); + if (object.token != null) + message.token = String(object.token); + switch (object.attachmentType) { + case "IMAGE": + case 0: + message.attachmentType = 0; + break; + case "PDF": + case 1: + message.attachmentType = 1; + break; + } + if (object.attachmentMimetype != null) + message.attachmentMimetype = String(object.attachmentMimetype); + if (object.attachmentMediaKey != null) + if (typeof object.attachmentMediaKey === "string") + $util.base64.decode(object.attachmentMediaKey, message.attachmentMediaKey = $util.newBuffer($util.base64.length(object.attachmentMediaKey)), 0); + else if (object.attachmentMediaKey.length) + message.attachmentMediaKey = object.attachmentMediaKey; + if (object.attachmentMediaKeyTimestamp != null) + if ($util.Long) + (message.attachmentMediaKeyTimestamp = $util.Long.fromValue(object.attachmentMediaKeyTimestamp)).unsigned = false; + else if (typeof object.attachmentMediaKeyTimestamp === "string") + message.attachmentMediaKeyTimestamp = parseInt(object.attachmentMediaKeyTimestamp, 10); + else if (typeof object.attachmentMediaKeyTimestamp === "number") + message.attachmentMediaKeyTimestamp = object.attachmentMediaKeyTimestamp; + else if (typeof object.attachmentMediaKeyTimestamp === "object") + message.attachmentMediaKeyTimestamp = new $util.LongBits(object.attachmentMediaKeyTimestamp.low >>> 0, object.attachmentMediaKeyTimestamp.high >>> 0).toNumber(); + if (object.attachmentFileSha256 != null) + if (typeof object.attachmentFileSha256 === "string") + $util.base64.decode(object.attachmentFileSha256, message.attachmentFileSha256 = $util.newBuffer($util.base64.length(object.attachmentFileSha256)), 0); + else if (object.attachmentFileSha256.length) + message.attachmentFileSha256 = object.attachmentFileSha256; + if (object.attachmentFileEncSha256 != null) + if (typeof object.attachmentFileEncSha256 === "string") + $util.base64.decode(object.attachmentFileEncSha256, message.attachmentFileEncSha256 = $util.newBuffer($util.base64.length(object.attachmentFileEncSha256)), 0); + else if (object.attachmentFileEncSha256.length) + message.attachmentFileEncSha256 = object.attachmentFileEncSha256; + if (object.attachmentDirectPath != null) + message.attachmentDirectPath = String(object.attachmentDirectPath); + if (object.attachmentJpegThumbnail != null) + if (typeof object.attachmentJpegThumbnail === "string") + $util.base64.decode(object.attachmentJpegThumbnail, message.attachmentJpegThumbnail = $util.newBuffer($util.base64.length(object.attachmentJpegThumbnail)), 0); + else if (object.attachmentJpegThumbnail.length) + message.attachmentJpegThumbnail = object.attachmentJpegThumbnail; + return message; + }; + + /** + * Creates a plain object from an InvoiceMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.InvoiceMessage + * @static + * @param {proto.Message.InvoiceMessage} message InvoiceMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InvoiceMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.note = ""; + object.token = ""; + object.attachmentType = options.enums === String ? "IMAGE" : 0; + object.attachmentMimetype = ""; + if (options.bytes === String) + object.attachmentMediaKey = ""; + else { + object.attachmentMediaKey = []; + if (options.bytes !== Array) + object.attachmentMediaKey = $util.newBuffer(object.attachmentMediaKey); + } + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.attachmentMediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.attachmentMediaKeyTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.attachmentFileSha256 = ""; + else { + object.attachmentFileSha256 = []; + if (options.bytes !== Array) + object.attachmentFileSha256 = $util.newBuffer(object.attachmentFileSha256); + } + if (options.bytes === String) + object.attachmentFileEncSha256 = ""; + else { + object.attachmentFileEncSha256 = []; + if (options.bytes !== Array) + object.attachmentFileEncSha256 = $util.newBuffer(object.attachmentFileEncSha256); + } + object.attachmentDirectPath = ""; + if (options.bytes === String) + object.attachmentJpegThumbnail = ""; + else { + object.attachmentJpegThumbnail = []; + if (options.bytes !== Array) + object.attachmentJpegThumbnail = $util.newBuffer(object.attachmentJpegThumbnail); + } + } + if (message.note != null && message.hasOwnProperty("note")) + object.note = message.note; + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + if (message.attachmentType != null && message.hasOwnProperty("attachmentType")) + object.attachmentType = options.enums === String ? $root.proto.Message.InvoiceMessage.AttachmentType[message.attachmentType] : message.attachmentType; + if (message.attachmentMimetype != null && message.hasOwnProperty("attachmentMimetype")) + object.attachmentMimetype = message.attachmentMimetype; + if (message.attachmentMediaKey != null && message.hasOwnProperty("attachmentMediaKey")) + object.attachmentMediaKey = options.bytes === String ? $util.base64.encode(message.attachmentMediaKey, 0, message.attachmentMediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.attachmentMediaKey) : message.attachmentMediaKey; + if (message.attachmentMediaKeyTimestamp != null && message.hasOwnProperty("attachmentMediaKeyTimestamp")) + if (typeof message.attachmentMediaKeyTimestamp === "number") + object.attachmentMediaKeyTimestamp = options.longs === String ? String(message.attachmentMediaKeyTimestamp) : message.attachmentMediaKeyTimestamp; + else + object.attachmentMediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.attachmentMediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.attachmentMediaKeyTimestamp.low >>> 0, message.attachmentMediaKeyTimestamp.high >>> 0).toNumber() : message.attachmentMediaKeyTimestamp; + if (message.attachmentFileSha256 != null && message.hasOwnProperty("attachmentFileSha256")) + object.attachmentFileSha256 = options.bytes === String ? $util.base64.encode(message.attachmentFileSha256, 0, message.attachmentFileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.attachmentFileSha256) : message.attachmentFileSha256; + if (message.attachmentFileEncSha256 != null && message.hasOwnProperty("attachmentFileEncSha256")) + object.attachmentFileEncSha256 = options.bytes === String ? $util.base64.encode(message.attachmentFileEncSha256, 0, message.attachmentFileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.attachmentFileEncSha256) : message.attachmentFileEncSha256; + if (message.attachmentDirectPath != null && message.hasOwnProperty("attachmentDirectPath")) + object.attachmentDirectPath = message.attachmentDirectPath; + if (message.attachmentJpegThumbnail != null && message.hasOwnProperty("attachmentJpegThumbnail")) + object.attachmentJpegThumbnail = options.bytes === String ? $util.base64.encode(message.attachmentJpegThumbnail, 0, message.attachmentJpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.attachmentJpegThumbnail) : message.attachmentJpegThumbnail; + return object; + }; + + /** + * Converts this InvoiceMessage to JSON. + * @function toJSON + * @memberof proto.Message.InvoiceMessage + * @instance + * @returns {Object.} JSON object + */ + InvoiceMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * AttachmentType enum. + * @name proto.Message.InvoiceMessage.AttachmentType + * @enum {number} + * @property {number} IMAGE=0 IMAGE value + * @property {number} PDF=1 PDF value + */ + InvoiceMessage.AttachmentType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IMAGE"] = 0; + values[valuesById[1] = "PDF"] = 1; + return values; + })(); + + return InvoiceMessage; + })(); + + Message.KeepInChatMessage = (function() { + + /** + * Properties of a KeepInChatMessage. + * @memberof proto.Message + * @interface IKeepInChatMessage + * @property {proto.IMessageKey|null} [key] KeepInChatMessage key + * @property {proto.KeepType|null} [keepType] KeepInChatMessage keepType + * @property {number|Long|null} [timestampMs] KeepInChatMessage timestampMs + */ + + /** + * Constructs a new KeepInChatMessage. + * @memberof proto.Message + * @classdesc Represents a KeepInChatMessage. + * @implements IKeepInChatMessage + * @constructor + * @param {proto.Message.IKeepInChatMessage=} [properties] Properties to set + */ + function KeepInChatMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeepInChatMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.KeepInChatMessage + * @instance + */ + KeepInChatMessage.prototype.key = null; + + /** + * KeepInChatMessage keepType. + * @member {proto.KeepType} keepType + * @memberof proto.Message.KeepInChatMessage + * @instance + */ + KeepInChatMessage.prototype.keepType = 0; + + /** + * KeepInChatMessage timestampMs. + * @member {number|Long} timestampMs + * @memberof proto.Message.KeepInChatMessage + * @instance + */ + KeepInChatMessage.prototype.timestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new KeepInChatMessage instance using the specified properties. + * @function create + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {proto.Message.IKeepInChatMessage=} [properties] Properties to set + * @returns {proto.Message.KeepInChatMessage} KeepInChatMessage instance + */ + KeepInChatMessage.create = function create(properties) { + return new KeepInChatMessage(properties); + }; + + /** + * Encodes the specified KeepInChatMessage message. Does not implicitly {@link proto.Message.KeepInChatMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {proto.Message.IKeepInChatMessage} message KeepInChatMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeepInChatMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.keepType != null && Object.hasOwnProperty.call(message, "keepType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.keepType); + if (message.timestampMs != null && Object.hasOwnProperty.call(message, "timestampMs")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.timestampMs); + return writer; + }; + + /** + * Encodes the specified KeepInChatMessage message, length delimited. Does not implicitly {@link proto.Message.KeepInChatMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {proto.Message.IKeepInChatMessage} message KeepInChatMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeepInChatMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeepInChatMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.KeepInChatMessage} KeepInChatMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeepInChatMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.KeepInChatMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.keepType = reader.int32(); + break; + case 3: + message.timestampMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeepInChatMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.KeepInChatMessage} KeepInChatMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeepInChatMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeepInChatMessage message. + * @function verify + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeepInChatMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.keepType != null && message.hasOwnProperty("keepType")) + switch (message.keepType) { + default: + return "keepType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.timestampMs != null && message.hasOwnProperty("timestampMs")) + if (!$util.isInteger(message.timestampMs) && !(message.timestampMs && $util.isInteger(message.timestampMs.low) && $util.isInteger(message.timestampMs.high))) + return "timestampMs: integer|Long expected"; + return null; + }; + + /** + * Creates a KeepInChatMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.KeepInChatMessage} KeepInChatMessage + */ + KeepInChatMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.KeepInChatMessage) + return object; + var message = new $root.proto.Message.KeepInChatMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.KeepInChatMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + switch (object.keepType) { + case "UNKNOWN": + case 0: + message.keepType = 0; + break; + case "KEEP_FOR_ALL": + case 1: + message.keepType = 1; + break; + case "UNDO_KEEP_FOR_ALL": + case 2: + message.keepType = 2; + break; + } + if (object.timestampMs != null) + if ($util.Long) + (message.timestampMs = $util.Long.fromValue(object.timestampMs)).unsigned = false; + else if (typeof object.timestampMs === "string") + message.timestampMs = parseInt(object.timestampMs, 10); + else if (typeof object.timestampMs === "number") + message.timestampMs = object.timestampMs; + else if (typeof object.timestampMs === "object") + message.timestampMs = new $util.LongBits(object.timestampMs.low >>> 0, object.timestampMs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a KeepInChatMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.KeepInChatMessage + * @static + * @param {proto.Message.KeepInChatMessage} message KeepInChatMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeepInChatMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.keepType = options.enums === String ? "UNKNOWN" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestampMs = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.keepType != null && message.hasOwnProperty("keepType")) + object.keepType = options.enums === String ? $root.proto.KeepType[message.keepType] : message.keepType; + if (message.timestampMs != null && message.hasOwnProperty("timestampMs")) + if (typeof message.timestampMs === "number") + object.timestampMs = options.longs === String ? String(message.timestampMs) : message.timestampMs; + else + object.timestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.timestampMs) : options.longs === Number ? new $util.LongBits(message.timestampMs.low >>> 0, message.timestampMs.high >>> 0).toNumber() : message.timestampMs; + return object; + }; + + /** + * Converts this KeepInChatMessage to JSON. + * @function toJSON + * @memberof proto.Message.KeepInChatMessage + * @instance + * @returns {Object.} JSON object + */ + KeepInChatMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeepInChatMessage; + })(); + + Message.ListMessage = (function() { + + /** + * Properties of a ListMessage. + * @memberof proto.Message + * @interface IListMessage + * @property {string|null} [title] ListMessage title + * @property {string|null} [description] ListMessage description + * @property {string|null} [buttonText] ListMessage buttonText + * @property {proto.Message.ListMessage.ListType|null} [listType] ListMessage listType + * @property {Array.|null} [sections] ListMessage sections + * @property {proto.Message.ListMessage.IProductListInfo|null} [productListInfo] ListMessage productListInfo + * @property {string|null} [footerText] ListMessage footerText + * @property {proto.IContextInfo|null} [contextInfo] ListMessage contextInfo + */ + + /** + * Constructs a new ListMessage. + * @memberof proto.Message + * @classdesc Represents a ListMessage. + * @implements IListMessage + * @constructor + * @param {proto.Message.IListMessage=} [properties] Properties to set + */ + function ListMessage(properties) { + this.sections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMessage title. + * @member {string} title + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.title = ""; + + /** + * ListMessage description. + * @member {string} description + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.description = ""; + + /** + * ListMessage buttonText. + * @member {string} buttonText + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.buttonText = ""; + + /** + * ListMessage listType. + * @member {proto.Message.ListMessage.ListType} listType + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.listType = 0; + + /** + * ListMessage sections. + * @member {Array.} sections + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.sections = $util.emptyArray; + + /** + * ListMessage productListInfo. + * @member {proto.Message.ListMessage.IProductListInfo|null|undefined} productListInfo + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.productListInfo = null; + + /** + * ListMessage footerText. + * @member {string} footerText + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.footerText = ""; + + /** + * ListMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ListMessage + * @instance + */ + ListMessage.prototype.contextInfo = null; + + /** + * Creates a new ListMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage + * @static + * @param {proto.Message.IListMessage=} [properties] Properties to set + * @returns {proto.Message.ListMessage} ListMessage instance + */ + ListMessage.create = function create(properties) { + return new ListMessage(properties); + }; + + /** + * Encodes the specified ListMessage message. Does not implicitly {@link proto.Message.ListMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage + * @static + * @param {proto.Message.IListMessage} message ListMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.buttonText != null && Object.hasOwnProperty.call(message, "buttonText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.buttonText); + if (message.listType != null && Object.hasOwnProperty.call(message, "listType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.listType); + if (message.sections != null && message.sections.length) + for (var i = 0; i < message.sections.length; ++i) + $root.proto.Message.ListMessage.Section.encode(message.sections[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.productListInfo != null && Object.hasOwnProperty.call(message, "productListInfo")) + $root.proto.Message.ListMessage.ProductListInfo.encode(message.productListInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.footerText != null && Object.hasOwnProperty.call(message, "footerText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.footerText); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListMessage message, length delimited. Does not implicitly {@link proto.Message.ListMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage + * @static + * @param {proto.Message.IListMessage} message ListMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage} ListMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.buttonText = reader.string(); + break; + case 4: + message.listType = reader.int32(); + break; + case 5: + if (!(message.sections && message.sections.length)) + message.sections = []; + message.sections.push($root.proto.Message.ListMessage.Section.decode(reader, reader.uint32())); + break; + case 6: + message.productListInfo = $root.proto.Message.ListMessage.ProductListInfo.decode(reader, reader.uint32()); + break; + case 7: + message.footerText = reader.string(); + break; + case 8: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage} ListMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMessage message. + * @function verify + * @memberof proto.Message.ListMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.buttonText != null && message.hasOwnProperty("buttonText")) + if (!$util.isString(message.buttonText)) + return "buttonText: string expected"; + if (message.listType != null && message.hasOwnProperty("listType")) + switch (message.listType) { + default: + return "listType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.sections != null && message.hasOwnProperty("sections")) { + if (!Array.isArray(message.sections)) + return "sections: array expected"; + for (var i = 0; i < message.sections.length; ++i) { + var error = $root.proto.Message.ListMessage.Section.verify(message.sections[i]); + if (error) + return "sections." + error; + } + } + if (message.productListInfo != null && message.hasOwnProperty("productListInfo")) { + var error = $root.proto.Message.ListMessage.ProductListInfo.verify(message.productListInfo); + if (error) + return "productListInfo." + error; + } + if (message.footerText != null && message.hasOwnProperty("footerText")) + if (!$util.isString(message.footerText)) + return "footerText: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a ListMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage} ListMessage + */ + ListMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage) + return object; + var message = new $root.proto.Message.ListMessage(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.buttonText != null) + message.buttonText = String(object.buttonText); + switch (object.listType) { + case "UNKNOWN": + case 0: + message.listType = 0; + break; + case "SINGLE_SELECT": + case 1: + message.listType = 1; + break; + case "PRODUCT_LIST": + case 2: + message.listType = 2; + break; + } + if (object.sections) { + if (!Array.isArray(object.sections)) + throw TypeError(".proto.Message.ListMessage.sections: array expected"); + message.sections = []; + for (var i = 0; i < object.sections.length; ++i) { + if (typeof object.sections[i] !== "object") + throw TypeError(".proto.Message.ListMessage.sections: object expected"); + message.sections[i] = $root.proto.Message.ListMessage.Section.fromObject(object.sections[i]); + } + } + if (object.productListInfo != null) { + if (typeof object.productListInfo !== "object") + throw TypeError(".proto.Message.ListMessage.productListInfo: object expected"); + message.productListInfo = $root.proto.Message.ListMessage.ProductListInfo.fromObject(object.productListInfo); + } + if (object.footerText != null) + message.footerText = String(object.footerText); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ListMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a ListMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage + * @static + * @param {proto.Message.ListMessage} message ListMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sections = []; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.buttonText = ""; + object.listType = options.enums === String ? "UNKNOWN" : 0; + object.productListInfo = null; + object.footerText = ""; + object.contextInfo = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.buttonText != null && message.hasOwnProperty("buttonText")) + object.buttonText = message.buttonText; + if (message.listType != null && message.hasOwnProperty("listType")) + object.listType = options.enums === String ? $root.proto.Message.ListMessage.ListType[message.listType] : message.listType; + if (message.sections && message.sections.length) { + object.sections = []; + for (var j = 0; j < message.sections.length; ++j) + object.sections[j] = $root.proto.Message.ListMessage.Section.toObject(message.sections[j], options); + } + if (message.productListInfo != null && message.hasOwnProperty("productListInfo")) + object.productListInfo = $root.proto.Message.ListMessage.ProductListInfo.toObject(message.productListInfo, options); + if (message.footerText != null && message.hasOwnProperty("footerText")) + object.footerText = message.footerText; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this ListMessage to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage + * @instance + * @returns {Object.} JSON object + */ + ListMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ListType enum. + * @name proto.Message.ListMessage.ListType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} SINGLE_SELECT=1 SINGLE_SELECT value + * @property {number} PRODUCT_LIST=2 PRODUCT_LIST value + */ + ListMessage.ListType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "SINGLE_SELECT"] = 1; + values[valuesById[2] = "PRODUCT_LIST"] = 2; + return values; + })(); + + ListMessage.Product = (function() { + + /** + * Properties of a Product. + * @memberof proto.Message.ListMessage + * @interface IProduct + * @property {string|null} [productId] Product productId + */ + + /** + * Constructs a new Product. + * @memberof proto.Message.ListMessage + * @classdesc Represents a Product. + * @implements IProduct + * @constructor + * @param {proto.Message.ListMessage.IProduct=} [properties] Properties to set + */ + function Product(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Product productId. + * @member {string} productId + * @memberof proto.Message.ListMessage.Product + * @instance + */ + Product.prototype.productId = ""; + + /** + * Creates a new Product instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage.Product + * @static + * @param {proto.Message.ListMessage.IProduct=} [properties] Properties to set + * @returns {proto.Message.ListMessage.Product} Product instance + */ + Product.create = function create(properties) { + return new Product(properties); + }; + + /** + * Encodes the specified Product message. Does not implicitly {@link proto.Message.ListMessage.Product.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage.Product + * @static + * @param {proto.Message.ListMessage.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.productId); + return writer; + }; + + /** + * Encodes the specified Product message, length delimited. Does not implicitly {@link proto.Message.ListMessage.Product.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage.Product + * @static + * @param {proto.Message.ListMessage.IProduct} message Product message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Product.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Product message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage.Product(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Product message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage.Product + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage.Product} Product + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Product.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Product message. + * @function verify + * @memberof proto.Message.ListMessage.Product + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Product.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + return null; + }; + + /** + * Creates a Product message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage.Product + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage.Product} Product + */ + Product.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage.Product) + return object; + var message = new $root.proto.Message.ListMessage.Product(); + if (object.productId != null) + message.productId = String(object.productId); + return message; + }; + + /** + * Creates a plain object from a Product message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage.Product + * @static + * @param {proto.Message.ListMessage.Product} message Product + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Product.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.productId = ""; + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + return object; + }; + + /** + * Converts this Product to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage.Product + * @instance + * @returns {Object.} JSON object + */ + Product.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Product; + })(); + + ListMessage.ProductListHeaderImage = (function() { + + /** + * Properties of a ProductListHeaderImage. + * @memberof proto.Message.ListMessage + * @interface IProductListHeaderImage + * @property {string|null} [productId] ProductListHeaderImage productId + * @property {Uint8Array|null} [jpegThumbnail] ProductListHeaderImage jpegThumbnail + */ + + /** + * Constructs a new ProductListHeaderImage. + * @memberof proto.Message.ListMessage + * @classdesc Represents a ProductListHeaderImage. + * @implements IProductListHeaderImage + * @constructor + * @param {proto.Message.ListMessage.IProductListHeaderImage=} [properties] Properties to set + */ + function ProductListHeaderImage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductListHeaderImage productId. + * @member {string} productId + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @instance + */ + ProductListHeaderImage.prototype.productId = ""; + + /** + * ProductListHeaderImage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @instance + */ + ProductListHeaderImage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * Creates a new ProductListHeaderImage instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {proto.Message.ListMessage.IProductListHeaderImage=} [properties] Properties to set + * @returns {proto.Message.ListMessage.ProductListHeaderImage} ProductListHeaderImage instance + */ + ProductListHeaderImage.create = function create(properties) { + return new ProductListHeaderImage(properties); + }; + + /** + * Encodes the specified ProductListHeaderImage message. Does not implicitly {@link proto.Message.ListMessage.ProductListHeaderImage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {proto.Message.ListMessage.IProductListHeaderImage} message ProductListHeaderImage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductListHeaderImage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.productId); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.jpegThumbnail); + return writer; + }; + + /** + * Encodes the specified ProductListHeaderImage message, length delimited. Does not implicitly {@link proto.Message.ListMessage.ProductListHeaderImage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {proto.Message.ListMessage.IProductListHeaderImage} message ProductListHeaderImage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductListHeaderImage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductListHeaderImage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage.ProductListHeaderImage} ProductListHeaderImage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductListHeaderImage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage.ProductListHeaderImage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productId = reader.string(); + break; + case 2: + message.jpegThumbnail = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductListHeaderImage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage.ProductListHeaderImage} ProductListHeaderImage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductListHeaderImage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductListHeaderImage message. + * @function verify + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductListHeaderImage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + return null; + }; + + /** + * Creates a ProductListHeaderImage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage.ProductListHeaderImage} ProductListHeaderImage + */ + ProductListHeaderImage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage.ProductListHeaderImage) + return object; + var message = new $root.proto.Message.ListMessage.ProductListHeaderImage(); + if (object.productId != null) + message.productId = String(object.productId); + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + return message; + }; + + /** + * Creates a plain object from a ProductListHeaderImage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @static + * @param {proto.Message.ListMessage.ProductListHeaderImage} message ProductListHeaderImage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductListHeaderImage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.productId = ""; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + } + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + return object; + }; + + /** + * Converts this ProductListHeaderImage to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage.ProductListHeaderImage + * @instance + * @returns {Object.} JSON object + */ + ProductListHeaderImage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductListHeaderImage; + })(); + + ListMessage.ProductListInfo = (function() { + + /** + * Properties of a ProductListInfo. + * @memberof proto.Message.ListMessage + * @interface IProductListInfo + * @property {Array.|null} [productSections] ProductListInfo productSections + * @property {proto.Message.ListMessage.IProductListHeaderImage|null} [headerImage] ProductListInfo headerImage + * @property {string|null} [businessOwnerJid] ProductListInfo businessOwnerJid + */ + + /** + * Constructs a new ProductListInfo. + * @memberof proto.Message.ListMessage + * @classdesc Represents a ProductListInfo. + * @implements IProductListInfo + * @constructor + * @param {proto.Message.ListMessage.IProductListInfo=} [properties] Properties to set + */ + function ProductListInfo(properties) { + this.productSections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductListInfo productSections. + * @member {Array.} productSections + * @memberof proto.Message.ListMessage.ProductListInfo + * @instance + */ + ProductListInfo.prototype.productSections = $util.emptyArray; + + /** + * ProductListInfo headerImage. + * @member {proto.Message.ListMessage.IProductListHeaderImage|null|undefined} headerImage + * @memberof proto.Message.ListMessage.ProductListInfo + * @instance + */ + ProductListInfo.prototype.headerImage = null; + + /** + * ProductListInfo businessOwnerJid. + * @member {string} businessOwnerJid + * @memberof proto.Message.ListMessage.ProductListInfo + * @instance + */ + ProductListInfo.prototype.businessOwnerJid = ""; + + /** + * Creates a new ProductListInfo instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {proto.Message.ListMessage.IProductListInfo=} [properties] Properties to set + * @returns {proto.Message.ListMessage.ProductListInfo} ProductListInfo instance + */ + ProductListInfo.create = function create(properties) { + return new ProductListInfo(properties); + }; + + /** + * Encodes the specified ProductListInfo message. Does not implicitly {@link proto.Message.ListMessage.ProductListInfo.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {proto.Message.ListMessage.IProductListInfo} message ProductListInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductListInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productSections != null && message.productSections.length) + for (var i = 0; i < message.productSections.length; ++i) + $root.proto.Message.ListMessage.ProductSection.encode(message.productSections[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.headerImage != null && Object.hasOwnProperty.call(message, "headerImage")) + $root.proto.Message.ListMessage.ProductListHeaderImage.encode(message.headerImage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.businessOwnerJid != null && Object.hasOwnProperty.call(message, "businessOwnerJid")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.businessOwnerJid); + return writer; + }; + + /** + * Encodes the specified ProductListInfo message, length delimited. Does not implicitly {@link proto.Message.ListMessage.ProductListInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {proto.Message.ListMessage.IProductListInfo} message ProductListInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductListInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductListInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage.ProductListInfo} ProductListInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductListInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage.ProductListInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.productSections && message.productSections.length)) + message.productSections = []; + message.productSections.push($root.proto.Message.ListMessage.ProductSection.decode(reader, reader.uint32())); + break; + case 2: + message.headerImage = $root.proto.Message.ListMessage.ProductListHeaderImage.decode(reader, reader.uint32()); + break; + case 3: + message.businessOwnerJid = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductListInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage.ProductListInfo} ProductListInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductListInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductListInfo message. + * @function verify + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductListInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.productSections != null && message.hasOwnProperty("productSections")) { + if (!Array.isArray(message.productSections)) + return "productSections: array expected"; + for (var i = 0; i < message.productSections.length; ++i) { + var error = $root.proto.Message.ListMessage.ProductSection.verify(message.productSections[i]); + if (error) + return "productSections." + error; + } + } + if (message.headerImage != null && message.hasOwnProperty("headerImage")) { + var error = $root.proto.Message.ListMessage.ProductListHeaderImage.verify(message.headerImage); + if (error) + return "headerImage." + error; + } + if (message.businessOwnerJid != null && message.hasOwnProperty("businessOwnerJid")) + if (!$util.isString(message.businessOwnerJid)) + return "businessOwnerJid: string expected"; + return null; + }; + + /** + * Creates a ProductListInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage.ProductListInfo} ProductListInfo + */ + ProductListInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage.ProductListInfo) + return object; + var message = new $root.proto.Message.ListMessage.ProductListInfo(); + if (object.productSections) { + if (!Array.isArray(object.productSections)) + throw TypeError(".proto.Message.ListMessage.ProductListInfo.productSections: array expected"); + message.productSections = []; + for (var i = 0; i < object.productSections.length; ++i) { + if (typeof object.productSections[i] !== "object") + throw TypeError(".proto.Message.ListMessage.ProductListInfo.productSections: object expected"); + message.productSections[i] = $root.proto.Message.ListMessage.ProductSection.fromObject(object.productSections[i]); + } + } + if (object.headerImage != null) { + if (typeof object.headerImage !== "object") + throw TypeError(".proto.Message.ListMessage.ProductListInfo.headerImage: object expected"); + message.headerImage = $root.proto.Message.ListMessage.ProductListHeaderImage.fromObject(object.headerImage); + } + if (object.businessOwnerJid != null) + message.businessOwnerJid = String(object.businessOwnerJid); + return message; + }; + + /** + * Creates a plain object from a ProductListInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage.ProductListInfo + * @static + * @param {proto.Message.ListMessage.ProductListInfo} message ProductListInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductListInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.productSections = []; + if (options.defaults) { + object.headerImage = null; + object.businessOwnerJid = ""; + } + if (message.productSections && message.productSections.length) { + object.productSections = []; + for (var j = 0; j < message.productSections.length; ++j) + object.productSections[j] = $root.proto.Message.ListMessage.ProductSection.toObject(message.productSections[j], options); + } + if (message.headerImage != null && message.hasOwnProperty("headerImage")) + object.headerImage = $root.proto.Message.ListMessage.ProductListHeaderImage.toObject(message.headerImage, options); + if (message.businessOwnerJid != null && message.hasOwnProperty("businessOwnerJid")) + object.businessOwnerJid = message.businessOwnerJid; + return object; + }; + + /** + * Converts this ProductListInfo to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage.ProductListInfo + * @instance + * @returns {Object.} JSON object + */ + ProductListInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductListInfo; + })(); + + ListMessage.ProductSection = (function() { + + /** + * Properties of a ProductSection. + * @memberof proto.Message.ListMessage + * @interface IProductSection + * @property {string|null} [title] ProductSection title + * @property {Array.|null} [products] ProductSection products + */ + + /** + * Constructs a new ProductSection. + * @memberof proto.Message.ListMessage + * @classdesc Represents a ProductSection. + * @implements IProductSection + * @constructor + * @param {proto.Message.ListMessage.IProductSection=} [properties] Properties to set + */ + function ProductSection(properties) { + this.products = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductSection title. + * @member {string} title + * @memberof proto.Message.ListMessage.ProductSection + * @instance + */ + ProductSection.prototype.title = ""; + + /** + * ProductSection products. + * @member {Array.} products + * @memberof proto.Message.ListMessage.ProductSection + * @instance + */ + ProductSection.prototype.products = $util.emptyArray; + + /** + * Creates a new ProductSection instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {proto.Message.ListMessage.IProductSection=} [properties] Properties to set + * @returns {proto.Message.ListMessage.ProductSection} ProductSection instance + */ + ProductSection.create = function create(properties) { + return new ProductSection(properties); + }; + + /** + * Encodes the specified ProductSection message. Does not implicitly {@link proto.Message.ListMessage.ProductSection.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {proto.Message.ListMessage.IProductSection} message ProductSection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductSection.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.products != null && message.products.length) + for (var i = 0; i < message.products.length; ++i) + $root.proto.Message.ListMessage.Product.encode(message.products[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductSection message, length delimited. Does not implicitly {@link proto.Message.ListMessage.ProductSection.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {proto.Message.ListMessage.IProductSection} message ProductSection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductSection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductSection message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage.ProductSection} ProductSection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductSection.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage.ProductSection(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + if (!(message.products && message.products.length)) + message.products = []; + message.products.push($root.proto.Message.ListMessage.Product.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductSection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage.ProductSection} ProductSection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductSection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductSection message. + * @function verify + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductSection.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.products != null && message.hasOwnProperty("products")) { + if (!Array.isArray(message.products)) + return "products: array expected"; + for (var i = 0; i < message.products.length; ++i) { + var error = $root.proto.Message.ListMessage.Product.verify(message.products[i]); + if (error) + return "products." + error; + } + } + return null; + }; + + /** + * Creates a ProductSection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage.ProductSection} ProductSection + */ + ProductSection.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage.ProductSection) + return object; + var message = new $root.proto.Message.ListMessage.ProductSection(); + if (object.title != null) + message.title = String(object.title); + if (object.products) { + if (!Array.isArray(object.products)) + throw TypeError(".proto.Message.ListMessage.ProductSection.products: array expected"); + message.products = []; + for (var i = 0; i < object.products.length; ++i) { + if (typeof object.products[i] !== "object") + throw TypeError(".proto.Message.ListMessage.ProductSection.products: object expected"); + message.products[i] = $root.proto.Message.ListMessage.Product.fromObject(object.products[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ProductSection message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage.ProductSection + * @static + * @param {proto.Message.ListMessage.ProductSection} message ProductSection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductSection.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.products = []; + if (options.defaults) + object.title = ""; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.products && message.products.length) { + object.products = []; + for (var j = 0; j < message.products.length; ++j) + object.products[j] = $root.proto.Message.ListMessage.Product.toObject(message.products[j], options); + } + return object; + }; + + /** + * Converts this ProductSection to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage.ProductSection + * @instance + * @returns {Object.} JSON object + */ + ProductSection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductSection; + })(); + + ListMessage.Row = (function() { + + /** + * Properties of a Row. + * @memberof proto.Message.ListMessage + * @interface IRow + * @property {string|null} [title] Row title + * @property {string|null} [description] Row description + * @property {string|null} [rowId] Row rowId + */ + + /** + * Constructs a new Row. + * @memberof proto.Message.ListMessage + * @classdesc Represents a Row. + * @implements IRow + * @constructor + * @param {proto.Message.ListMessage.IRow=} [properties] Properties to set + */ + function Row(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Row title. + * @member {string} title + * @memberof proto.Message.ListMessage.Row + * @instance + */ + Row.prototype.title = ""; + + /** + * Row description. + * @member {string} description + * @memberof proto.Message.ListMessage.Row + * @instance + */ + Row.prototype.description = ""; + + /** + * Row rowId. + * @member {string} rowId + * @memberof proto.Message.ListMessage.Row + * @instance + */ + Row.prototype.rowId = ""; + + /** + * Creates a new Row instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage.Row + * @static + * @param {proto.Message.ListMessage.IRow=} [properties] Properties to set + * @returns {proto.Message.ListMessage.Row} Row instance + */ + Row.create = function create(properties) { + return new Row(properties); + }; + + /** + * Encodes the specified Row message. Does not implicitly {@link proto.Message.ListMessage.Row.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage.Row + * @static + * @param {proto.Message.ListMessage.IRow} message Row message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Row.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.rowId != null && Object.hasOwnProperty.call(message, "rowId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rowId); + return writer; + }; + + /** + * Encodes the specified Row message, length delimited. Does not implicitly {@link proto.Message.ListMessage.Row.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage.Row + * @static + * @param {proto.Message.ListMessage.IRow} message Row message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Row.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Row message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage.Row + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage.Row} Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Row.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage.Row(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.rowId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Row message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage.Row + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage.Row} Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Row.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Row message. + * @function verify + * @memberof proto.Message.ListMessage.Row + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Row.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.rowId != null && message.hasOwnProperty("rowId")) + if (!$util.isString(message.rowId)) + return "rowId: string expected"; + return null; + }; + + /** + * Creates a Row message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage.Row + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage.Row} Row + */ + Row.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage.Row) + return object; + var message = new $root.proto.Message.ListMessage.Row(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.rowId != null) + message.rowId = String(object.rowId); + return message; + }; + + /** + * Creates a plain object from a Row message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage.Row + * @static + * @param {proto.Message.ListMessage.Row} message Row + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Row.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.rowId = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.rowId != null && message.hasOwnProperty("rowId")) + object.rowId = message.rowId; + return object; + }; + + /** + * Converts this Row to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage.Row + * @instance + * @returns {Object.} JSON object + */ + Row.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Row; + })(); + + ListMessage.Section = (function() { + + /** + * Properties of a Section. + * @memberof proto.Message.ListMessage + * @interface ISection + * @property {string|null} [title] Section title + * @property {Array.|null} [rows] Section rows + */ + + /** + * Constructs a new Section. + * @memberof proto.Message.ListMessage + * @classdesc Represents a Section. + * @implements ISection + * @constructor + * @param {proto.Message.ListMessage.ISection=} [properties] Properties to set + */ + function Section(properties) { + this.rows = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Section title. + * @member {string} title + * @memberof proto.Message.ListMessage.Section + * @instance + */ + Section.prototype.title = ""; + + /** + * Section rows. + * @member {Array.} rows + * @memberof proto.Message.ListMessage.Section + * @instance + */ + Section.prototype.rows = $util.emptyArray; + + /** + * Creates a new Section instance using the specified properties. + * @function create + * @memberof proto.Message.ListMessage.Section + * @static + * @param {proto.Message.ListMessage.ISection=} [properties] Properties to set + * @returns {proto.Message.ListMessage.Section} Section instance + */ + Section.create = function create(properties) { + return new Section(properties); + }; + + /** + * Encodes the specified Section message. Does not implicitly {@link proto.Message.ListMessage.Section.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListMessage.Section + * @static + * @param {proto.Message.ListMessage.ISection} message Section message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Section.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.rows != null && message.rows.length) + for (var i = 0; i < message.rows.length; ++i) + $root.proto.Message.ListMessage.Row.encode(message.rows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Section message, length delimited. Does not implicitly {@link proto.Message.ListMessage.Section.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListMessage.Section + * @static + * @param {proto.Message.ListMessage.ISection} message Section message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Section.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Section message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListMessage.Section + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListMessage.Section} Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Section.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListMessage.Section(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + if (!(message.rows && message.rows.length)) + message.rows = []; + message.rows.push($root.proto.Message.ListMessage.Row.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Section message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListMessage.Section + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListMessage.Section} Section + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Section.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Section message. + * @function verify + * @memberof proto.Message.ListMessage.Section + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Section.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.rows != null && message.hasOwnProperty("rows")) { + if (!Array.isArray(message.rows)) + return "rows: array expected"; + for (var i = 0; i < message.rows.length; ++i) { + var error = $root.proto.Message.ListMessage.Row.verify(message.rows[i]); + if (error) + return "rows." + error; + } + } + return null; + }; + + /** + * Creates a Section message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListMessage.Section + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListMessage.Section} Section + */ + Section.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListMessage.Section) + return object; + var message = new $root.proto.Message.ListMessage.Section(); + if (object.title != null) + message.title = String(object.title); + if (object.rows) { + if (!Array.isArray(object.rows)) + throw TypeError(".proto.Message.ListMessage.Section.rows: array expected"); + message.rows = []; + for (var i = 0; i < object.rows.length; ++i) { + if (typeof object.rows[i] !== "object") + throw TypeError(".proto.Message.ListMessage.Section.rows: object expected"); + message.rows[i] = $root.proto.Message.ListMessage.Row.fromObject(object.rows[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Section message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListMessage.Section + * @static + * @param {proto.Message.ListMessage.Section} message Section + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Section.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rows = []; + if (options.defaults) + object.title = ""; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.rows && message.rows.length) { + object.rows = []; + for (var j = 0; j < message.rows.length; ++j) + object.rows[j] = $root.proto.Message.ListMessage.Row.toObject(message.rows[j], options); + } + return object; + }; + + /** + * Converts this Section to JSON. + * @function toJSON + * @memberof proto.Message.ListMessage.Section + * @instance + * @returns {Object.} JSON object + */ + Section.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Section; + })(); + + return ListMessage; + })(); + + Message.ListResponseMessage = (function() { + + /** + * Properties of a ListResponseMessage. + * @memberof proto.Message + * @interface IListResponseMessage + * @property {string|null} [title] ListResponseMessage title + * @property {proto.Message.ListResponseMessage.ListType|null} [listType] ListResponseMessage listType + * @property {proto.Message.ListResponseMessage.ISingleSelectReply|null} [singleSelectReply] ListResponseMessage singleSelectReply + * @property {proto.IContextInfo|null} [contextInfo] ListResponseMessage contextInfo + * @property {string|null} [description] ListResponseMessage description + */ + + /** + * Constructs a new ListResponseMessage. + * @memberof proto.Message + * @classdesc Represents a ListResponseMessage. + * @implements IListResponseMessage + * @constructor + * @param {proto.Message.IListResponseMessage=} [properties] Properties to set + */ + function ListResponseMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListResponseMessage title. + * @member {string} title + * @memberof proto.Message.ListResponseMessage + * @instance + */ + ListResponseMessage.prototype.title = ""; + + /** + * ListResponseMessage listType. + * @member {proto.Message.ListResponseMessage.ListType} listType + * @memberof proto.Message.ListResponseMessage + * @instance + */ + ListResponseMessage.prototype.listType = 0; + + /** + * ListResponseMessage singleSelectReply. + * @member {proto.Message.ListResponseMessage.ISingleSelectReply|null|undefined} singleSelectReply + * @memberof proto.Message.ListResponseMessage + * @instance + */ + ListResponseMessage.prototype.singleSelectReply = null; + + /** + * ListResponseMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ListResponseMessage + * @instance + */ + ListResponseMessage.prototype.contextInfo = null; + + /** + * ListResponseMessage description. + * @member {string} description + * @memberof proto.Message.ListResponseMessage + * @instance + */ + ListResponseMessage.prototype.description = ""; + + /** + * Creates a new ListResponseMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ListResponseMessage + * @static + * @param {proto.Message.IListResponseMessage=} [properties] Properties to set + * @returns {proto.Message.ListResponseMessage} ListResponseMessage instance + */ + ListResponseMessage.create = function create(properties) { + return new ListResponseMessage(properties); + }; + + /** + * Encodes the specified ListResponseMessage message. Does not implicitly {@link proto.Message.ListResponseMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListResponseMessage + * @static + * @param {proto.Message.IListResponseMessage} message ListResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.listType != null && Object.hasOwnProperty.call(message, "listType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.listType); + if (message.singleSelectReply != null && Object.hasOwnProperty.call(message, "singleSelectReply")) + $root.proto.Message.ListResponseMessage.SingleSelectReply.encode(message.singleSelectReply, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); + return writer; + }; + + /** + * Encodes the specified ListResponseMessage message, length delimited. Does not implicitly {@link proto.Message.ListResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListResponseMessage + * @static + * @param {proto.Message.IListResponseMessage} message ListResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListResponseMessage} ListResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListResponseMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.listType = reader.int32(); + break; + case 3: + message.singleSelectReply = $root.proto.Message.ListResponseMessage.SingleSelectReply.decode(reader, reader.uint32()); + break; + case 4: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 5: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListResponseMessage} ListResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListResponseMessage message. + * @function verify + * @memberof proto.Message.ListResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.listType != null && message.hasOwnProperty("listType")) + switch (message.listType) { + default: + return "listType: enum value expected"; + case 0: + case 1: + break; + } + if (message.singleSelectReply != null && message.hasOwnProperty("singleSelectReply")) { + var error = $root.proto.Message.ListResponseMessage.SingleSelectReply.verify(message.singleSelectReply); + if (error) + return "singleSelectReply." + error; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates a ListResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListResponseMessage} ListResponseMessage + */ + ListResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListResponseMessage) + return object; + var message = new $root.proto.Message.ListResponseMessage(); + if (object.title != null) + message.title = String(object.title); + switch (object.listType) { + case "UNKNOWN": + case 0: + message.listType = 0; + break; + case "SINGLE_SELECT": + case 1: + message.listType = 1; + break; + } + if (object.singleSelectReply != null) { + if (typeof object.singleSelectReply !== "object") + throw TypeError(".proto.Message.ListResponseMessage.singleSelectReply: object expected"); + message.singleSelectReply = $root.proto.Message.ListResponseMessage.SingleSelectReply.fromObject(object.singleSelectReply); + } + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ListResponseMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from a ListResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListResponseMessage + * @static + * @param {proto.Message.ListResponseMessage} message ListResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.title = ""; + object.listType = options.enums === String ? "UNKNOWN" : 0; + object.singleSelectReply = null; + object.contextInfo = null; + object.description = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.listType != null && message.hasOwnProperty("listType")) + object.listType = options.enums === String ? $root.proto.Message.ListResponseMessage.ListType[message.listType] : message.listType; + if (message.singleSelectReply != null && message.hasOwnProperty("singleSelectReply")) + object.singleSelectReply = $root.proto.Message.ListResponseMessage.SingleSelectReply.toObject(message.singleSelectReply, options); + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this ListResponseMessage to JSON. + * @function toJSON + * @memberof proto.Message.ListResponseMessage + * @instance + * @returns {Object.} JSON object + */ + ListResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ListType enum. + * @name proto.Message.ListResponseMessage.ListType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} SINGLE_SELECT=1 SINGLE_SELECT value + */ + ListResponseMessage.ListType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "SINGLE_SELECT"] = 1; + return values; + })(); + + ListResponseMessage.SingleSelectReply = (function() { + + /** + * Properties of a SingleSelectReply. + * @memberof proto.Message.ListResponseMessage + * @interface ISingleSelectReply + * @property {string|null} [selectedRowId] SingleSelectReply selectedRowId + */ + + /** + * Constructs a new SingleSelectReply. + * @memberof proto.Message.ListResponseMessage + * @classdesc Represents a SingleSelectReply. + * @implements ISingleSelectReply + * @constructor + * @param {proto.Message.ListResponseMessage.ISingleSelectReply=} [properties] Properties to set + */ + function SingleSelectReply(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SingleSelectReply selectedRowId. + * @member {string} selectedRowId + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @instance + */ + SingleSelectReply.prototype.selectedRowId = ""; + + /** + * Creates a new SingleSelectReply instance using the specified properties. + * @function create + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {proto.Message.ListResponseMessage.ISingleSelectReply=} [properties] Properties to set + * @returns {proto.Message.ListResponseMessage.SingleSelectReply} SingleSelectReply instance + */ + SingleSelectReply.create = function create(properties) { + return new SingleSelectReply(properties); + }; + + /** + * Encodes the specified SingleSelectReply message. Does not implicitly {@link proto.Message.ListResponseMessage.SingleSelectReply.verify|verify} messages. + * @function encode + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {proto.Message.ListResponseMessage.ISingleSelectReply} message SingleSelectReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SingleSelectReply.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selectedRowId != null && Object.hasOwnProperty.call(message, "selectedRowId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectedRowId); + return writer; + }; + + /** + * Encodes the specified SingleSelectReply message, length delimited. Does not implicitly {@link proto.Message.ListResponseMessage.SingleSelectReply.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {proto.Message.ListResponseMessage.ISingleSelectReply} message SingleSelectReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SingleSelectReply.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SingleSelectReply message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ListResponseMessage.SingleSelectReply} SingleSelectReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SingleSelectReply.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ListResponseMessage.SingleSelectReply(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selectedRowId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SingleSelectReply message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ListResponseMessage.SingleSelectReply} SingleSelectReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SingleSelectReply.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SingleSelectReply message. + * @function verify + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SingleSelectReply.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selectedRowId != null && message.hasOwnProperty("selectedRowId")) + if (!$util.isString(message.selectedRowId)) + return "selectedRowId: string expected"; + return null; + }; + + /** + * Creates a SingleSelectReply message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ListResponseMessage.SingleSelectReply} SingleSelectReply + */ + SingleSelectReply.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ListResponseMessage.SingleSelectReply) + return object; + var message = new $root.proto.Message.ListResponseMessage.SingleSelectReply(); + if (object.selectedRowId != null) + message.selectedRowId = String(object.selectedRowId); + return message; + }; + + /** + * Creates a plain object from a SingleSelectReply message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @static + * @param {proto.Message.ListResponseMessage.SingleSelectReply} message SingleSelectReply + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SingleSelectReply.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.selectedRowId = ""; + if (message.selectedRowId != null && message.hasOwnProperty("selectedRowId")) + object.selectedRowId = message.selectedRowId; + return object; + }; + + /** + * Converts this SingleSelectReply to JSON. + * @function toJSON + * @memberof proto.Message.ListResponseMessage.SingleSelectReply + * @instance + * @returns {Object.} JSON object + */ + SingleSelectReply.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SingleSelectReply; + })(); + + return ListResponseMessage; + })(); + + Message.LiveLocationMessage = (function() { + + /** + * Properties of a LiveLocationMessage. + * @memberof proto.Message + * @interface ILiveLocationMessage + * @property {number|null} [degreesLatitude] LiveLocationMessage degreesLatitude + * @property {number|null} [degreesLongitude] LiveLocationMessage degreesLongitude + * @property {number|null} [accuracyInMeters] LiveLocationMessage accuracyInMeters + * @property {number|null} [speedInMps] LiveLocationMessage speedInMps + * @property {number|null} [degreesClockwiseFromMagneticNorth] LiveLocationMessage degreesClockwiseFromMagneticNorth + * @property {string|null} [caption] LiveLocationMessage caption + * @property {number|Long|null} [sequenceNumber] LiveLocationMessage sequenceNumber + * @property {number|null} [timeOffset] LiveLocationMessage timeOffset + * @property {Uint8Array|null} [jpegThumbnail] LiveLocationMessage jpegThumbnail + * @property {proto.IContextInfo|null} [contextInfo] LiveLocationMessage contextInfo + */ + + /** + * Constructs a new LiveLocationMessage. + * @memberof proto.Message + * @classdesc Represents a LiveLocationMessage. + * @implements ILiveLocationMessage + * @constructor + * @param {proto.Message.ILiveLocationMessage=} [properties] Properties to set + */ + function LiveLocationMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LiveLocationMessage degreesLatitude. + * @member {number} degreesLatitude + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.degreesLatitude = 0; + + /** + * LiveLocationMessage degreesLongitude. + * @member {number} degreesLongitude + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.degreesLongitude = 0; + + /** + * LiveLocationMessage accuracyInMeters. + * @member {number} accuracyInMeters + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.accuracyInMeters = 0; + + /** + * LiveLocationMessage speedInMps. + * @member {number} speedInMps + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.speedInMps = 0; + + /** + * LiveLocationMessage degreesClockwiseFromMagneticNorth. + * @member {number} degreesClockwiseFromMagneticNorth + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.degreesClockwiseFromMagneticNorth = 0; + + /** + * LiveLocationMessage caption. + * @member {string} caption + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.caption = ""; + + /** + * LiveLocationMessage sequenceNumber. + * @member {number|Long} sequenceNumber + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.sequenceNumber = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * LiveLocationMessage timeOffset. + * @member {number} timeOffset + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.timeOffset = 0; + + /** + * LiveLocationMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * LiveLocationMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.LiveLocationMessage + * @instance + */ + LiveLocationMessage.prototype.contextInfo = null; + + /** + * Creates a new LiveLocationMessage instance using the specified properties. + * @function create + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {proto.Message.ILiveLocationMessage=} [properties] Properties to set + * @returns {proto.Message.LiveLocationMessage} LiveLocationMessage instance + */ + LiveLocationMessage.create = function create(properties) { + return new LiveLocationMessage(properties); + }; + + /** + * Encodes the specified LiveLocationMessage message. Does not implicitly {@link proto.Message.LiveLocationMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {proto.Message.ILiveLocationMessage} message LiveLocationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LiveLocationMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.degreesLatitude != null && Object.hasOwnProperty.call(message, "degreesLatitude")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.degreesLatitude); + if (message.degreesLongitude != null && Object.hasOwnProperty.call(message, "degreesLongitude")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.degreesLongitude); + if (message.accuracyInMeters != null && Object.hasOwnProperty.call(message, "accuracyInMeters")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.accuracyInMeters); + if (message.speedInMps != null && Object.hasOwnProperty.call(message, "speedInMps")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.speedInMps); + if (message.degreesClockwiseFromMagneticNorth != null && Object.hasOwnProperty.call(message, "degreesClockwiseFromMagneticNorth")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.degreesClockwiseFromMagneticNorth); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.caption); + if (message.sequenceNumber != null && Object.hasOwnProperty.call(message, "sequenceNumber")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.sequenceNumber); + if (message.timeOffset != null && Object.hasOwnProperty.call(message, "timeOffset")) + writer.uint32(/* id 8, wireType 0 =*/64).uint32(message.timeOffset); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LiveLocationMessage message, length delimited. Does not implicitly {@link proto.Message.LiveLocationMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {proto.Message.ILiveLocationMessage} message LiveLocationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LiveLocationMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LiveLocationMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.LiveLocationMessage} LiveLocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LiveLocationMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.LiveLocationMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.degreesLatitude = reader.double(); + break; + case 2: + message.degreesLongitude = reader.double(); + break; + case 3: + message.accuracyInMeters = reader.uint32(); + break; + case 4: + message.speedInMps = reader.float(); + break; + case 5: + message.degreesClockwiseFromMagneticNorth = reader.uint32(); + break; + case 6: + message.caption = reader.string(); + break; + case 7: + message.sequenceNumber = reader.int64(); + break; + case 8: + message.timeOffset = reader.uint32(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LiveLocationMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.LiveLocationMessage} LiveLocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LiveLocationMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LiveLocationMessage message. + * @function verify + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LiveLocationMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.degreesLatitude != null && message.hasOwnProperty("degreesLatitude")) + if (typeof message.degreesLatitude !== "number") + return "degreesLatitude: number expected"; + if (message.degreesLongitude != null && message.hasOwnProperty("degreesLongitude")) + if (typeof message.degreesLongitude !== "number") + return "degreesLongitude: number expected"; + if (message.accuracyInMeters != null && message.hasOwnProperty("accuracyInMeters")) + if (!$util.isInteger(message.accuracyInMeters)) + return "accuracyInMeters: integer expected"; + if (message.speedInMps != null && message.hasOwnProperty("speedInMps")) + if (typeof message.speedInMps !== "number") + return "speedInMps: number expected"; + if (message.degreesClockwiseFromMagneticNorth != null && message.hasOwnProperty("degreesClockwiseFromMagneticNorth")) + if (!$util.isInteger(message.degreesClockwiseFromMagneticNorth)) + return "degreesClockwiseFromMagneticNorth: integer expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + if (message.sequenceNumber != null && message.hasOwnProperty("sequenceNumber")) + if (!$util.isInteger(message.sequenceNumber) && !(message.sequenceNumber && $util.isInteger(message.sequenceNumber.low) && $util.isInteger(message.sequenceNumber.high))) + return "sequenceNumber: integer|Long expected"; + if (message.timeOffset != null && message.hasOwnProperty("timeOffset")) + if (!$util.isInteger(message.timeOffset)) + return "timeOffset: integer expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a LiveLocationMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.LiveLocationMessage} LiveLocationMessage + */ + LiveLocationMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.LiveLocationMessage) + return object; + var message = new $root.proto.Message.LiveLocationMessage(); + if (object.degreesLatitude != null) + message.degreesLatitude = Number(object.degreesLatitude); + if (object.degreesLongitude != null) + message.degreesLongitude = Number(object.degreesLongitude); + if (object.accuracyInMeters != null) + message.accuracyInMeters = object.accuracyInMeters >>> 0; + if (object.speedInMps != null) + message.speedInMps = Number(object.speedInMps); + if (object.degreesClockwiseFromMagneticNorth != null) + message.degreesClockwiseFromMagneticNorth = object.degreesClockwiseFromMagneticNorth >>> 0; + if (object.caption != null) + message.caption = String(object.caption); + if (object.sequenceNumber != null) + if ($util.Long) + (message.sequenceNumber = $util.Long.fromValue(object.sequenceNumber)).unsigned = false; + else if (typeof object.sequenceNumber === "string") + message.sequenceNumber = parseInt(object.sequenceNumber, 10); + else if (typeof object.sequenceNumber === "number") + message.sequenceNumber = object.sequenceNumber; + else if (typeof object.sequenceNumber === "object") + message.sequenceNumber = new $util.LongBits(object.sequenceNumber.low >>> 0, object.sequenceNumber.high >>> 0).toNumber(); + if (object.timeOffset != null) + message.timeOffset = object.timeOffset >>> 0; + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.LiveLocationMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a LiveLocationMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.LiveLocationMessage + * @static + * @param {proto.Message.LiveLocationMessage} message LiveLocationMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LiveLocationMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.degreesLatitude = 0; + object.degreesLongitude = 0; + object.accuracyInMeters = 0; + object.speedInMps = 0; + object.degreesClockwiseFromMagneticNorth = 0; + object.caption = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.sequenceNumber = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.sequenceNumber = options.longs === String ? "0" : 0; + object.timeOffset = 0; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.contextInfo = null; + } + if (message.degreesLatitude != null && message.hasOwnProperty("degreesLatitude")) + object.degreesLatitude = options.json && !isFinite(message.degreesLatitude) ? String(message.degreesLatitude) : message.degreesLatitude; + if (message.degreesLongitude != null && message.hasOwnProperty("degreesLongitude")) + object.degreesLongitude = options.json && !isFinite(message.degreesLongitude) ? String(message.degreesLongitude) : message.degreesLongitude; + if (message.accuracyInMeters != null && message.hasOwnProperty("accuracyInMeters")) + object.accuracyInMeters = message.accuracyInMeters; + if (message.speedInMps != null && message.hasOwnProperty("speedInMps")) + object.speedInMps = options.json && !isFinite(message.speedInMps) ? String(message.speedInMps) : message.speedInMps; + if (message.degreesClockwiseFromMagneticNorth != null && message.hasOwnProperty("degreesClockwiseFromMagneticNorth")) + object.degreesClockwiseFromMagneticNorth = message.degreesClockwiseFromMagneticNorth; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + if (message.sequenceNumber != null && message.hasOwnProperty("sequenceNumber")) + if (typeof message.sequenceNumber === "number") + object.sequenceNumber = options.longs === String ? String(message.sequenceNumber) : message.sequenceNumber; + else + object.sequenceNumber = options.longs === String ? $util.Long.prototype.toString.call(message.sequenceNumber) : options.longs === Number ? new $util.LongBits(message.sequenceNumber.low >>> 0, message.sequenceNumber.high >>> 0).toNumber() : message.sequenceNumber; + if (message.timeOffset != null && message.hasOwnProperty("timeOffset")) + object.timeOffset = message.timeOffset; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this LiveLocationMessage to JSON. + * @function toJSON + * @memberof proto.Message.LiveLocationMessage + * @instance + * @returns {Object.} JSON object + */ + LiveLocationMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LiveLocationMessage; + })(); + + Message.LocationMessage = (function() { + + /** + * Properties of a LocationMessage. + * @memberof proto.Message + * @interface ILocationMessage + * @property {number|null} [degreesLatitude] LocationMessage degreesLatitude + * @property {number|null} [degreesLongitude] LocationMessage degreesLongitude + * @property {string|null} [name] LocationMessage name + * @property {string|null} [address] LocationMessage address + * @property {string|null} [url] LocationMessage url + * @property {boolean|null} [isLive] LocationMessage isLive + * @property {number|null} [accuracyInMeters] LocationMessage accuracyInMeters + * @property {number|null} [speedInMps] LocationMessage speedInMps + * @property {number|null} [degreesClockwiseFromMagneticNorth] LocationMessage degreesClockwiseFromMagneticNorth + * @property {string|null} [comment] LocationMessage comment + * @property {Uint8Array|null} [jpegThumbnail] LocationMessage jpegThumbnail + * @property {proto.IContextInfo|null} [contextInfo] LocationMessage contextInfo + */ + + /** + * Constructs a new LocationMessage. + * @memberof proto.Message + * @classdesc Represents a LocationMessage. + * @implements ILocationMessage + * @constructor + * @param {proto.Message.ILocationMessage=} [properties] Properties to set + */ + function LocationMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationMessage degreesLatitude. + * @member {number} degreesLatitude + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.degreesLatitude = 0; + + /** + * LocationMessage degreesLongitude. + * @member {number} degreesLongitude + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.degreesLongitude = 0; + + /** + * LocationMessage name. + * @member {string} name + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.name = ""; + + /** + * LocationMessage address. + * @member {string} address + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.address = ""; + + /** + * LocationMessage url. + * @member {string} url + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.url = ""; + + /** + * LocationMessage isLive. + * @member {boolean} isLive + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.isLive = false; + + /** + * LocationMessage accuracyInMeters. + * @member {number} accuracyInMeters + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.accuracyInMeters = 0; + + /** + * LocationMessage speedInMps. + * @member {number} speedInMps + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.speedInMps = 0; + + /** + * LocationMessage degreesClockwiseFromMagneticNorth. + * @member {number} degreesClockwiseFromMagneticNorth + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.degreesClockwiseFromMagneticNorth = 0; + + /** + * LocationMessage comment. + * @member {string} comment + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.comment = ""; + + /** + * LocationMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * LocationMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.LocationMessage + * @instance + */ + LocationMessage.prototype.contextInfo = null; + + /** + * Creates a new LocationMessage instance using the specified properties. + * @function create + * @memberof proto.Message.LocationMessage + * @static + * @param {proto.Message.ILocationMessage=} [properties] Properties to set + * @returns {proto.Message.LocationMessage} LocationMessage instance + */ + LocationMessage.create = function create(properties) { + return new LocationMessage(properties); + }; + + /** + * Encodes the specified LocationMessage message. Does not implicitly {@link proto.Message.LocationMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.LocationMessage + * @static + * @param {proto.Message.ILocationMessage} message LocationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.degreesLatitude != null && Object.hasOwnProperty.call(message, "degreesLatitude")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.degreesLatitude); + if (message.degreesLongitude != null && Object.hasOwnProperty.call(message, "degreesLongitude")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.degreesLongitude); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.address != null && Object.hasOwnProperty.call(message, "address")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.address); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.url); + if (message.isLive != null && Object.hasOwnProperty.call(message, "isLive")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.isLive); + if (message.accuracyInMeters != null && Object.hasOwnProperty.call(message, "accuracyInMeters")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.accuracyInMeters); + if (message.speedInMps != null && Object.hasOwnProperty.call(message, "speedInMps")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.speedInMps); + if (message.degreesClockwiseFromMagneticNorth != null && Object.hasOwnProperty.call(message, "degreesClockwiseFromMagneticNorth")) + writer.uint32(/* id 9, wireType 0 =*/72).uint32(message.degreesClockwiseFromMagneticNorth); + if (message.comment != null && Object.hasOwnProperty.call(message, "comment")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.comment); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LocationMessage message, length delimited. Does not implicitly {@link proto.Message.LocationMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.LocationMessage + * @static + * @param {proto.Message.ILocationMessage} message LocationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.LocationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.LocationMessage} LocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.LocationMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.degreesLatitude = reader.double(); + break; + case 2: + message.degreesLongitude = reader.double(); + break; + case 3: + message.name = reader.string(); + break; + case 4: + message.address = reader.string(); + break; + case 5: + message.url = reader.string(); + break; + case 6: + message.isLive = reader.bool(); + break; + case 7: + message.accuracyInMeters = reader.uint32(); + break; + case 8: + message.speedInMps = reader.float(); + break; + case 9: + message.degreesClockwiseFromMagneticNorth = reader.uint32(); + break; + case 11: + message.comment = reader.string(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.LocationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.LocationMessage} LocationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationMessage message. + * @function verify + * @memberof proto.Message.LocationMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.degreesLatitude != null && message.hasOwnProperty("degreesLatitude")) + if (typeof message.degreesLatitude !== "number") + return "degreesLatitude: number expected"; + if (message.degreesLongitude != null && message.hasOwnProperty("degreesLongitude")) + if (typeof message.degreesLongitude !== "number") + return "degreesLongitude: number expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.address != null && message.hasOwnProperty("address")) + if (!$util.isString(message.address)) + return "address: string expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.isLive != null && message.hasOwnProperty("isLive")) + if (typeof message.isLive !== "boolean") + return "isLive: boolean expected"; + if (message.accuracyInMeters != null && message.hasOwnProperty("accuracyInMeters")) + if (!$util.isInteger(message.accuracyInMeters)) + return "accuracyInMeters: integer expected"; + if (message.speedInMps != null && message.hasOwnProperty("speedInMps")) + if (typeof message.speedInMps !== "number") + return "speedInMps: number expected"; + if (message.degreesClockwiseFromMagneticNorth != null && message.hasOwnProperty("degreesClockwiseFromMagneticNorth")) + if (!$util.isInteger(message.degreesClockwiseFromMagneticNorth)) + return "degreesClockwiseFromMagneticNorth: integer expected"; + if (message.comment != null && message.hasOwnProperty("comment")) + if (!$util.isString(message.comment)) + return "comment: string expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a LocationMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.LocationMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.LocationMessage} LocationMessage + */ + LocationMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.LocationMessage) + return object; + var message = new $root.proto.Message.LocationMessage(); + if (object.degreesLatitude != null) + message.degreesLatitude = Number(object.degreesLatitude); + if (object.degreesLongitude != null) + message.degreesLongitude = Number(object.degreesLongitude); + if (object.name != null) + message.name = String(object.name); + if (object.address != null) + message.address = String(object.address); + if (object.url != null) + message.url = String(object.url); + if (object.isLive != null) + message.isLive = Boolean(object.isLive); + if (object.accuracyInMeters != null) + message.accuracyInMeters = object.accuracyInMeters >>> 0; + if (object.speedInMps != null) + message.speedInMps = Number(object.speedInMps); + if (object.degreesClockwiseFromMagneticNorth != null) + message.degreesClockwiseFromMagneticNorth = object.degreesClockwiseFromMagneticNorth >>> 0; + if (object.comment != null) + message.comment = String(object.comment); + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.LocationMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a LocationMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.LocationMessage + * @static + * @param {proto.Message.LocationMessage} message LocationMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.degreesLatitude = 0; + object.degreesLongitude = 0; + object.name = ""; + object.address = ""; + object.url = ""; + object.isLive = false; + object.accuracyInMeters = 0; + object.speedInMps = 0; + object.degreesClockwiseFromMagneticNorth = 0; + object.comment = ""; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.contextInfo = null; + } + if (message.degreesLatitude != null && message.hasOwnProperty("degreesLatitude")) + object.degreesLatitude = options.json && !isFinite(message.degreesLatitude) ? String(message.degreesLatitude) : message.degreesLatitude; + if (message.degreesLongitude != null && message.hasOwnProperty("degreesLongitude")) + object.degreesLongitude = options.json && !isFinite(message.degreesLongitude) ? String(message.degreesLongitude) : message.degreesLongitude; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.address != null && message.hasOwnProperty("address")) + object.address = message.address; + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.isLive != null && message.hasOwnProperty("isLive")) + object.isLive = message.isLive; + if (message.accuracyInMeters != null && message.hasOwnProperty("accuracyInMeters")) + object.accuracyInMeters = message.accuracyInMeters; + if (message.speedInMps != null && message.hasOwnProperty("speedInMps")) + object.speedInMps = options.json && !isFinite(message.speedInMps) ? String(message.speedInMps) : message.speedInMps; + if (message.degreesClockwiseFromMagneticNorth != null && message.hasOwnProperty("degreesClockwiseFromMagneticNorth")) + object.degreesClockwiseFromMagneticNorth = message.degreesClockwiseFromMagneticNorth; + if (message.comment != null && message.hasOwnProperty("comment")) + object.comment = message.comment; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this LocationMessage to JSON. + * @function toJSON + * @memberof proto.Message.LocationMessage + * @instance + * @returns {Object.} JSON object + */ + LocationMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocationMessage; + })(); + + Message.OrderMessage = (function() { + + /** + * Properties of an OrderMessage. + * @memberof proto.Message + * @interface IOrderMessage + * @property {string|null} [orderId] OrderMessage orderId + * @property {Uint8Array|null} [thumbnail] OrderMessage thumbnail + * @property {number|null} [itemCount] OrderMessage itemCount + * @property {proto.Message.OrderMessage.OrderStatus|null} [status] OrderMessage status + * @property {proto.Message.OrderMessage.OrderSurface|null} [surface] OrderMessage surface + * @property {string|null} [message] OrderMessage message + * @property {string|null} [orderTitle] OrderMessage orderTitle + * @property {string|null} [sellerJid] OrderMessage sellerJid + * @property {string|null} [token] OrderMessage token + * @property {number|Long|null} [totalAmount1000] OrderMessage totalAmount1000 + * @property {string|null} [totalCurrencyCode] OrderMessage totalCurrencyCode + * @property {proto.IContextInfo|null} [contextInfo] OrderMessage contextInfo + */ + + /** + * Constructs a new OrderMessage. + * @memberof proto.Message + * @classdesc Represents an OrderMessage. + * @implements IOrderMessage + * @constructor + * @param {proto.Message.IOrderMessage=} [properties] Properties to set + */ + function OrderMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OrderMessage orderId. + * @member {string} orderId + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.orderId = ""; + + /** + * OrderMessage thumbnail. + * @member {Uint8Array} thumbnail + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.thumbnail = $util.newBuffer([]); + + /** + * OrderMessage itemCount. + * @member {number} itemCount + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.itemCount = 0; + + /** + * OrderMessage status. + * @member {proto.Message.OrderMessage.OrderStatus} status + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.status = 1; + + /** + * OrderMessage surface. + * @member {proto.Message.OrderMessage.OrderSurface} surface + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.surface = 1; + + /** + * OrderMessage message. + * @member {string} message + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.message = ""; + + /** + * OrderMessage orderTitle. + * @member {string} orderTitle + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.orderTitle = ""; + + /** + * OrderMessage sellerJid. + * @member {string} sellerJid + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.sellerJid = ""; + + /** + * OrderMessage token. + * @member {string} token + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.token = ""; + + /** + * OrderMessage totalAmount1000. + * @member {number|Long} totalAmount1000 + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.totalAmount1000 = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * OrderMessage totalCurrencyCode. + * @member {string} totalCurrencyCode + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.totalCurrencyCode = ""; + + /** + * OrderMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.OrderMessage + * @instance + */ + OrderMessage.prototype.contextInfo = null; + + /** + * Creates a new OrderMessage instance using the specified properties. + * @function create + * @memberof proto.Message.OrderMessage + * @static + * @param {proto.Message.IOrderMessage=} [properties] Properties to set + * @returns {proto.Message.OrderMessage} OrderMessage instance + */ + OrderMessage.create = function create(properties) { + return new OrderMessage(properties); + }; + + /** + * Encodes the specified OrderMessage message. Does not implicitly {@link proto.Message.OrderMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.OrderMessage + * @static + * @param {proto.Message.IOrderMessage} message OrderMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OrderMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.orderId != null && Object.hasOwnProperty.call(message, "orderId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.orderId); + if (message.thumbnail != null && Object.hasOwnProperty.call(message, "thumbnail")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.thumbnail); + if (message.itemCount != null && Object.hasOwnProperty.call(message, "itemCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.itemCount); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.status); + if (message.surface != null && Object.hasOwnProperty.call(message, "surface")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.surface); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.message); + if (message.orderTitle != null && Object.hasOwnProperty.call(message, "orderTitle")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.orderTitle); + if (message.sellerJid != null && Object.hasOwnProperty.call(message, "sellerJid")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.sellerJid); + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.token); + if (message.totalAmount1000 != null && Object.hasOwnProperty.call(message, "totalAmount1000")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.totalAmount1000); + if (message.totalCurrencyCode != null && Object.hasOwnProperty.call(message, "totalCurrencyCode")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.totalCurrencyCode); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OrderMessage message, length delimited. Does not implicitly {@link proto.Message.OrderMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.OrderMessage + * @static + * @param {proto.Message.IOrderMessage} message OrderMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OrderMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OrderMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.OrderMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.OrderMessage} OrderMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OrderMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.OrderMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.orderId = reader.string(); + break; + case 2: + message.thumbnail = reader.bytes(); + break; + case 3: + message.itemCount = reader.int32(); + break; + case 4: + message.status = reader.int32(); + break; + case 5: + message.surface = reader.int32(); + break; + case 6: + message.message = reader.string(); + break; + case 7: + message.orderTitle = reader.string(); + break; + case 8: + message.sellerJid = reader.string(); + break; + case 9: + message.token = reader.string(); + break; + case 10: + message.totalAmount1000 = reader.int64(); + break; + case 11: + message.totalCurrencyCode = reader.string(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OrderMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.OrderMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.OrderMessage} OrderMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OrderMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OrderMessage message. + * @function verify + * @memberof proto.Message.OrderMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OrderMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.orderId != null && message.hasOwnProperty("orderId")) + if (!$util.isString(message.orderId)) + return "orderId: string expected"; + if (message.thumbnail != null && message.hasOwnProperty("thumbnail")) + if (!(message.thumbnail && typeof message.thumbnail.length === "number" || $util.isString(message.thumbnail))) + return "thumbnail: buffer expected"; + if (message.itemCount != null && message.hasOwnProperty("itemCount")) + if (!$util.isInteger(message.itemCount)) + return "itemCount: integer expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 1: + break; + } + if (message.surface != null && message.hasOwnProperty("surface")) + switch (message.surface) { + default: + return "surface: enum value expected"; + case 1: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.orderTitle != null && message.hasOwnProperty("orderTitle")) + if (!$util.isString(message.orderTitle)) + return "orderTitle: string expected"; + if (message.sellerJid != null && message.hasOwnProperty("sellerJid")) + if (!$util.isString(message.sellerJid)) + return "sellerJid: string expected"; + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + if (message.totalAmount1000 != null && message.hasOwnProperty("totalAmount1000")) + if (!$util.isInteger(message.totalAmount1000) && !(message.totalAmount1000 && $util.isInteger(message.totalAmount1000.low) && $util.isInteger(message.totalAmount1000.high))) + return "totalAmount1000: integer|Long expected"; + if (message.totalCurrencyCode != null && message.hasOwnProperty("totalCurrencyCode")) + if (!$util.isString(message.totalCurrencyCode)) + return "totalCurrencyCode: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates an OrderMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.OrderMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.OrderMessage} OrderMessage + */ + OrderMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.OrderMessage) + return object; + var message = new $root.proto.Message.OrderMessage(); + if (object.orderId != null) + message.orderId = String(object.orderId); + if (object.thumbnail != null) + if (typeof object.thumbnail === "string") + $util.base64.decode(object.thumbnail, message.thumbnail = $util.newBuffer($util.base64.length(object.thumbnail)), 0); + else if (object.thumbnail.length) + message.thumbnail = object.thumbnail; + if (object.itemCount != null) + message.itemCount = object.itemCount | 0; + switch (object.status) { + case "INQUIRY": + case 1: + message.status = 1; + break; + } + switch (object.surface) { + case "CATALOG": + case 1: + message.surface = 1; + break; + } + if (object.message != null) + message.message = String(object.message); + if (object.orderTitle != null) + message.orderTitle = String(object.orderTitle); + if (object.sellerJid != null) + message.sellerJid = String(object.sellerJid); + if (object.token != null) + message.token = String(object.token); + if (object.totalAmount1000 != null) + if ($util.Long) + (message.totalAmount1000 = $util.Long.fromValue(object.totalAmount1000)).unsigned = false; + else if (typeof object.totalAmount1000 === "string") + message.totalAmount1000 = parseInt(object.totalAmount1000, 10); + else if (typeof object.totalAmount1000 === "number") + message.totalAmount1000 = object.totalAmount1000; + else if (typeof object.totalAmount1000 === "object") + message.totalAmount1000 = new $util.LongBits(object.totalAmount1000.low >>> 0, object.totalAmount1000.high >>> 0).toNumber(); + if (object.totalCurrencyCode != null) + message.totalCurrencyCode = String(object.totalCurrencyCode); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.OrderMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from an OrderMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.OrderMessage + * @static + * @param {proto.Message.OrderMessage} message OrderMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OrderMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.orderId = ""; + if (options.bytes === String) + object.thumbnail = ""; + else { + object.thumbnail = []; + if (options.bytes !== Array) + object.thumbnail = $util.newBuffer(object.thumbnail); + } + object.itemCount = 0; + object.status = options.enums === String ? "INQUIRY" : 1; + object.surface = options.enums === String ? "CATALOG" : 1; + object.message = ""; + object.orderTitle = ""; + object.sellerJid = ""; + object.token = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.totalAmount1000 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.totalAmount1000 = options.longs === String ? "0" : 0; + object.totalCurrencyCode = ""; + object.contextInfo = null; + } + if (message.orderId != null && message.hasOwnProperty("orderId")) + object.orderId = message.orderId; + if (message.thumbnail != null && message.hasOwnProperty("thumbnail")) + object.thumbnail = options.bytes === String ? $util.base64.encode(message.thumbnail, 0, message.thumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnail) : message.thumbnail; + if (message.itemCount != null && message.hasOwnProperty("itemCount")) + object.itemCount = message.itemCount; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.proto.Message.OrderMessage.OrderStatus[message.status] : message.status; + if (message.surface != null && message.hasOwnProperty("surface")) + object.surface = options.enums === String ? $root.proto.Message.OrderMessage.OrderSurface[message.surface] : message.surface; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.orderTitle != null && message.hasOwnProperty("orderTitle")) + object.orderTitle = message.orderTitle; + if (message.sellerJid != null && message.hasOwnProperty("sellerJid")) + object.sellerJid = message.sellerJid; + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + if (message.totalAmount1000 != null && message.hasOwnProperty("totalAmount1000")) + if (typeof message.totalAmount1000 === "number") + object.totalAmount1000 = options.longs === String ? String(message.totalAmount1000) : message.totalAmount1000; + else + object.totalAmount1000 = options.longs === String ? $util.Long.prototype.toString.call(message.totalAmount1000) : options.longs === Number ? new $util.LongBits(message.totalAmount1000.low >>> 0, message.totalAmount1000.high >>> 0).toNumber() : message.totalAmount1000; + if (message.totalCurrencyCode != null && message.hasOwnProperty("totalCurrencyCode")) + object.totalCurrencyCode = message.totalCurrencyCode; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this OrderMessage to JSON. + * @function toJSON + * @memberof proto.Message.OrderMessage + * @instance + * @returns {Object.} JSON object + */ + OrderMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OrderStatus enum. + * @name proto.Message.OrderMessage.OrderStatus + * @enum {number} + * @property {number} INQUIRY=1 INQUIRY value + */ + OrderMessage.OrderStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "INQUIRY"] = 1; + return values; + })(); + + /** + * OrderSurface enum. + * @name proto.Message.OrderMessage.OrderSurface + * @enum {number} + * @property {number} CATALOG=1 CATALOG value + */ + OrderMessage.OrderSurface = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "CATALOG"] = 1; + return values; + })(); + + return OrderMessage; + })(); + + Message.PaymentInviteMessage = (function() { + + /** + * Properties of a PaymentInviteMessage. + * @memberof proto.Message + * @interface IPaymentInviteMessage + * @property {proto.Message.PaymentInviteMessage.ServiceType|null} [serviceType] PaymentInviteMessage serviceType + * @property {number|Long|null} [expiryTimestamp] PaymentInviteMessage expiryTimestamp + */ + + /** + * Constructs a new PaymentInviteMessage. + * @memberof proto.Message + * @classdesc Represents a PaymentInviteMessage. + * @implements IPaymentInviteMessage + * @constructor + * @param {proto.Message.IPaymentInviteMessage=} [properties] Properties to set + */ + function PaymentInviteMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PaymentInviteMessage serviceType. + * @member {proto.Message.PaymentInviteMessage.ServiceType} serviceType + * @memberof proto.Message.PaymentInviteMessage + * @instance + */ + PaymentInviteMessage.prototype.serviceType = 0; + + /** + * PaymentInviteMessage expiryTimestamp. + * @member {number|Long} expiryTimestamp + * @memberof proto.Message.PaymentInviteMessage + * @instance + */ + PaymentInviteMessage.prototype.expiryTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PaymentInviteMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {proto.Message.IPaymentInviteMessage=} [properties] Properties to set + * @returns {proto.Message.PaymentInviteMessage} PaymentInviteMessage instance + */ + PaymentInviteMessage.create = function create(properties) { + return new PaymentInviteMessage(properties); + }; + + /** + * Encodes the specified PaymentInviteMessage message. Does not implicitly {@link proto.Message.PaymentInviteMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {proto.Message.IPaymentInviteMessage} message PaymentInviteMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PaymentInviteMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serviceType != null && Object.hasOwnProperty.call(message, "serviceType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.serviceType); + if (message.expiryTimestamp != null && Object.hasOwnProperty.call(message, "expiryTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.expiryTimestamp); + return writer; + }; + + /** + * Encodes the specified PaymentInviteMessage message, length delimited. Does not implicitly {@link proto.Message.PaymentInviteMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {proto.Message.IPaymentInviteMessage} message PaymentInviteMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PaymentInviteMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PaymentInviteMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PaymentInviteMessage} PaymentInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PaymentInviteMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PaymentInviteMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.serviceType = reader.int32(); + break; + case 2: + message.expiryTimestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PaymentInviteMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PaymentInviteMessage} PaymentInviteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PaymentInviteMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PaymentInviteMessage message. + * @function verify + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PaymentInviteMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serviceType != null && message.hasOwnProperty("serviceType")) + switch (message.serviceType) { + default: + return "serviceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.expiryTimestamp != null && message.hasOwnProperty("expiryTimestamp")) + if (!$util.isInteger(message.expiryTimestamp) && !(message.expiryTimestamp && $util.isInteger(message.expiryTimestamp.low) && $util.isInteger(message.expiryTimestamp.high))) + return "expiryTimestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a PaymentInviteMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PaymentInviteMessage} PaymentInviteMessage + */ + PaymentInviteMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PaymentInviteMessage) + return object; + var message = new $root.proto.Message.PaymentInviteMessage(); + switch (object.serviceType) { + case "UNKNOWN": + case 0: + message.serviceType = 0; + break; + case "FBPAY": + case 1: + message.serviceType = 1; + break; + case "NOVI": + case 2: + message.serviceType = 2; + break; + case "UPI": + case 3: + message.serviceType = 3; + break; + } + if (object.expiryTimestamp != null) + if ($util.Long) + (message.expiryTimestamp = $util.Long.fromValue(object.expiryTimestamp)).unsigned = false; + else if (typeof object.expiryTimestamp === "string") + message.expiryTimestamp = parseInt(object.expiryTimestamp, 10); + else if (typeof object.expiryTimestamp === "number") + message.expiryTimestamp = object.expiryTimestamp; + else if (typeof object.expiryTimestamp === "object") + message.expiryTimestamp = new $util.LongBits(object.expiryTimestamp.low >>> 0, object.expiryTimestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PaymentInviteMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PaymentInviteMessage + * @static + * @param {proto.Message.PaymentInviteMessage} message PaymentInviteMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PaymentInviteMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.serviceType = options.enums === String ? "UNKNOWN" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.expiryTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expiryTimestamp = options.longs === String ? "0" : 0; + } + if (message.serviceType != null && message.hasOwnProperty("serviceType")) + object.serviceType = options.enums === String ? $root.proto.Message.PaymentInviteMessage.ServiceType[message.serviceType] : message.serviceType; + if (message.expiryTimestamp != null && message.hasOwnProperty("expiryTimestamp")) + if (typeof message.expiryTimestamp === "number") + object.expiryTimestamp = options.longs === String ? String(message.expiryTimestamp) : message.expiryTimestamp; + else + object.expiryTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.expiryTimestamp) : options.longs === Number ? new $util.LongBits(message.expiryTimestamp.low >>> 0, message.expiryTimestamp.high >>> 0).toNumber() : message.expiryTimestamp; + return object; + }; + + /** + * Converts this PaymentInviteMessage to JSON. + * @function toJSON + * @memberof proto.Message.PaymentInviteMessage + * @instance + * @returns {Object.} JSON object + */ + PaymentInviteMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * ServiceType enum. + * @name proto.Message.PaymentInviteMessage.ServiceType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} FBPAY=1 FBPAY value + * @property {number} NOVI=2 NOVI value + * @property {number} UPI=3 UPI value + */ + PaymentInviteMessage.ServiceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "FBPAY"] = 1; + values[valuesById[2] = "NOVI"] = 2; + values[valuesById[3] = "UPI"] = 3; + return values; + })(); + + return PaymentInviteMessage; + })(); + + Message.PeerDataOperationRequestMessage = (function() { + + /** + * Properties of a PeerDataOperationRequestMessage. + * @memberof proto.Message + * @interface IPeerDataOperationRequestMessage + * @property {proto.Message.PeerDataOperationRequestType|null} [peerDataOperationRequestType] PeerDataOperationRequestMessage peerDataOperationRequestType + * @property {Array.|null} [requestStickerReupload] PeerDataOperationRequestMessage requestStickerReupload + * @property {Array.|null} [requestUrlPreview] PeerDataOperationRequestMessage requestUrlPreview + * @property {proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest|null} [historySyncOnDemandRequest] PeerDataOperationRequestMessage historySyncOnDemandRequest + */ + + /** + * Constructs a new PeerDataOperationRequestMessage. + * @memberof proto.Message + * @classdesc Represents a PeerDataOperationRequestMessage. + * @implements IPeerDataOperationRequestMessage + * @constructor + * @param {proto.Message.IPeerDataOperationRequestMessage=} [properties] Properties to set + */ + function PeerDataOperationRequestMessage(properties) { + this.requestStickerReupload = []; + this.requestUrlPreview = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PeerDataOperationRequestMessage peerDataOperationRequestType. + * @member {proto.Message.PeerDataOperationRequestType} peerDataOperationRequestType + * @memberof proto.Message.PeerDataOperationRequestMessage + * @instance + */ + PeerDataOperationRequestMessage.prototype.peerDataOperationRequestType = 0; + + /** + * PeerDataOperationRequestMessage requestStickerReupload. + * @member {Array.} requestStickerReupload + * @memberof proto.Message.PeerDataOperationRequestMessage + * @instance + */ + PeerDataOperationRequestMessage.prototype.requestStickerReupload = $util.emptyArray; + + /** + * PeerDataOperationRequestMessage requestUrlPreview. + * @member {Array.} requestUrlPreview + * @memberof proto.Message.PeerDataOperationRequestMessage + * @instance + */ + PeerDataOperationRequestMessage.prototype.requestUrlPreview = $util.emptyArray; + + /** + * PeerDataOperationRequestMessage historySyncOnDemandRequest. + * @member {proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest|null|undefined} historySyncOnDemandRequest + * @memberof proto.Message.PeerDataOperationRequestMessage + * @instance + */ + PeerDataOperationRequestMessage.prototype.historySyncOnDemandRequest = null; + + /** + * Creates a new PeerDataOperationRequestMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {proto.Message.IPeerDataOperationRequestMessage=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestMessage} PeerDataOperationRequestMessage instance + */ + PeerDataOperationRequestMessage.create = function create(properties) { + return new PeerDataOperationRequestMessage(properties); + }; + + /** + * Encodes the specified PeerDataOperationRequestMessage message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {proto.Message.IPeerDataOperationRequestMessage} message PeerDataOperationRequestMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeerDataOperationRequestMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.peerDataOperationRequestType != null && Object.hasOwnProperty.call(message, "peerDataOperationRequestType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.peerDataOperationRequestType); + if (message.requestStickerReupload != null && message.requestStickerReupload.length) + for (var i = 0; i < message.requestStickerReupload.length; ++i) + $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.encode(message.requestStickerReupload[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.requestUrlPreview != null && message.requestUrlPreview.length) + for (var i = 0; i < message.requestUrlPreview.length; ++i) + $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.encode(message.requestUrlPreview[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.historySyncOnDemandRequest != null && Object.hasOwnProperty.call(message, "historySyncOnDemandRequest")) + $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.encode(message.historySyncOnDemandRequest, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PeerDataOperationRequestMessage message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {proto.Message.IPeerDataOperationRequestMessage} message PeerDataOperationRequestMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeerDataOperationRequestMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PeerDataOperationRequestMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestMessage} PeerDataOperationRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeerDataOperationRequestMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.peerDataOperationRequestType = reader.int32(); + break; + case 2: + if (!(message.requestStickerReupload && message.requestStickerReupload.length)) + message.requestStickerReupload = []; + message.requestStickerReupload.push($root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.requestUrlPreview && message.requestUrlPreview.length)) + message.requestUrlPreview = []; + message.requestUrlPreview.push($root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.decode(reader, reader.uint32())); + break; + case 4: + message.historySyncOnDemandRequest = $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PeerDataOperationRequestMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestMessage} PeerDataOperationRequestMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeerDataOperationRequestMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PeerDataOperationRequestMessage message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PeerDataOperationRequestMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.peerDataOperationRequestType != null && message.hasOwnProperty("peerDataOperationRequestType")) + switch (message.peerDataOperationRequestType) { + default: + return "peerDataOperationRequestType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.requestStickerReupload != null && message.hasOwnProperty("requestStickerReupload")) { + if (!Array.isArray(message.requestStickerReupload)) + return "requestStickerReupload: array expected"; + for (var i = 0; i < message.requestStickerReupload.length; ++i) { + var error = $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.verify(message.requestStickerReupload[i]); + if (error) + return "requestStickerReupload." + error; + } + } + if (message.requestUrlPreview != null && message.hasOwnProperty("requestUrlPreview")) { + if (!Array.isArray(message.requestUrlPreview)) + return "requestUrlPreview: array expected"; + for (var i = 0; i < message.requestUrlPreview.length; ++i) { + var error = $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.verify(message.requestUrlPreview[i]); + if (error) + return "requestUrlPreview." + error; + } + } + if (message.historySyncOnDemandRequest != null && message.hasOwnProperty("historySyncOnDemandRequest")) { + var error = $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.verify(message.historySyncOnDemandRequest); + if (error) + return "historySyncOnDemandRequest." + error; + } + return null; + }; + + /** + * Creates a PeerDataOperationRequestMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestMessage} PeerDataOperationRequestMessage + */ + PeerDataOperationRequestMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestMessage) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestMessage(); + switch (object.peerDataOperationRequestType) { + case "UPLOAD_STICKER": + case 0: + message.peerDataOperationRequestType = 0; + break; + case "SEND_RECENT_STICKER_BOOTSTRAP": + case 1: + message.peerDataOperationRequestType = 1; + break; + case "GENERATE_LINK_PREVIEW": + case 2: + message.peerDataOperationRequestType = 2; + break; + case "HISTORY_SYNC_ON_DEMAND": + case 3: + message.peerDataOperationRequestType = 3; + break; + } + if (object.requestStickerReupload) { + if (!Array.isArray(object.requestStickerReupload)) + throw TypeError(".proto.Message.PeerDataOperationRequestMessage.requestStickerReupload: array expected"); + message.requestStickerReupload = []; + for (var i = 0; i < object.requestStickerReupload.length; ++i) { + if (typeof object.requestStickerReupload[i] !== "object") + throw TypeError(".proto.Message.PeerDataOperationRequestMessage.requestStickerReupload: object expected"); + message.requestStickerReupload[i] = $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.fromObject(object.requestStickerReupload[i]); + } + } + if (object.requestUrlPreview) { + if (!Array.isArray(object.requestUrlPreview)) + throw TypeError(".proto.Message.PeerDataOperationRequestMessage.requestUrlPreview: array expected"); + message.requestUrlPreview = []; + for (var i = 0; i < object.requestUrlPreview.length; ++i) { + if (typeof object.requestUrlPreview[i] !== "object") + throw TypeError(".proto.Message.PeerDataOperationRequestMessage.requestUrlPreview: object expected"); + message.requestUrlPreview[i] = $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.fromObject(object.requestUrlPreview[i]); + } + } + if (object.historySyncOnDemandRequest != null) { + if (typeof object.historySyncOnDemandRequest !== "object") + throw TypeError(".proto.Message.PeerDataOperationRequestMessage.historySyncOnDemandRequest: object expected"); + message.historySyncOnDemandRequest = $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.fromObject(object.historySyncOnDemandRequest); + } + return message; + }; + + /** + * Creates a plain object from a PeerDataOperationRequestMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestMessage + * @static + * @param {proto.Message.PeerDataOperationRequestMessage} message PeerDataOperationRequestMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PeerDataOperationRequestMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.requestStickerReupload = []; + object.requestUrlPreview = []; + } + if (options.defaults) { + object.peerDataOperationRequestType = options.enums === String ? "UPLOAD_STICKER" : 0; + object.historySyncOnDemandRequest = null; + } + if (message.peerDataOperationRequestType != null && message.hasOwnProperty("peerDataOperationRequestType")) + object.peerDataOperationRequestType = options.enums === String ? $root.proto.Message.PeerDataOperationRequestType[message.peerDataOperationRequestType] : message.peerDataOperationRequestType; + if (message.requestStickerReupload && message.requestStickerReupload.length) { + object.requestStickerReupload = []; + for (var j = 0; j < message.requestStickerReupload.length; ++j) + object.requestStickerReupload[j] = $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.toObject(message.requestStickerReupload[j], options); + } + if (message.requestUrlPreview && message.requestUrlPreview.length) { + object.requestUrlPreview = []; + for (var j = 0; j < message.requestUrlPreview.length; ++j) + object.requestUrlPreview[j] = $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.toObject(message.requestUrlPreview[j], options); + } + if (message.historySyncOnDemandRequest != null && message.hasOwnProperty("historySyncOnDemandRequest")) + object.historySyncOnDemandRequest = $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.toObject(message.historySyncOnDemandRequest, options); + return object; + }; + + /** + * Converts this PeerDataOperationRequestMessage to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestMessage + * @instance + * @returns {Object.} JSON object + */ + PeerDataOperationRequestMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PeerDataOperationRequestMessage.HistorySyncOnDemandRequest = (function() { + + /** + * Properties of a HistorySyncOnDemandRequest. + * @memberof proto.Message.PeerDataOperationRequestMessage + * @interface IHistorySyncOnDemandRequest + * @property {string|null} [chatJid] HistorySyncOnDemandRequest chatJid + * @property {string|null} [oldestMsgId] HistorySyncOnDemandRequest oldestMsgId + * @property {boolean|null} [oldestMsgFromMe] HistorySyncOnDemandRequest oldestMsgFromMe + * @property {number|null} [onDemandMsgCount] HistorySyncOnDemandRequest onDemandMsgCount + * @property {number|Long|null} [oldestMsgTimestampMs] HistorySyncOnDemandRequest oldestMsgTimestampMs + */ + + /** + * Constructs a new HistorySyncOnDemandRequest. + * @memberof proto.Message.PeerDataOperationRequestMessage + * @classdesc Represents a HistorySyncOnDemandRequest. + * @implements IHistorySyncOnDemandRequest + * @constructor + * @param {proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest=} [properties] Properties to set + */ + function HistorySyncOnDemandRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HistorySyncOnDemandRequest chatJid. + * @member {string} chatJid + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @instance + */ + HistorySyncOnDemandRequest.prototype.chatJid = ""; + + /** + * HistorySyncOnDemandRequest oldestMsgId. + * @member {string} oldestMsgId + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @instance + */ + HistorySyncOnDemandRequest.prototype.oldestMsgId = ""; + + /** + * HistorySyncOnDemandRequest oldestMsgFromMe. + * @member {boolean} oldestMsgFromMe + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @instance + */ + HistorySyncOnDemandRequest.prototype.oldestMsgFromMe = false; + + /** + * HistorySyncOnDemandRequest onDemandMsgCount. + * @member {number} onDemandMsgCount + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @instance + */ + HistorySyncOnDemandRequest.prototype.onDemandMsgCount = 0; + + /** + * HistorySyncOnDemandRequest oldestMsgTimestampMs. + * @member {number|Long} oldestMsgTimestampMs + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @instance + */ + HistorySyncOnDemandRequest.prototype.oldestMsgTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new HistorySyncOnDemandRequest instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest} HistorySyncOnDemandRequest instance + */ + HistorySyncOnDemandRequest.create = function create(properties) { + return new HistorySyncOnDemandRequest(properties); + }; + + /** + * Encodes the specified HistorySyncOnDemandRequest message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest} message HistorySyncOnDemandRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncOnDemandRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chatJid != null && Object.hasOwnProperty.call(message, "chatJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.chatJid); + if (message.oldestMsgId != null && Object.hasOwnProperty.call(message, "oldestMsgId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.oldestMsgId); + if (message.oldestMsgFromMe != null && Object.hasOwnProperty.call(message, "oldestMsgFromMe")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.oldestMsgFromMe); + if (message.onDemandMsgCount != null && Object.hasOwnProperty.call(message, "onDemandMsgCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.onDemandMsgCount); + if (message.oldestMsgTimestampMs != null && Object.hasOwnProperty.call(message, "oldestMsgTimestampMs")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.oldestMsgTimestampMs); + return writer; + }; + + /** + * Encodes the specified HistorySyncOnDemandRequest message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IHistorySyncOnDemandRequest} message HistorySyncOnDemandRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HistorySyncOnDemandRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HistorySyncOnDemandRequest message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest} HistorySyncOnDemandRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncOnDemandRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chatJid = reader.string(); + break; + case 2: + message.oldestMsgId = reader.string(); + break; + case 3: + message.oldestMsgFromMe = reader.bool(); + break; + case 4: + message.onDemandMsgCount = reader.int32(); + break; + case 5: + message.oldestMsgTimestampMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HistorySyncOnDemandRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest} HistorySyncOnDemandRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HistorySyncOnDemandRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HistorySyncOnDemandRequest message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HistorySyncOnDemandRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chatJid != null && message.hasOwnProperty("chatJid")) + if (!$util.isString(message.chatJid)) + return "chatJid: string expected"; + if (message.oldestMsgId != null && message.hasOwnProperty("oldestMsgId")) + if (!$util.isString(message.oldestMsgId)) + return "oldestMsgId: string expected"; + if (message.oldestMsgFromMe != null && message.hasOwnProperty("oldestMsgFromMe")) + if (typeof message.oldestMsgFromMe !== "boolean") + return "oldestMsgFromMe: boolean expected"; + if (message.onDemandMsgCount != null && message.hasOwnProperty("onDemandMsgCount")) + if (!$util.isInteger(message.onDemandMsgCount)) + return "onDemandMsgCount: integer expected"; + if (message.oldestMsgTimestampMs != null && message.hasOwnProperty("oldestMsgTimestampMs")) + if (!$util.isInteger(message.oldestMsgTimestampMs) && !(message.oldestMsgTimestampMs && $util.isInteger(message.oldestMsgTimestampMs.low) && $util.isInteger(message.oldestMsgTimestampMs.high))) + return "oldestMsgTimestampMs: integer|Long expected"; + return null; + }; + + /** + * Creates a HistorySyncOnDemandRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest} HistorySyncOnDemandRequest + */ + HistorySyncOnDemandRequest.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest(); + if (object.chatJid != null) + message.chatJid = String(object.chatJid); + if (object.oldestMsgId != null) + message.oldestMsgId = String(object.oldestMsgId); + if (object.oldestMsgFromMe != null) + message.oldestMsgFromMe = Boolean(object.oldestMsgFromMe); + if (object.onDemandMsgCount != null) + message.onDemandMsgCount = object.onDemandMsgCount | 0; + if (object.oldestMsgTimestampMs != null) + if ($util.Long) + (message.oldestMsgTimestampMs = $util.Long.fromValue(object.oldestMsgTimestampMs)).unsigned = false; + else if (typeof object.oldestMsgTimestampMs === "string") + message.oldestMsgTimestampMs = parseInt(object.oldestMsgTimestampMs, 10); + else if (typeof object.oldestMsgTimestampMs === "number") + message.oldestMsgTimestampMs = object.oldestMsgTimestampMs; + else if (typeof object.oldestMsgTimestampMs === "object") + message.oldestMsgTimestampMs = new $util.LongBits(object.oldestMsgTimestampMs.low >>> 0, object.oldestMsgTimestampMs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a HistorySyncOnDemandRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest} message HistorySyncOnDemandRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HistorySyncOnDemandRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.chatJid = ""; + object.oldestMsgId = ""; + object.oldestMsgFromMe = false; + object.onDemandMsgCount = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.oldestMsgTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.oldestMsgTimestampMs = options.longs === String ? "0" : 0; + } + if (message.chatJid != null && message.hasOwnProperty("chatJid")) + object.chatJid = message.chatJid; + if (message.oldestMsgId != null && message.hasOwnProperty("oldestMsgId")) + object.oldestMsgId = message.oldestMsgId; + if (message.oldestMsgFromMe != null && message.hasOwnProperty("oldestMsgFromMe")) + object.oldestMsgFromMe = message.oldestMsgFromMe; + if (message.onDemandMsgCount != null && message.hasOwnProperty("onDemandMsgCount")) + object.onDemandMsgCount = message.onDemandMsgCount; + if (message.oldestMsgTimestampMs != null && message.hasOwnProperty("oldestMsgTimestampMs")) + if (typeof message.oldestMsgTimestampMs === "number") + object.oldestMsgTimestampMs = options.longs === String ? String(message.oldestMsgTimestampMs) : message.oldestMsgTimestampMs; + else + object.oldestMsgTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.oldestMsgTimestampMs) : options.longs === Number ? new $util.LongBits(message.oldestMsgTimestampMs.low >>> 0, message.oldestMsgTimestampMs.high >>> 0).toNumber() : message.oldestMsgTimestampMs; + return object; + }; + + /** + * Converts this HistorySyncOnDemandRequest to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestMessage.HistorySyncOnDemandRequest + * @instance + * @returns {Object.} JSON object + */ + HistorySyncOnDemandRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HistorySyncOnDemandRequest; + })(); + + PeerDataOperationRequestMessage.RequestStickerReupload = (function() { + + /** + * Properties of a RequestStickerReupload. + * @memberof proto.Message.PeerDataOperationRequestMessage + * @interface IRequestStickerReupload + * @property {string|null} [fileSha256] RequestStickerReupload fileSha256 + */ + + /** + * Constructs a new RequestStickerReupload. + * @memberof proto.Message.PeerDataOperationRequestMessage + * @classdesc Represents a RequestStickerReupload. + * @implements IRequestStickerReupload + * @constructor + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload=} [properties] Properties to set + */ + function RequestStickerReupload(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestStickerReupload fileSha256. + * @member {string} fileSha256 + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @instance + */ + RequestStickerReupload.prototype.fileSha256 = ""; + + /** + * Creates a new RequestStickerReupload instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload} RequestStickerReupload instance + */ + RequestStickerReupload.create = function create(properties) { + return new RequestStickerReupload(properties); + }; + + /** + * Encodes the specified RequestStickerReupload message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload} message RequestStickerReupload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestStickerReupload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fileSha256); + return writer; + }; + + /** + * Encodes the specified RequestStickerReupload message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestStickerReupload} message RequestStickerReupload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestStickerReupload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestStickerReupload message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload} RequestStickerReupload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestStickerReupload.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fileSha256 = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestStickerReupload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload} RequestStickerReupload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestStickerReupload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestStickerReupload message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestStickerReupload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!$util.isString(message.fileSha256)) + return "fileSha256: string expected"; + return null; + }; + + /** + * Creates a RequestStickerReupload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload} RequestStickerReupload + */ + RequestStickerReupload.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload(); + if (object.fileSha256 != null) + message.fileSha256 = String(object.fileSha256); + return message; + }; + + /** + * Creates a plain object from a RequestStickerReupload message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload} message RequestStickerReupload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestStickerReupload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.fileSha256 = ""; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = message.fileSha256; + return object; + }; + + /** + * Converts this RequestStickerReupload to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestStickerReupload + * @instance + * @returns {Object.} JSON object + */ + RequestStickerReupload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestStickerReupload; + })(); + + PeerDataOperationRequestMessage.RequestUrlPreview = (function() { + + /** + * Properties of a RequestUrlPreview. + * @memberof proto.Message.PeerDataOperationRequestMessage + * @interface IRequestUrlPreview + * @property {string|null} [url] RequestUrlPreview url + */ + + /** + * Constructs a new RequestUrlPreview. + * @memberof proto.Message.PeerDataOperationRequestMessage + * @classdesc Represents a RequestUrlPreview. + * @implements IRequestUrlPreview + * @constructor + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview=} [properties] Properties to set + */ + function RequestUrlPreview(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestUrlPreview url. + * @member {string} url + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @instance + */ + RequestUrlPreview.prototype.url = ""; + + /** + * Creates a new RequestUrlPreview instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview} RequestUrlPreview instance + */ + RequestUrlPreview.create = function create(properties) { + return new RequestUrlPreview(properties); + }; + + /** + * Encodes the specified RequestUrlPreview message. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview} message RequestUrlPreview message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestUrlPreview.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + return writer; + }; + + /** + * Encodes the specified RequestUrlPreview message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.IRequestUrlPreview} message RequestUrlPreview message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestUrlPreview.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestUrlPreview message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview} RequestUrlPreview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestUrlPreview.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestUrlPreview message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview} RequestUrlPreview + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestUrlPreview.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestUrlPreview message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestUrlPreview.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + return null; + }; + + /** + * Creates a RequestUrlPreview message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview} RequestUrlPreview + */ + RequestUrlPreview.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview(); + if (object.url != null) + message.url = String(object.url); + return message; + }; + + /** + * Creates a plain object from a RequestUrlPreview message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @static + * @param {proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview} message RequestUrlPreview + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestUrlPreview.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.url = ""; + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + return object; + }; + + /** + * Converts this RequestUrlPreview to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestMessage.RequestUrlPreview + * @instance + * @returns {Object.} JSON object + */ + RequestUrlPreview.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestUrlPreview; + })(); + + return PeerDataOperationRequestMessage; + })(); + + Message.PeerDataOperationRequestResponseMessage = (function() { + + /** + * Properties of a PeerDataOperationRequestResponseMessage. + * @memberof proto.Message + * @interface IPeerDataOperationRequestResponseMessage + * @property {proto.Message.PeerDataOperationRequestType|null} [peerDataOperationRequestType] PeerDataOperationRequestResponseMessage peerDataOperationRequestType + * @property {string|null} [stanzaId] PeerDataOperationRequestResponseMessage stanzaId + * @property {Array.|null} [peerDataOperationResult] PeerDataOperationRequestResponseMessage peerDataOperationResult + */ + + /** + * Constructs a new PeerDataOperationRequestResponseMessage. + * @memberof proto.Message + * @classdesc Represents a PeerDataOperationRequestResponseMessage. + * @implements IPeerDataOperationRequestResponseMessage + * @constructor + * @param {proto.Message.IPeerDataOperationRequestResponseMessage=} [properties] Properties to set + */ + function PeerDataOperationRequestResponseMessage(properties) { + this.peerDataOperationResult = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PeerDataOperationRequestResponseMessage peerDataOperationRequestType. + * @member {proto.Message.PeerDataOperationRequestType} peerDataOperationRequestType + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @instance + */ + PeerDataOperationRequestResponseMessage.prototype.peerDataOperationRequestType = 0; + + /** + * PeerDataOperationRequestResponseMessage stanzaId. + * @member {string} stanzaId + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @instance + */ + PeerDataOperationRequestResponseMessage.prototype.stanzaId = ""; + + /** + * PeerDataOperationRequestResponseMessage peerDataOperationResult. + * @member {Array.} peerDataOperationResult + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @instance + */ + PeerDataOperationRequestResponseMessage.prototype.peerDataOperationResult = $util.emptyArray; + + /** + * Creates a new PeerDataOperationRequestResponseMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {proto.Message.IPeerDataOperationRequestResponseMessage=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestResponseMessage} PeerDataOperationRequestResponseMessage instance + */ + PeerDataOperationRequestResponseMessage.create = function create(properties) { + return new PeerDataOperationRequestResponseMessage(properties); + }; + + /** + * Encodes the specified PeerDataOperationRequestResponseMessage message. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {proto.Message.IPeerDataOperationRequestResponseMessage} message PeerDataOperationRequestResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeerDataOperationRequestResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.peerDataOperationRequestType != null && Object.hasOwnProperty.call(message, "peerDataOperationRequestType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.peerDataOperationRequestType); + if (message.stanzaId != null && Object.hasOwnProperty.call(message, "stanzaId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stanzaId); + if (message.peerDataOperationResult != null && message.peerDataOperationResult.length) + for (var i = 0; i < message.peerDataOperationResult.length; ++i) + $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.encode(message.peerDataOperationResult[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PeerDataOperationRequestResponseMessage message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {proto.Message.IPeerDataOperationRequestResponseMessage} message PeerDataOperationRequestResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeerDataOperationRequestResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PeerDataOperationRequestResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestResponseMessage} PeerDataOperationRequestResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeerDataOperationRequestResponseMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.peerDataOperationRequestType = reader.int32(); + break; + case 2: + message.stanzaId = reader.string(); + break; + case 3: + if (!(message.peerDataOperationResult && message.peerDataOperationResult.length)) + message.peerDataOperationResult = []; + message.peerDataOperationResult.push($root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PeerDataOperationRequestResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestResponseMessage} PeerDataOperationRequestResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeerDataOperationRequestResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PeerDataOperationRequestResponseMessage message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PeerDataOperationRequestResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.peerDataOperationRequestType != null && message.hasOwnProperty("peerDataOperationRequestType")) + switch (message.peerDataOperationRequestType) { + default: + return "peerDataOperationRequestType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + if (!$util.isString(message.stanzaId)) + return "stanzaId: string expected"; + if (message.peerDataOperationResult != null && message.hasOwnProperty("peerDataOperationResult")) { + if (!Array.isArray(message.peerDataOperationResult)) + return "peerDataOperationResult: array expected"; + for (var i = 0; i < message.peerDataOperationResult.length; ++i) { + var error = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.verify(message.peerDataOperationResult[i]); + if (error) + return "peerDataOperationResult." + error; + } + } + return null; + }; + + /** + * Creates a PeerDataOperationRequestResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestResponseMessage} PeerDataOperationRequestResponseMessage + */ + PeerDataOperationRequestResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestResponseMessage) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestResponseMessage(); + switch (object.peerDataOperationRequestType) { + case "UPLOAD_STICKER": + case 0: + message.peerDataOperationRequestType = 0; + break; + case "SEND_RECENT_STICKER_BOOTSTRAP": + case 1: + message.peerDataOperationRequestType = 1; + break; + case "GENERATE_LINK_PREVIEW": + case 2: + message.peerDataOperationRequestType = 2; + break; + case "HISTORY_SYNC_ON_DEMAND": + case 3: + message.peerDataOperationRequestType = 3; + break; + } + if (object.stanzaId != null) + message.stanzaId = String(object.stanzaId); + if (object.peerDataOperationResult) { + if (!Array.isArray(object.peerDataOperationResult)) + throw TypeError(".proto.Message.PeerDataOperationRequestResponseMessage.peerDataOperationResult: array expected"); + message.peerDataOperationResult = []; + for (var i = 0; i < object.peerDataOperationResult.length; ++i) { + if (typeof object.peerDataOperationResult[i] !== "object") + throw TypeError(".proto.Message.PeerDataOperationRequestResponseMessage.peerDataOperationResult: object expected"); + message.peerDataOperationResult[i] = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.fromObject(object.peerDataOperationResult[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PeerDataOperationRequestResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage} message PeerDataOperationRequestResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PeerDataOperationRequestResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.peerDataOperationResult = []; + if (options.defaults) { + object.peerDataOperationRequestType = options.enums === String ? "UPLOAD_STICKER" : 0; + object.stanzaId = ""; + } + if (message.peerDataOperationRequestType != null && message.hasOwnProperty("peerDataOperationRequestType")) + object.peerDataOperationRequestType = options.enums === String ? $root.proto.Message.PeerDataOperationRequestType[message.peerDataOperationRequestType] : message.peerDataOperationRequestType; + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + object.stanzaId = message.stanzaId; + if (message.peerDataOperationResult && message.peerDataOperationResult.length) { + object.peerDataOperationResult = []; + for (var j = 0; j < message.peerDataOperationResult.length; ++j) + object.peerDataOperationResult[j] = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.toObject(message.peerDataOperationResult[j], options); + } + return object; + }; + + /** + * Converts this PeerDataOperationRequestResponseMessage to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @instance + * @returns {Object.} JSON object + */ + PeerDataOperationRequestResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PeerDataOperationRequestResponseMessage.PeerDataOperationResult = (function() { + + /** + * Properties of a PeerDataOperationResult. + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @interface IPeerDataOperationResult + * @property {proto.MediaRetryNotification.ResultType|null} [mediaUploadResult] PeerDataOperationResult mediaUploadResult + * @property {proto.Message.IStickerMessage|null} [stickerMessage] PeerDataOperationResult stickerMessage + * @property {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse|null} [linkPreviewResponse] PeerDataOperationResult linkPreviewResponse + */ + + /** + * Constructs a new PeerDataOperationResult. + * @memberof proto.Message.PeerDataOperationRequestResponseMessage + * @classdesc Represents a PeerDataOperationResult. + * @implements IPeerDataOperationResult + * @constructor + * @param {proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult=} [properties] Properties to set + */ + function PeerDataOperationResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PeerDataOperationResult mediaUploadResult. + * @member {proto.MediaRetryNotification.ResultType} mediaUploadResult + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @instance + */ + PeerDataOperationResult.prototype.mediaUploadResult = 0; + + /** + * PeerDataOperationResult stickerMessage. + * @member {proto.Message.IStickerMessage|null|undefined} stickerMessage + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @instance + */ + PeerDataOperationResult.prototype.stickerMessage = null; + + /** + * PeerDataOperationResult linkPreviewResponse. + * @member {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse|null|undefined} linkPreviewResponse + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @instance + */ + PeerDataOperationResult.prototype.linkPreviewResponse = null; + + /** + * Creates a new PeerDataOperationResult instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult} PeerDataOperationResult instance + */ + PeerDataOperationResult.create = function create(properties) { + return new PeerDataOperationResult(properties); + }; + + /** + * Encodes the specified PeerDataOperationResult message. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult} message PeerDataOperationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeerDataOperationResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mediaUploadResult != null && Object.hasOwnProperty.call(message, "mediaUploadResult")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mediaUploadResult); + if (message.stickerMessage != null && Object.hasOwnProperty.call(message, "stickerMessage")) + $root.proto.Message.StickerMessage.encode(message.stickerMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.linkPreviewResponse != null && Object.hasOwnProperty.call(message, "linkPreviewResponse")) + $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.encode(message.linkPreviewResponse, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PeerDataOperationResult message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult} message PeerDataOperationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PeerDataOperationResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PeerDataOperationResult message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult} PeerDataOperationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeerDataOperationResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mediaUploadResult = reader.int32(); + break; + case 2: + message.stickerMessage = $root.proto.Message.StickerMessage.decode(reader, reader.uint32()); + break; + case 3: + message.linkPreviewResponse = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PeerDataOperationResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult} PeerDataOperationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PeerDataOperationResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PeerDataOperationResult message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PeerDataOperationResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mediaUploadResult != null && message.hasOwnProperty("mediaUploadResult")) + switch (message.mediaUploadResult) { + default: + return "mediaUploadResult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.stickerMessage != null && message.hasOwnProperty("stickerMessage")) { + var error = $root.proto.Message.StickerMessage.verify(message.stickerMessage); + if (error) + return "stickerMessage." + error; + } + if (message.linkPreviewResponse != null && message.hasOwnProperty("linkPreviewResponse")) { + var error = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.verify(message.linkPreviewResponse); + if (error) + return "linkPreviewResponse." + error; + } + return null; + }; + + /** + * Creates a PeerDataOperationResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult} PeerDataOperationResult + */ + PeerDataOperationResult.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult(); + switch (object.mediaUploadResult) { + case "GENERAL_ERROR": + case 0: + message.mediaUploadResult = 0; + break; + case "SUCCESS": + case 1: + message.mediaUploadResult = 1; + break; + case "NOT_FOUND": + case 2: + message.mediaUploadResult = 2; + break; + case "DECRYPTION_ERROR": + case 3: + message.mediaUploadResult = 3; + break; + } + if (object.stickerMessage != null) { + if (typeof object.stickerMessage !== "object") + throw TypeError(".proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.stickerMessage: object expected"); + message.stickerMessage = $root.proto.Message.StickerMessage.fromObject(object.stickerMessage); + } + if (object.linkPreviewResponse != null) { + if (typeof object.linkPreviewResponse !== "object") + throw TypeError(".proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.linkPreviewResponse: object expected"); + message.linkPreviewResponse = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.fromObject(object.linkPreviewResponse); + } + return message; + }; + + /** + * Creates a plain object from a PeerDataOperationResult message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult} message PeerDataOperationResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PeerDataOperationResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.mediaUploadResult = options.enums === String ? "GENERAL_ERROR" : 0; + object.stickerMessage = null; + object.linkPreviewResponse = null; + } + if (message.mediaUploadResult != null && message.hasOwnProperty("mediaUploadResult")) + object.mediaUploadResult = options.enums === String ? $root.proto.MediaRetryNotification.ResultType[message.mediaUploadResult] : message.mediaUploadResult; + if (message.stickerMessage != null && message.hasOwnProperty("stickerMessage")) + object.stickerMessage = $root.proto.Message.StickerMessage.toObject(message.stickerMessage, options); + if (message.linkPreviewResponse != null && message.hasOwnProperty("linkPreviewResponse")) + object.linkPreviewResponse = $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.toObject(message.linkPreviewResponse, options); + return object; + }; + + /** + * Converts this PeerDataOperationResult to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @instance + * @returns {Object.} JSON object + */ + PeerDataOperationResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PeerDataOperationResult.LinkPreviewResponse = (function() { + + /** + * Properties of a LinkPreviewResponse. + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @interface ILinkPreviewResponse + * @property {string|null} [url] LinkPreviewResponse url + * @property {string|null} [title] LinkPreviewResponse title + * @property {string|null} [description] LinkPreviewResponse description + * @property {Uint8Array|null} [thumbData] LinkPreviewResponse thumbData + * @property {string|null} [canonicalUrl] LinkPreviewResponse canonicalUrl + * @property {string|null} [matchText] LinkPreviewResponse matchText + * @property {string|null} [previewType] LinkPreviewResponse previewType + */ + + /** + * Constructs a new LinkPreviewResponse. + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + * @classdesc Represents a LinkPreviewResponse. + * @implements ILinkPreviewResponse + * @constructor + * @param {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse=} [properties] Properties to set + */ + function LinkPreviewResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LinkPreviewResponse url. + * @member {string} url + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.url = ""; + + /** + * LinkPreviewResponse title. + * @member {string} title + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.title = ""; + + /** + * LinkPreviewResponse description. + * @member {string} description + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.description = ""; + + /** + * LinkPreviewResponse thumbData. + * @member {Uint8Array} thumbData + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.thumbData = $util.newBuffer([]); + + /** + * LinkPreviewResponse canonicalUrl. + * @member {string} canonicalUrl + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.canonicalUrl = ""; + + /** + * LinkPreviewResponse matchText. + * @member {string} matchText + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.matchText = ""; + + /** + * LinkPreviewResponse previewType. + * @member {string} previewType + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + */ + LinkPreviewResponse.prototype.previewType = ""; + + /** + * Creates a new LinkPreviewResponse instance using the specified properties. + * @function create + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse=} [properties] Properties to set + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse} LinkPreviewResponse instance + */ + LinkPreviewResponse.create = function create(properties) { + return new LinkPreviewResponse(properties); + }; + + /** + * Encodes the specified LinkPreviewResponse message. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.verify|verify} messages. + * @function encode + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse} message LinkPreviewResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkPreviewResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.thumbData != null && Object.hasOwnProperty.call(message, "thumbData")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.thumbData); + if (message.canonicalUrl != null && Object.hasOwnProperty.call(message, "canonicalUrl")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.canonicalUrl); + if (message.matchText != null && Object.hasOwnProperty.call(message, "matchText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.matchText); + if (message.previewType != null && Object.hasOwnProperty.call(message, "previewType")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.previewType); + return writer; + }; + + /** + * Encodes the specified LinkPreviewResponse message, length delimited. Does not implicitly {@link proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ILinkPreviewResponse} message LinkPreviewResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkPreviewResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkPreviewResponse message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse} LinkPreviewResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkPreviewResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.title = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.thumbData = reader.bytes(); + break; + case 5: + message.canonicalUrl = reader.string(); + break; + case 6: + message.matchText = reader.string(); + break; + case 7: + message.previewType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkPreviewResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse} LinkPreviewResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkPreviewResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkPreviewResponse message. + * @function verify + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkPreviewResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.thumbData != null && message.hasOwnProperty("thumbData")) + if (!(message.thumbData && typeof message.thumbData.length === "number" || $util.isString(message.thumbData))) + return "thumbData: buffer expected"; + if (message.canonicalUrl != null && message.hasOwnProperty("canonicalUrl")) + if (!$util.isString(message.canonicalUrl)) + return "canonicalUrl: string expected"; + if (message.matchText != null && message.hasOwnProperty("matchText")) + if (!$util.isString(message.matchText)) + return "matchText: string expected"; + if (message.previewType != null && message.hasOwnProperty("previewType")) + if (!$util.isString(message.previewType)) + return "previewType: string expected"; + return null; + }; + + /** + * Creates a LinkPreviewResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse} LinkPreviewResponse + */ + LinkPreviewResponse.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse) + return object; + var message = new $root.proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse(); + if (object.url != null) + message.url = String(object.url); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.thumbData != null) + if (typeof object.thumbData === "string") + $util.base64.decode(object.thumbData, message.thumbData = $util.newBuffer($util.base64.length(object.thumbData)), 0); + else if (object.thumbData.length) + message.thumbData = object.thumbData; + if (object.canonicalUrl != null) + message.canonicalUrl = String(object.canonicalUrl); + if (object.matchText != null) + message.matchText = String(object.matchText); + if (object.previewType != null) + message.previewType = String(object.previewType); + return message; + }; + + /** + * Creates a plain object from a LinkPreviewResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @static + * @param {proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse} message LinkPreviewResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkPreviewResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.title = ""; + object.description = ""; + if (options.bytes === String) + object.thumbData = ""; + else { + object.thumbData = []; + if (options.bytes !== Array) + object.thumbData = $util.newBuffer(object.thumbData); + } + object.canonicalUrl = ""; + object.matchText = ""; + object.previewType = ""; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.thumbData != null && message.hasOwnProperty("thumbData")) + object.thumbData = options.bytes === String ? $util.base64.encode(message.thumbData, 0, message.thumbData.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbData) : message.thumbData; + if (message.canonicalUrl != null && message.hasOwnProperty("canonicalUrl")) + object.canonicalUrl = message.canonicalUrl; + if (message.matchText != null && message.hasOwnProperty("matchText")) + object.matchText = message.matchText; + if (message.previewType != null && message.hasOwnProperty("previewType")) + object.previewType = message.previewType; + return object; + }; + + /** + * Converts this LinkPreviewResponse to JSON. + * @function toJSON + * @memberof proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + * @instance + * @returns {Object.} JSON object + */ + LinkPreviewResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LinkPreviewResponse; + })(); + + return PeerDataOperationResult; + })(); + + return PeerDataOperationRequestResponseMessage; + })(); + + /** + * PeerDataOperationRequestType enum. + * @name proto.Message.PeerDataOperationRequestType + * @enum {number} + * @property {number} UPLOAD_STICKER=0 UPLOAD_STICKER value + * @property {number} SEND_RECENT_STICKER_BOOTSTRAP=1 SEND_RECENT_STICKER_BOOTSTRAP value + * @property {number} GENERATE_LINK_PREVIEW=2 GENERATE_LINK_PREVIEW value + * @property {number} HISTORY_SYNC_ON_DEMAND=3 HISTORY_SYNC_ON_DEMAND value + */ + Message.PeerDataOperationRequestType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UPLOAD_STICKER"] = 0; + values[valuesById[1] = "SEND_RECENT_STICKER_BOOTSTRAP"] = 1; + values[valuesById[2] = "GENERATE_LINK_PREVIEW"] = 2; + values[valuesById[3] = "HISTORY_SYNC_ON_DEMAND"] = 3; + return values; + })(); + + Message.PinMessage = (function() { + + /** + * Properties of a PinMessage. + * @memberof proto.Message + * @interface IPinMessage + * @property {proto.IMessageKey|null} [key] PinMessage key + * @property {proto.Message.PinMessage.PinMessageType|null} [pinMessageType] PinMessage pinMessageType + * @property {number|Long|null} [senderTimestampMs] PinMessage senderTimestampMs + */ + + /** + * Constructs a new PinMessage. + * @memberof proto.Message + * @classdesc Represents a PinMessage. + * @implements IPinMessage + * @constructor + * @param {proto.Message.IPinMessage=} [properties] Properties to set + */ + function PinMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PinMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.PinMessage + * @instance + */ + PinMessage.prototype.key = null; + + /** + * PinMessage pinMessageType. + * @member {proto.Message.PinMessage.PinMessageType} pinMessageType + * @memberof proto.Message.PinMessage + * @instance + */ + PinMessage.prototype.pinMessageType = 0; + + /** + * PinMessage senderTimestampMs. + * @member {number|Long} senderTimestampMs + * @memberof proto.Message.PinMessage + * @instance + */ + PinMessage.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PinMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PinMessage + * @static + * @param {proto.Message.IPinMessage=} [properties] Properties to set + * @returns {proto.Message.PinMessage} PinMessage instance + */ + PinMessage.create = function create(properties) { + return new PinMessage(properties); + }; + + /** + * Encodes the specified PinMessage message. Does not implicitly {@link proto.Message.PinMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PinMessage + * @static + * @param {proto.Message.IPinMessage} message PinMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PinMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pinMessageType != null && Object.hasOwnProperty.call(message, "pinMessageType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pinMessageType); + if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.senderTimestampMs); + return writer; + }; + + /** + * Encodes the specified PinMessage message, length delimited. Does not implicitly {@link proto.Message.PinMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PinMessage + * @static + * @param {proto.Message.IPinMessage} message PinMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PinMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PinMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PinMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PinMessage} PinMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PinMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PinMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.pinMessageType = reader.int32(); + break; + case 3: + message.senderTimestampMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PinMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PinMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PinMessage} PinMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PinMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PinMessage message. + * @function verify + * @memberof proto.Message.PinMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PinMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.pinMessageType != null && message.hasOwnProperty("pinMessageType")) + switch (message.pinMessageType) { + default: + return "pinMessageType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high))) + return "senderTimestampMs: integer|Long expected"; + return null; + }; + + /** + * Creates a PinMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PinMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PinMessage} PinMessage + */ + PinMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PinMessage) + return object; + var message = new $root.proto.Message.PinMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.PinMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + switch (object.pinMessageType) { + case "UNKNOWN_PIN_MESSAGE_TYPE": + case 0: + message.pinMessageType = 0; + break; + case "PIN_FOR_ALL": + case 1: + message.pinMessageType = 1; + break; + case "UNPIN_FOR_ALL": + case 2: + message.pinMessageType = 2; + break; + } + if (object.senderTimestampMs != null) + if ($util.Long) + (message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false; + else if (typeof object.senderTimestampMs === "string") + message.senderTimestampMs = parseInt(object.senderTimestampMs, 10); + else if (typeof object.senderTimestampMs === "number") + message.senderTimestampMs = object.senderTimestampMs; + else if (typeof object.senderTimestampMs === "object") + message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PinMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PinMessage + * @static + * @param {proto.Message.PinMessage} message PinMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PinMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.pinMessageType = options.enums === String ? "UNKNOWN_PIN_MESSAGE_TYPE" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.senderTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestampMs = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.pinMessageType != null && message.hasOwnProperty("pinMessageType")) + object.pinMessageType = options.enums === String ? $root.proto.Message.PinMessage.PinMessageType[message.pinMessageType] : message.pinMessageType; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (typeof message.senderTimestampMs === "number") + object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs; + else + object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs; + return object; + }; + + /** + * Converts this PinMessage to JSON. + * @function toJSON + * @memberof proto.Message.PinMessage + * @instance + * @returns {Object.} JSON object + */ + PinMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * PinMessageType enum. + * @name proto.Message.PinMessage.PinMessageType + * @enum {number} + * @property {number} UNKNOWN_PIN_MESSAGE_TYPE=0 UNKNOWN_PIN_MESSAGE_TYPE value + * @property {number} PIN_FOR_ALL=1 PIN_FOR_ALL value + * @property {number} UNPIN_FOR_ALL=2 UNPIN_FOR_ALL value + */ + PinMessage.PinMessageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_PIN_MESSAGE_TYPE"] = 0; + values[valuesById[1] = "PIN_FOR_ALL"] = 1; + values[valuesById[2] = "UNPIN_FOR_ALL"] = 2; + return values; + })(); + + return PinMessage; + })(); + + Message.PollCreationMessage = (function() { + + /** + * Properties of a PollCreationMessage. + * @memberof proto.Message + * @interface IPollCreationMessage + * @property {Uint8Array|null} [encKey] PollCreationMessage encKey + * @property {string|null} [name] PollCreationMessage name + * @property {Array.|null} [options] PollCreationMessage options + * @property {number|null} [selectableOptionsCount] PollCreationMessage selectableOptionsCount + * @property {proto.IContextInfo|null} [contextInfo] PollCreationMessage contextInfo + */ + + /** + * Constructs a new PollCreationMessage. + * @memberof proto.Message + * @classdesc Represents a PollCreationMessage. + * @implements IPollCreationMessage + * @constructor + * @param {proto.Message.IPollCreationMessage=} [properties] Properties to set + */ + function PollCreationMessage(properties) { + this.options = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollCreationMessage encKey. + * @member {Uint8Array} encKey + * @memberof proto.Message.PollCreationMessage + * @instance + */ + PollCreationMessage.prototype.encKey = $util.newBuffer([]); + + /** + * PollCreationMessage name. + * @member {string} name + * @memberof proto.Message.PollCreationMessage + * @instance + */ + PollCreationMessage.prototype.name = ""; + + /** + * PollCreationMessage options. + * @member {Array.} options + * @memberof proto.Message.PollCreationMessage + * @instance + */ + PollCreationMessage.prototype.options = $util.emptyArray; + + /** + * PollCreationMessage selectableOptionsCount. + * @member {number} selectableOptionsCount + * @memberof proto.Message.PollCreationMessage + * @instance + */ + PollCreationMessage.prototype.selectableOptionsCount = 0; + + /** + * PollCreationMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.PollCreationMessage + * @instance + */ + PollCreationMessage.prototype.contextInfo = null; + + /** + * Creates a new PollCreationMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PollCreationMessage + * @static + * @param {proto.Message.IPollCreationMessage=} [properties] Properties to set + * @returns {proto.Message.PollCreationMessage} PollCreationMessage instance + */ + PollCreationMessage.create = function create(properties) { + return new PollCreationMessage(properties); + }; + + /** + * Encodes the specified PollCreationMessage message. Does not implicitly {@link proto.Message.PollCreationMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PollCreationMessage + * @static + * @param {proto.Message.IPollCreationMessage} message PollCreationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollCreationMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.encKey != null && Object.hasOwnProperty.call(message, "encKey")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.encKey); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + if (message.options != null && message.options.length) + for (var i = 0; i < message.options.length; ++i) + $root.proto.Message.PollCreationMessage.Option.encode(message.options[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.selectableOptionsCount != null && Object.hasOwnProperty.call(message, "selectableOptionsCount")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.selectableOptionsCount); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PollCreationMessage message, length delimited. Does not implicitly {@link proto.Message.PollCreationMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PollCreationMessage + * @static + * @param {proto.Message.IPollCreationMessage} message PollCreationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollCreationMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollCreationMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PollCreationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PollCreationMessage} PollCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollCreationMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PollCreationMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.encKey = reader.bytes(); + break; + case 2: + message.name = reader.string(); + break; + case 3: + if (!(message.options && message.options.length)) + message.options = []; + message.options.push($root.proto.Message.PollCreationMessage.Option.decode(reader, reader.uint32())); + break; + case 4: + message.selectableOptionsCount = reader.uint32(); + break; + case 5: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollCreationMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PollCreationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PollCreationMessage} PollCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollCreationMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollCreationMessage message. + * @function verify + * @memberof proto.Message.PollCreationMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollCreationMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.encKey != null && message.hasOwnProperty("encKey")) + if (!(message.encKey && typeof message.encKey.length === "number" || $util.isString(message.encKey))) + return "encKey: buffer expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + if (!Array.isArray(message.options)) + return "options: array expected"; + for (var i = 0; i < message.options.length; ++i) { + var error = $root.proto.Message.PollCreationMessage.Option.verify(message.options[i]); + if (error) + return "options." + error; + } + } + if (message.selectableOptionsCount != null && message.hasOwnProperty("selectableOptionsCount")) + if (!$util.isInteger(message.selectableOptionsCount)) + return "selectableOptionsCount: integer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a PollCreationMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PollCreationMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PollCreationMessage} PollCreationMessage + */ + PollCreationMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PollCreationMessage) + return object; + var message = new $root.proto.Message.PollCreationMessage(); + if (object.encKey != null) + if (typeof object.encKey === "string") + $util.base64.decode(object.encKey, message.encKey = $util.newBuffer($util.base64.length(object.encKey)), 0); + else if (object.encKey.length) + message.encKey = object.encKey; + if (object.name != null) + message.name = String(object.name); + if (object.options) { + if (!Array.isArray(object.options)) + throw TypeError(".proto.Message.PollCreationMessage.options: array expected"); + message.options = []; + for (var i = 0; i < object.options.length; ++i) { + if (typeof object.options[i] !== "object") + throw TypeError(".proto.Message.PollCreationMessage.options: object expected"); + message.options[i] = $root.proto.Message.PollCreationMessage.Option.fromObject(object.options[i]); + } + } + if (object.selectableOptionsCount != null) + message.selectableOptionsCount = object.selectableOptionsCount >>> 0; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.PollCreationMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a PollCreationMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PollCreationMessage + * @static + * @param {proto.Message.PollCreationMessage} message PollCreationMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollCreationMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.options = []; + if (options.defaults) { + if (options.bytes === String) + object.encKey = ""; + else { + object.encKey = []; + if (options.bytes !== Array) + object.encKey = $util.newBuffer(object.encKey); + } + object.name = ""; + object.selectableOptionsCount = 0; + object.contextInfo = null; + } + if (message.encKey != null && message.hasOwnProperty("encKey")) + object.encKey = options.bytes === String ? $util.base64.encode(message.encKey, 0, message.encKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.encKey) : message.encKey; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options && message.options.length) { + object.options = []; + for (var j = 0; j < message.options.length; ++j) + object.options[j] = $root.proto.Message.PollCreationMessage.Option.toObject(message.options[j], options); + } + if (message.selectableOptionsCount != null && message.hasOwnProperty("selectableOptionsCount")) + object.selectableOptionsCount = message.selectableOptionsCount; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this PollCreationMessage to JSON. + * @function toJSON + * @memberof proto.Message.PollCreationMessage + * @instance + * @returns {Object.} JSON object + */ + PollCreationMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PollCreationMessage.Option = (function() { + + /** + * Properties of an Option. + * @memberof proto.Message.PollCreationMessage + * @interface IOption + * @property {string|null} [optionName] Option optionName + */ + + /** + * Constructs a new Option. + * @memberof proto.Message.PollCreationMessage + * @classdesc Represents an Option. + * @implements IOption + * @constructor + * @param {proto.Message.PollCreationMessage.IOption=} [properties] Properties to set + */ + function Option(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Option optionName. + * @member {string} optionName + * @memberof proto.Message.PollCreationMessage.Option + * @instance + */ + Option.prototype.optionName = ""; + + /** + * Creates a new Option instance using the specified properties. + * @function create + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {proto.Message.PollCreationMessage.IOption=} [properties] Properties to set + * @returns {proto.Message.PollCreationMessage.Option} Option instance + */ + Option.create = function create(properties) { + return new Option(properties); + }; + + /** + * Encodes the specified Option message. Does not implicitly {@link proto.Message.PollCreationMessage.Option.verify|verify} messages. + * @function encode + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {proto.Message.PollCreationMessage.IOption} message Option message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Option.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.optionName != null && Object.hasOwnProperty.call(message, "optionName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.optionName); + return writer; + }; + + /** + * Encodes the specified Option message, length delimited. Does not implicitly {@link proto.Message.PollCreationMessage.Option.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {proto.Message.PollCreationMessage.IOption} message Option message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Option.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Option message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PollCreationMessage.Option} Option + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Option.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PollCreationMessage.Option(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.optionName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Option message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PollCreationMessage.Option} Option + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Option.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Option message. + * @function verify + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Option.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.optionName != null && message.hasOwnProperty("optionName")) + if (!$util.isString(message.optionName)) + return "optionName: string expected"; + return null; + }; + + /** + * Creates an Option message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PollCreationMessage.Option} Option + */ + Option.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PollCreationMessage.Option) + return object; + var message = new $root.proto.Message.PollCreationMessage.Option(); + if (object.optionName != null) + message.optionName = String(object.optionName); + return message; + }; + + /** + * Creates a plain object from an Option message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PollCreationMessage.Option + * @static + * @param {proto.Message.PollCreationMessage.Option} message Option + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Option.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.optionName = ""; + if (message.optionName != null && message.hasOwnProperty("optionName")) + object.optionName = message.optionName; + return object; + }; + + /** + * Converts this Option to JSON. + * @function toJSON + * @memberof proto.Message.PollCreationMessage.Option + * @instance + * @returns {Object.} JSON object + */ + Option.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Option; + })(); + + return PollCreationMessage; + })(); + + Message.PollEncValue = (function() { + + /** + * Properties of a PollEncValue. + * @memberof proto.Message + * @interface IPollEncValue + * @property {Uint8Array|null} [encPayload] PollEncValue encPayload + * @property {Uint8Array|null} [encIv] PollEncValue encIv + */ + + /** + * Constructs a new PollEncValue. + * @memberof proto.Message + * @classdesc Represents a PollEncValue. + * @implements IPollEncValue + * @constructor + * @param {proto.Message.IPollEncValue=} [properties] Properties to set + */ + function PollEncValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollEncValue encPayload. + * @member {Uint8Array} encPayload + * @memberof proto.Message.PollEncValue + * @instance + */ + PollEncValue.prototype.encPayload = $util.newBuffer([]); + + /** + * PollEncValue encIv. + * @member {Uint8Array} encIv + * @memberof proto.Message.PollEncValue + * @instance + */ + PollEncValue.prototype.encIv = $util.newBuffer([]); + + /** + * Creates a new PollEncValue instance using the specified properties. + * @function create + * @memberof proto.Message.PollEncValue + * @static + * @param {proto.Message.IPollEncValue=} [properties] Properties to set + * @returns {proto.Message.PollEncValue} PollEncValue instance + */ + PollEncValue.create = function create(properties) { + return new PollEncValue(properties); + }; + + /** + * Encodes the specified PollEncValue message. Does not implicitly {@link proto.Message.PollEncValue.verify|verify} messages. + * @function encode + * @memberof proto.Message.PollEncValue + * @static + * @param {proto.Message.IPollEncValue} message PollEncValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollEncValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.encPayload != null && Object.hasOwnProperty.call(message, "encPayload")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.encPayload); + if (message.encIv != null && Object.hasOwnProperty.call(message, "encIv")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.encIv); + return writer; + }; + + /** + * Encodes the specified PollEncValue message, length delimited. Does not implicitly {@link proto.Message.PollEncValue.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PollEncValue + * @static + * @param {proto.Message.IPollEncValue} message PollEncValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollEncValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollEncValue message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PollEncValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PollEncValue} PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollEncValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PollEncValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.encPayload = reader.bytes(); + break; + case 2: + message.encIv = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollEncValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PollEncValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PollEncValue} PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollEncValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollEncValue message. + * @function verify + * @memberof proto.Message.PollEncValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollEncValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.encPayload != null && message.hasOwnProperty("encPayload")) + if (!(message.encPayload && typeof message.encPayload.length === "number" || $util.isString(message.encPayload))) + return "encPayload: buffer expected"; + if (message.encIv != null && message.hasOwnProperty("encIv")) + if (!(message.encIv && typeof message.encIv.length === "number" || $util.isString(message.encIv))) + return "encIv: buffer expected"; + return null; + }; + + /** + * Creates a PollEncValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PollEncValue + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PollEncValue} PollEncValue + */ + PollEncValue.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PollEncValue) + return object; + var message = new $root.proto.Message.PollEncValue(); + if (object.encPayload != null) + if (typeof object.encPayload === "string") + $util.base64.decode(object.encPayload, message.encPayload = $util.newBuffer($util.base64.length(object.encPayload)), 0); + else if (object.encPayload.length) + message.encPayload = object.encPayload; + if (object.encIv != null) + if (typeof object.encIv === "string") + $util.base64.decode(object.encIv, message.encIv = $util.newBuffer($util.base64.length(object.encIv)), 0); + else if (object.encIv.length) + message.encIv = object.encIv; + return message; + }; + + /** + * Creates a plain object from a PollEncValue message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PollEncValue + * @static + * @param {proto.Message.PollEncValue} message PollEncValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollEncValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.encPayload = ""; + else { + object.encPayload = []; + if (options.bytes !== Array) + object.encPayload = $util.newBuffer(object.encPayload); + } + if (options.bytes === String) + object.encIv = ""; + else { + object.encIv = []; + if (options.bytes !== Array) + object.encIv = $util.newBuffer(object.encIv); + } + } + if (message.encPayload != null && message.hasOwnProperty("encPayload")) + object.encPayload = options.bytes === String ? $util.base64.encode(message.encPayload, 0, message.encPayload.length) : options.bytes === Array ? Array.prototype.slice.call(message.encPayload) : message.encPayload; + if (message.encIv != null && message.hasOwnProperty("encIv")) + object.encIv = options.bytes === String ? $util.base64.encode(message.encIv, 0, message.encIv.length) : options.bytes === Array ? Array.prototype.slice.call(message.encIv) : message.encIv; + return object; + }; + + /** + * Converts this PollEncValue to JSON. + * @function toJSON + * @memberof proto.Message.PollEncValue + * @instance + * @returns {Object.} JSON object + */ + PollEncValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollEncValue; + })(); + + Message.PollUpdateMessage = (function() { + + /** + * Properties of a PollUpdateMessage. + * @memberof proto.Message + * @interface IPollUpdateMessage + * @property {proto.IMessageKey|null} [pollCreationMessageKey] PollUpdateMessage pollCreationMessageKey + * @property {proto.Message.IPollEncValue|null} [vote] PollUpdateMessage vote + * @property {proto.Message.IPollUpdateMessageMetadata|null} [metadata] PollUpdateMessage metadata + * @property {number|Long|null} [senderTimestampMs] PollUpdateMessage senderTimestampMs + */ + + /** + * Constructs a new PollUpdateMessage. + * @memberof proto.Message + * @classdesc Represents a PollUpdateMessage. + * @implements IPollUpdateMessage + * @constructor + * @param {proto.Message.IPollUpdateMessage=} [properties] Properties to set + */ + function PollUpdateMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollUpdateMessage pollCreationMessageKey. + * @member {proto.IMessageKey|null|undefined} pollCreationMessageKey + * @memberof proto.Message.PollUpdateMessage + * @instance + */ + PollUpdateMessage.prototype.pollCreationMessageKey = null; + + /** + * PollUpdateMessage vote. + * @member {proto.Message.IPollEncValue|null|undefined} vote + * @memberof proto.Message.PollUpdateMessage + * @instance + */ + PollUpdateMessage.prototype.vote = null; + + /** + * PollUpdateMessage metadata. + * @member {proto.Message.IPollUpdateMessageMetadata|null|undefined} metadata + * @memberof proto.Message.PollUpdateMessage + * @instance + */ + PollUpdateMessage.prototype.metadata = null; + + /** + * PollUpdateMessage senderTimestampMs. + * @member {number|Long} senderTimestampMs + * @memberof proto.Message.PollUpdateMessage + * @instance + */ + PollUpdateMessage.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PollUpdateMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {proto.Message.IPollUpdateMessage=} [properties] Properties to set + * @returns {proto.Message.PollUpdateMessage} PollUpdateMessage instance + */ + PollUpdateMessage.create = function create(properties) { + return new PollUpdateMessage(properties); + }; + + /** + * Encodes the specified PollUpdateMessage message. Does not implicitly {@link proto.Message.PollUpdateMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {proto.Message.IPollUpdateMessage} message PollUpdateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollUpdateMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pollCreationMessageKey != null && Object.hasOwnProperty.call(message, "pollCreationMessageKey")) + $root.proto.MessageKey.encode(message.pollCreationMessageKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.vote != null && Object.hasOwnProperty.call(message, "vote")) + $root.proto.Message.PollEncValue.encode(message.vote, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.proto.Message.PollUpdateMessageMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.senderTimestampMs); + return writer; + }; + + /** + * Encodes the specified PollUpdateMessage message, length delimited. Does not implicitly {@link proto.Message.PollUpdateMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {proto.Message.IPollUpdateMessage} message PollUpdateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollUpdateMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollUpdateMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PollUpdateMessage} PollUpdateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollUpdateMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PollUpdateMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pollCreationMessageKey = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.vote = $root.proto.Message.PollEncValue.decode(reader, reader.uint32()); + break; + case 3: + message.metadata = $root.proto.Message.PollUpdateMessageMetadata.decode(reader, reader.uint32()); + break; + case 4: + message.senderTimestampMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollUpdateMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PollUpdateMessage} PollUpdateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollUpdateMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollUpdateMessage message. + * @function verify + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollUpdateMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pollCreationMessageKey != null && message.hasOwnProperty("pollCreationMessageKey")) { + var error = $root.proto.MessageKey.verify(message.pollCreationMessageKey); + if (error) + return "pollCreationMessageKey." + error; + } + if (message.vote != null && message.hasOwnProperty("vote")) { + var error = $root.proto.Message.PollEncValue.verify(message.vote); + if (error) + return "vote." + error; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.proto.Message.PollUpdateMessageMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high))) + return "senderTimestampMs: integer|Long expected"; + return null; + }; + + /** + * Creates a PollUpdateMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PollUpdateMessage} PollUpdateMessage + */ + PollUpdateMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PollUpdateMessage) + return object; + var message = new $root.proto.Message.PollUpdateMessage(); + if (object.pollCreationMessageKey != null) { + if (typeof object.pollCreationMessageKey !== "object") + throw TypeError(".proto.Message.PollUpdateMessage.pollCreationMessageKey: object expected"); + message.pollCreationMessageKey = $root.proto.MessageKey.fromObject(object.pollCreationMessageKey); + } + if (object.vote != null) { + if (typeof object.vote !== "object") + throw TypeError(".proto.Message.PollUpdateMessage.vote: object expected"); + message.vote = $root.proto.Message.PollEncValue.fromObject(object.vote); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".proto.Message.PollUpdateMessage.metadata: object expected"); + message.metadata = $root.proto.Message.PollUpdateMessageMetadata.fromObject(object.metadata); + } + if (object.senderTimestampMs != null) + if ($util.Long) + (message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false; + else if (typeof object.senderTimestampMs === "string") + message.senderTimestampMs = parseInt(object.senderTimestampMs, 10); + else if (typeof object.senderTimestampMs === "number") + message.senderTimestampMs = object.senderTimestampMs; + else if (typeof object.senderTimestampMs === "object") + message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PollUpdateMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PollUpdateMessage + * @static + * @param {proto.Message.PollUpdateMessage} message PollUpdateMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollUpdateMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pollCreationMessageKey = null; + object.vote = null; + object.metadata = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.senderTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestampMs = options.longs === String ? "0" : 0; + } + if (message.pollCreationMessageKey != null && message.hasOwnProperty("pollCreationMessageKey")) + object.pollCreationMessageKey = $root.proto.MessageKey.toObject(message.pollCreationMessageKey, options); + if (message.vote != null && message.hasOwnProperty("vote")) + object.vote = $root.proto.Message.PollEncValue.toObject(message.vote, options); + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.proto.Message.PollUpdateMessageMetadata.toObject(message.metadata, options); + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (typeof message.senderTimestampMs === "number") + object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs; + else + object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs; + return object; + }; + + /** + * Converts this PollUpdateMessage to JSON. + * @function toJSON + * @memberof proto.Message.PollUpdateMessage + * @instance + * @returns {Object.} JSON object + */ + PollUpdateMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollUpdateMessage; + })(); + + Message.PollUpdateMessageMetadata = (function() { + + /** + * Properties of a PollUpdateMessageMetadata. + * @memberof proto.Message + * @interface IPollUpdateMessageMetadata + */ + + /** + * Constructs a new PollUpdateMessageMetadata. + * @memberof proto.Message + * @classdesc Represents a PollUpdateMessageMetadata. + * @implements IPollUpdateMessageMetadata + * @constructor + * @param {proto.Message.IPollUpdateMessageMetadata=} [properties] Properties to set + */ + function PollUpdateMessageMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new PollUpdateMessageMetadata instance using the specified properties. + * @function create + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {proto.Message.IPollUpdateMessageMetadata=} [properties] Properties to set + * @returns {proto.Message.PollUpdateMessageMetadata} PollUpdateMessageMetadata instance + */ + PollUpdateMessageMetadata.create = function create(properties) { + return new PollUpdateMessageMetadata(properties); + }; + + /** + * Encodes the specified PollUpdateMessageMetadata message. Does not implicitly {@link proto.Message.PollUpdateMessageMetadata.verify|verify} messages. + * @function encode + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {proto.Message.IPollUpdateMessageMetadata} message PollUpdateMessageMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollUpdateMessageMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified PollUpdateMessageMetadata message, length delimited. Does not implicitly {@link proto.Message.PollUpdateMessageMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {proto.Message.IPollUpdateMessageMetadata} message PollUpdateMessageMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollUpdateMessageMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollUpdateMessageMetadata message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PollUpdateMessageMetadata} PollUpdateMessageMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollUpdateMessageMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PollUpdateMessageMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollUpdateMessageMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PollUpdateMessageMetadata} PollUpdateMessageMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollUpdateMessageMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollUpdateMessageMetadata message. + * @function verify + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollUpdateMessageMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a PollUpdateMessageMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PollUpdateMessageMetadata} PollUpdateMessageMetadata + */ + PollUpdateMessageMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PollUpdateMessageMetadata) + return object; + return new $root.proto.Message.PollUpdateMessageMetadata(); + }; + + /** + * Creates a plain object from a PollUpdateMessageMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PollUpdateMessageMetadata + * @static + * @param {proto.Message.PollUpdateMessageMetadata} message PollUpdateMessageMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollUpdateMessageMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this PollUpdateMessageMetadata to JSON. + * @function toJSON + * @memberof proto.Message.PollUpdateMessageMetadata + * @instance + * @returns {Object.} JSON object + */ + PollUpdateMessageMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollUpdateMessageMetadata; + })(); + + Message.PollVoteMessage = (function() { + + /** + * Properties of a PollVoteMessage. + * @memberof proto.Message + * @interface IPollVoteMessage + * @property {Array.|null} [selectedOptions] PollVoteMessage selectedOptions + */ + + /** + * Constructs a new PollVoteMessage. + * @memberof proto.Message + * @classdesc Represents a PollVoteMessage. + * @implements IPollVoteMessage + * @constructor + * @param {proto.Message.IPollVoteMessage=} [properties] Properties to set + */ + function PollVoteMessage(properties) { + this.selectedOptions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollVoteMessage selectedOptions. + * @member {Array.} selectedOptions + * @memberof proto.Message.PollVoteMessage + * @instance + */ + PollVoteMessage.prototype.selectedOptions = $util.emptyArray; + + /** + * Creates a new PollVoteMessage instance using the specified properties. + * @function create + * @memberof proto.Message.PollVoteMessage + * @static + * @param {proto.Message.IPollVoteMessage=} [properties] Properties to set + * @returns {proto.Message.PollVoteMessage} PollVoteMessage instance + */ + PollVoteMessage.create = function create(properties) { + return new PollVoteMessage(properties); + }; + + /** + * Encodes the specified PollVoteMessage message. Does not implicitly {@link proto.Message.PollVoteMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.PollVoteMessage + * @static + * @param {proto.Message.IPollVoteMessage} message PollVoteMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollVoteMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selectedOptions != null && message.selectedOptions.length) + for (var i = 0; i < message.selectedOptions.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.selectedOptions[i]); + return writer; + }; + + /** + * Encodes the specified PollVoteMessage message, length delimited. Does not implicitly {@link proto.Message.PollVoteMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.PollVoteMessage + * @static + * @param {proto.Message.IPollVoteMessage} message PollVoteMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollVoteMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollVoteMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.PollVoteMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.PollVoteMessage} PollVoteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollVoteMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.PollVoteMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.selectedOptions && message.selectedOptions.length)) + message.selectedOptions = []; + message.selectedOptions.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollVoteMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.PollVoteMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.PollVoteMessage} PollVoteMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollVoteMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollVoteMessage message. + * @function verify + * @memberof proto.Message.PollVoteMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollVoteMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selectedOptions != null && message.hasOwnProperty("selectedOptions")) { + if (!Array.isArray(message.selectedOptions)) + return "selectedOptions: array expected"; + for (var i = 0; i < message.selectedOptions.length; ++i) + if (!(message.selectedOptions[i] && typeof message.selectedOptions[i].length === "number" || $util.isString(message.selectedOptions[i]))) + return "selectedOptions: buffer[] expected"; + } + return null; + }; + + /** + * Creates a PollVoteMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.PollVoteMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.PollVoteMessage} PollVoteMessage + */ + PollVoteMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.PollVoteMessage) + return object; + var message = new $root.proto.Message.PollVoteMessage(); + if (object.selectedOptions) { + if (!Array.isArray(object.selectedOptions)) + throw TypeError(".proto.Message.PollVoteMessage.selectedOptions: array expected"); + message.selectedOptions = []; + for (var i = 0; i < object.selectedOptions.length; ++i) + if (typeof object.selectedOptions[i] === "string") + $util.base64.decode(object.selectedOptions[i], message.selectedOptions[i] = $util.newBuffer($util.base64.length(object.selectedOptions[i])), 0); + else if (object.selectedOptions[i].length) + message.selectedOptions[i] = object.selectedOptions[i]; + } + return message; + }; + + /** + * Creates a plain object from a PollVoteMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.PollVoteMessage + * @static + * @param {proto.Message.PollVoteMessage} message PollVoteMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollVoteMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.selectedOptions = []; + if (message.selectedOptions && message.selectedOptions.length) { + object.selectedOptions = []; + for (var j = 0; j < message.selectedOptions.length; ++j) + object.selectedOptions[j] = options.bytes === String ? $util.base64.encode(message.selectedOptions[j], 0, message.selectedOptions[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.selectedOptions[j]) : message.selectedOptions[j]; + } + return object; + }; + + /** + * Converts this PollVoteMessage to JSON. + * @function toJSON + * @memberof proto.Message.PollVoteMessage + * @instance + * @returns {Object.} JSON object + */ + PollVoteMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollVoteMessage; + })(); + + Message.ProductMessage = (function() { + + /** + * Properties of a ProductMessage. + * @memberof proto.Message + * @interface IProductMessage + * @property {proto.Message.ProductMessage.IProductSnapshot|null} [product] ProductMessage product + * @property {string|null} [businessOwnerJid] ProductMessage businessOwnerJid + * @property {proto.Message.ProductMessage.ICatalogSnapshot|null} [catalog] ProductMessage catalog + * @property {string|null} [body] ProductMessage body + * @property {string|null} [footer] ProductMessage footer + * @property {proto.IContextInfo|null} [contextInfo] ProductMessage contextInfo + */ + + /** + * Constructs a new ProductMessage. + * @memberof proto.Message + * @classdesc Represents a ProductMessage. + * @implements IProductMessage + * @constructor + * @param {proto.Message.IProductMessage=} [properties] Properties to set + */ + function ProductMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductMessage product. + * @member {proto.Message.ProductMessage.IProductSnapshot|null|undefined} product + * @memberof proto.Message.ProductMessage + * @instance + */ + ProductMessage.prototype.product = null; + + /** + * ProductMessage businessOwnerJid. + * @member {string} businessOwnerJid + * @memberof proto.Message.ProductMessage + * @instance + */ + ProductMessage.prototype.businessOwnerJid = ""; + + /** + * ProductMessage catalog. + * @member {proto.Message.ProductMessage.ICatalogSnapshot|null|undefined} catalog + * @memberof proto.Message.ProductMessage + * @instance + */ + ProductMessage.prototype.catalog = null; + + /** + * ProductMessage body. + * @member {string} body + * @memberof proto.Message.ProductMessage + * @instance + */ + ProductMessage.prototype.body = ""; + + /** + * ProductMessage footer. + * @member {string} footer + * @memberof proto.Message.ProductMessage + * @instance + */ + ProductMessage.prototype.footer = ""; + + /** + * ProductMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.ProductMessage + * @instance + */ + ProductMessage.prototype.contextInfo = null; + + /** + * Creates a new ProductMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ProductMessage + * @static + * @param {proto.Message.IProductMessage=} [properties] Properties to set + * @returns {proto.Message.ProductMessage} ProductMessage instance + */ + ProductMessage.create = function create(properties) { + return new ProductMessage(properties); + }; + + /** + * Encodes the specified ProductMessage message. Does not implicitly {@link proto.Message.ProductMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ProductMessage + * @static + * @param {proto.Message.IProductMessage} message ProductMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.product != null && Object.hasOwnProperty.call(message, "product")) + $root.proto.Message.ProductMessage.ProductSnapshot.encode(message.product, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.businessOwnerJid != null && Object.hasOwnProperty.call(message, "businessOwnerJid")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.businessOwnerJid); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + $root.proto.Message.ProductMessage.CatalogSnapshot.encode(message.catalog, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.body); + if (message.footer != null && Object.hasOwnProperty.call(message, "footer")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.footer); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProductMessage message, length delimited. Does not implicitly {@link proto.Message.ProductMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ProductMessage + * @static + * @param {proto.Message.IProductMessage} message ProductMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ProductMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ProductMessage} ProductMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ProductMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.product = $root.proto.Message.ProductMessage.ProductSnapshot.decode(reader, reader.uint32()); + break; + case 2: + message.businessOwnerJid = reader.string(); + break; + case 4: + message.catalog = $root.proto.Message.ProductMessage.CatalogSnapshot.decode(reader, reader.uint32()); + break; + case 5: + message.body = reader.string(); + break; + case 6: + message.footer = reader.string(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ProductMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ProductMessage} ProductMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductMessage message. + * @function verify + * @memberof proto.Message.ProductMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.product != null && message.hasOwnProperty("product")) { + var error = $root.proto.Message.ProductMessage.ProductSnapshot.verify(message.product); + if (error) + return "product." + error; + } + if (message.businessOwnerJid != null && message.hasOwnProperty("businessOwnerJid")) + if (!$util.isString(message.businessOwnerJid)) + return "businessOwnerJid: string expected"; + if (message.catalog != null && message.hasOwnProperty("catalog")) { + var error = $root.proto.Message.ProductMessage.CatalogSnapshot.verify(message.catalog); + if (error) + return "catalog." + error; + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.footer != null && message.hasOwnProperty("footer")) + if (!$util.isString(message.footer)) + return "footer: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a ProductMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ProductMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ProductMessage} ProductMessage + */ + ProductMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ProductMessage) + return object; + var message = new $root.proto.Message.ProductMessage(); + if (object.product != null) { + if (typeof object.product !== "object") + throw TypeError(".proto.Message.ProductMessage.product: object expected"); + message.product = $root.proto.Message.ProductMessage.ProductSnapshot.fromObject(object.product); + } + if (object.businessOwnerJid != null) + message.businessOwnerJid = String(object.businessOwnerJid); + if (object.catalog != null) { + if (typeof object.catalog !== "object") + throw TypeError(".proto.Message.ProductMessage.catalog: object expected"); + message.catalog = $root.proto.Message.ProductMessage.CatalogSnapshot.fromObject(object.catalog); + } + if (object.body != null) + message.body = String(object.body); + if (object.footer != null) + message.footer = String(object.footer); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.ProductMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a ProductMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ProductMessage + * @static + * @param {proto.Message.ProductMessage} message ProductMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.product = null; + object.businessOwnerJid = ""; + object.catalog = null; + object.body = ""; + object.footer = ""; + object.contextInfo = null; + } + if (message.product != null && message.hasOwnProperty("product")) + object.product = $root.proto.Message.ProductMessage.ProductSnapshot.toObject(message.product, options); + if (message.businessOwnerJid != null && message.hasOwnProperty("businessOwnerJid")) + object.businessOwnerJid = message.businessOwnerJid; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = $root.proto.Message.ProductMessage.CatalogSnapshot.toObject(message.catalog, options); + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.footer != null && message.hasOwnProperty("footer")) + object.footer = message.footer; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this ProductMessage to JSON. + * @function toJSON + * @memberof proto.Message.ProductMessage + * @instance + * @returns {Object.} JSON object + */ + ProductMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ProductMessage.CatalogSnapshot = (function() { + + /** + * Properties of a CatalogSnapshot. + * @memberof proto.Message.ProductMessage + * @interface ICatalogSnapshot + * @property {proto.Message.IImageMessage|null} [catalogImage] CatalogSnapshot catalogImage + * @property {string|null} [title] CatalogSnapshot title + * @property {string|null} [description] CatalogSnapshot description + */ + + /** + * Constructs a new CatalogSnapshot. + * @memberof proto.Message.ProductMessage + * @classdesc Represents a CatalogSnapshot. + * @implements ICatalogSnapshot + * @constructor + * @param {proto.Message.ProductMessage.ICatalogSnapshot=} [properties] Properties to set + */ + function CatalogSnapshot(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CatalogSnapshot catalogImage. + * @member {proto.Message.IImageMessage|null|undefined} catalogImage + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @instance + */ + CatalogSnapshot.prototype.catalogImage = null; + + /** + * CatalogSnapshot title. + * @member {string} title + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @instance + */ + CatalogSnapshot.prototype.title = ""; + + /** + * CatalogSnapshot description. + * @member {string} description + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @instance + */ + CatalogSnapshot.prototype.description = ""; + + /** + * Creates a new CatalogSnapshot instance using the specified properties. + * @function create + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {proto.Message.ProductMessage.ICatalogSnapshot=} [properties] Properties to set + * @returns {proto.Message.ProductMessage.CatalogSnapshot} CatalogSnapshot instance + */ + CatalogSnapshot.create = function create(properties) { + return new CatalogSnapshot(properties); + }; + + /** + * Encodes the specified CatalogSnapshot message. Does not implicitly {@link proto.Message.ProductMessage.CatalogSnapshot.verify|verify} messages. + * @function encode + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {proto.Message.ProductMessage.ICatalogSnapshot} message CatalogSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CatalogSnapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.catalogImage != null && Object.hasOwnProperty.call(message, "catalogImage")) + $root.proto.Message.ImageMessage.encode(message.catalogImage, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + return writer; + }; + + /** + * Encodes the specified CatalogSnapshot message, length delimited. Does not implicitly {@link proto.Message.ProductMessage.CatalogSnapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {proto.Message.ProductMessage.ICatalogSnapshot} message CatalogSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CatalogSnapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CatalogSnapshot message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ProductMessage.CatalogSnapshot} CatalogSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CatalogSnapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ProductMessage.CatalogSnapshot(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.catalogImage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 2: + message.title = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CatalogSnapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ProductMessage.CatalogSnapshot} CatalogSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CatalogSnapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CatalogSnapshot message. + * @function verify + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CatalogSnapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.catalogImage != null && message.hasOwnProperty("catalogImage")) { + var error = $root.proto.Message.ImageMessage.verify(message.catalogImage); + if (error) + return "catalogImage." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates a CatalogSnapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ProductMessage.CatalogSnapshot} CatalogSnapshot + */ + CatalogSnapshot.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ProductMessage.CatalogSnapshot) + return object; + var message = new $root.proto.Message.ProductMessage.CatalogSnapshot(); + if (object.catalogImage != null) { + if (typeof object.catalogImage !== "object") + throw TypeError(".proto.Message.ProductMessage.CatalogSnapshot.catalogImage: object expected"); + message.catalogImage = $root.proto.Message.ImageMessage.fromObject(object.catalogImage); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from a CatalogSnapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @static + * @param {proto.Message.ProductMessage.CatalogSnapshot} message CatalogSnapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CatalogSnapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.catalogImage = null; + object.title = ""; + object.description = ""; + } + if (message.catalogImage != null && message.hasOwnProperty("catalogImage")) + object.catalogImage = $root.proto.Message.ImageMessage.toObject(message.catalogImage, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this CatalogSnapshot to JSON. + * @function toJSON + * @memberof proto.Message.ProductMessage.CatalogSnapshot + * @instance + * @returns {Object.} JSON object + */ + CatalogSnapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CatalogSnapshot; + })(); + + ProductMessage.ProductSnapshot = (function() { + + /** + * Properties of a ProductSnapshot. + * @memberof proto.Message.ProductMessage + * @interface IProductSnapshot + * @property {proto.Message.IImageMessage|null} [productImage] ProductSnapshot productImage + * @property {string|null} [productId] ProductSnapshot productId + * @property {string|null} [title] ProductSnapshot title + * @property {string|null} [description] ProductSnapshot description + * @property {string|null} [currencyCode] ProductSnapshot currencyCode + * @property {number|Long|null} [priceAmount1000] ProductSnapshot priceAmount1000 + * @property {string|null} [retailerId] ProductSnapshot retailerId + * @property {string|null} [url] ProductSnapshot url + * @property {number|null} [productImageCount] ProductSnapshot productImageCount + * @property {string|null} [firstImageId] ProductSnapshot firstImageId + * @property {number|Long|null} [salePriceAmount1000] ProductSnapshot salePriceAmount1000 + */ + + /** + * Constructs a new ProductSnapshot. + * @memberof proto.Message.ProductMessage + * @classdesc Represents a ProductSnapshot. + * @implements IProductSnapshot + * @constructor + * @param {proto.Message.ProductMessage.IProductSnapshot=} [properties] Properties to set + */ + function ProductSnapshot(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProductSnapshot productImage. + * @member {proto.Message.IImageMessage|null|undefined} productImage + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.productImage = null; + + /** + * ProductSnapshot productId. + * @member {string} productId + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.productId = ""; + + /** + * ProductSnapshot title. + * @member {string} title + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.title = ""; + + /** + * ProductSnapshot description. + * @member {string} description + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.description = ""; + + /** + * ProductSnapshot currencyCode. + * @member {string} currencyCode + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.currencyCode = ""; + + /** + * ProductSnapshot priceAmount1000. + * @member {number|Long} priceAmount1000 + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.priceAmount1000 = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ProductSnapshot retailerId. + * @member {string} retailerId + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.retailerId = ""; + + /** + * ProductSnapshot url. + * @member {string} url + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.url = ""; + + /** + * ProductSnapshot productImageCount. + * @member {number} productImageCount + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.productImageCount = 0; + + /** + * ProductSnapshot firstImageId. + * @member {string} firstImageId + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.firstImageId = ""; + + /** + * ProductSnapshot salePriceAmount1000. + * @member {number|Long} salePriceAmount1000 + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + */ + ProductSnapshot.prototype.salePriceAmount1000 = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ProductSnapshot instance using the specified properties. + * @function create + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {proto.Message.ProductMessage.IProductSnapshot=} [properties] Properties to set + * @returns {proto.Message.ProductMessage.ProductSnapshot} ProductSnapshot instance + */ + ProductSnapshot.create = function create(properties) { + return new ProductSnapshot(properties); + }; + + /** + * Encodes the specified ProductSnapshot message. Does not implicitly {@link proto.Message.ProductMessage.ProductSnapshot.verify|verify} messages. + * @function encode + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {proto.Message.ProductMessage.IProductSnapshot} message ProductSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductSnapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.productImage != null && Object.hasOwnProperty.call(message, "productImage")) + $root.proto.Message.ImageMessage.encode(message.productImage, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.productId != null && Object.hasOwnProperty.call(message, "productId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.productId); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.description); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.currencyCode); + if (message.priceAmount1000 != null && Object.hasOwnProperty.call(message, "priceAmount1000")) + writer.uint32(/* id 6, wireType 0 =*/48).int64(message.priceAmount1000); + if (message.retailerId != null && Object.hasOwnProperty.call(message, "retailerId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.retailerId); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.url); + if (message.productImageCount != null && Object.hasOwnProperty.call(message, "productImageCount")) + writer.uint32(/* id 9, wireType 0 =*/72).uint32(message.productImageCount); + if (message.firstImageId != null && Object.hasOwnProperty.call(message, "firstImageId")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.firstImageId); + if (message.salePriceAmount1000 != null && Object.hasOwnProperty.call(message, "salePriceAmount1000")) + writer.uint32(/* id 12, wireType 0 =*/96).int64(message.salePriceAmount1000); + return writer; + }; + + /** + * Encodes the specified ProductSnapshot message, length delimited. Does not implicitly {@link proto.Message.ProductMessage.ProductSnapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {proto.Message.ProductMessage.IProductSnapshot} message ProductSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProductSnapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProductSnapshot message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ProductMessage.ProductSnapshot} ProductSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductSnapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ProductMessage.ProductSnapshot(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.productImage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 2: + message.productId = reader.string(); + break; + case 3: + message.title = reader.string(); + break; + case 4: + message.description = reader.string(); + break; + case 5: + message.currencyCode = reader.string(); + break; + case 6: + message.priceAmount1000 = reader.int64(); + break; + case 7: + message.retailerId = reader.string(); + break; + case 8: + message.url = reader.string(); + break; + case 9: + message.productImageCount = reader.uint32(); + break; + case 11: + message.firstImageId = reader.string(); + break; + case 12: + message.salePriceAmount1000 = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProductSnapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ProductMessage.ProductSnapshot} ProductSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProductSnapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProductSnapshot message. + * @function verify + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProductSnapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.productImage != null && message.hasOwnProperty("productImage")) { + var error = $root.proto.Message.ImageMessage.verify(message.productImage); + if (error) + return "productImage." + error; + } + if (message.productId != null && message.hasOwnProperty("productId")) + if (!$util.isString(message.productId)) + return "productId: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.priceAmount1000 != null && message.hasOwnProperty("priceAmount1000")) + if (!$util.isInteger(message.priceAmount1000) && !(message.priceAmount1000 && $util.isInteger(message.priceAmount1000.low) && $util.isInteger(message.priceAmount1000.high))) + return "priceAmount1000: integer|Long expected"; + if (message.retailerId != null && message.hasOwnProperty("retailerId")) + if (!$util.isString(message.retailerId)) + return "retailerId: string expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.productImageCount != null && message.hasOwnProperty("productImageCount")) + if (!$util.isInteger(message.productImageCount)) + return "productImageCount: integer expected"; + if (message.firstImageId != null && message.hasOwnProperty("firstImageId")) + if (!$util.isString(message.firstImageId)) + return "firstImageId: string expected"; + if (message.salePriceAmount1000 != null && message.hasOwnProperty("salePriceAmount1000")) + if (!$util.isInteger(message.salePriceAmount1000) && !(message.salePriceAmount1000 && $util.isInteger(message.salePriceAmount1000.low) && $util.isInteger(message.salePriceAmount1000.high))) + return "salePriceAmount1000: integer|Long expected"; + return null; + }; + + /** + * Creates a ProductSnapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ProductMessage.ProductSnapshot} ProductSnapshot + */ + ProductSnapshot.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ProductMessage.ProductSnapshot) + return object; + var message = new $root.proto.Message.ProductMessage.ProductSnapshot(); + if (object.productImage != null) { + if (typeof object.productImage !== "object") + throw TypeError(".proto.Message.ProductMessage.ProductSnapshot.productImage: object expected"); + message.productImage = $root.proto.Message.ImageMessage.fromObject(object.productImage); + } + if (object.productId != null) + message.productId = String(object.productId); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.priceAmount1000 != null) + if ($util.Long) + (message.priceAmount1000 = $util.Long.fromValue(object.priceAmount1000)).unsigned = false; + else if (typeof object.priceAmount1000 === "string") + message.priceAmount1000 = parseInt(object.priceAmount1000, 10); + else if (typeof object.priceAmount1000 === "number") + message.priceAmount1000 = object.priceAmount1000; + else if (typeof object.priceAmount1000 === "object") + message.priceAmount1000 = new $util.LongBits(object.priceAmount1000.low >>> 0, object.priceAmount1000.high >>> 0).toNumber(); + if (object.retailerId != null) + message.retailerId = String(object.retailerId); + if (object.url != null) + message.url = String(object.url); + if (object.productImageCount != null) + message.productImageCount = object.productImageCount >>> 0; + if (object.firstImageId != null) + message.firstImageId = String(object.firstImageId); + if (object.salePriceAmount1000 != null) + if ($util.Long) + (message.salePriceAmount1000 = $util.Long.fromValue(object.salePriceAmount1000)).unsigned = false; + else if (typeof object.salePriceAmount1000 === "string") + message.salePriceAmount1000 = parseInt(object.salePriceAmount1000, 10); + else if (typeof object.salePriceAmount1000 === "number") + message.salePriceAmount1000 = object.salePriceAmount1000; + else if (typeof object.salePriceAmount1000 === "object") + message.salePriceAmount1000 = new $util.LongBits(object.salePriceAmount1000.low >>> 0, object.salePriceAmount1000.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ProductSnapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @static + * @param {proto.Message.ProductMessage.ProductSnapshot} message ProductSnapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProductSnapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.productImage = null; + object.productId = ""; + object.title = ""; + object.description = ""; + object.currencyCode = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.priceAmount1000 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.priceAmount1000 = options.longs === String ? "0" : 0; + object.retailerId = ""; + object.url = ""; + object.productImageCount = 0; + object.firstImageId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.salePriceAmount1000 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.salePriceAmount1000 = options.longs === String ? "0" : 0; + } + if (message.productImage != null && message.hasOwnProperty("productImage")) + object.productImage = $root.proto.Message.ImageMessage.toObject(message.productImage, options); + if (message.productId != null && message.hasOwnProperty("productId")) + object.productId = message.productId; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.priceAmount1000 != null && message.hasOwnProperty("priceAmount1000")) + if (typeof message.priceAmount1000 === "number") + object.priceAmount1000 = options.longs === String ? String(message.priceAmount1000) : message.priceAmount1000; + else + object.priceAmount1000 = options.longs === String ? $util.Long.prototype.toString.call(message.priceAmount1000) : options.longs === Number ? new $util.LongBits(message.priceAmount1000.low >>> 0, message.priceAmount1000.high >>> 0).toNumber() : message.priceAmount1000; + if (message.retailerId != null && message.hasOwnProperty("retailerId")) + object.retailerId = message.retailerId; + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.productImageCount != null && message.hasOwnProperty("productImageCount")) + object.productImageCount = message.productImageCount; + if (message.firstImageId != null && message.hasOwnProperty("firstImageId")) + object.firstImageId = message.firstImageId; + if (message.salePriceAmount1000 != null && message.hasOwnProperty("salePriceAmount1000")) + if (typeof message.salePriceAmount1000 === "number") + object.salePriceAmount1000 = options.longs === String ? String(message.salePriceAmount1000) : message.salePriceAmount1000; + else + object.salePriceAmount1000 = options.longs === String ? $util.Long.prototype.toString.call(message.salePriceAmount1000) : options.longs === Number ? new $util.LongBits(message.salePriceAmount1000.low >>> 0, message.salePriceAmount1000.high >>> 0).toNumber() : message.salePriceAmount1000; + return object; + }; + + /** + * Converts this ProductSnapshot to JSON. + * @function toJSON + * @memberof proto.Message.ProductMessage.ProductSnapshot + * @instance + * @returns {Object.} JSON object + */ + ProductSnapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProductSnapshot; + })(); + + return ProductMessage; + })(); + + Message.ProtocolMessage = (function() { + + /** + * Properties of a ProtocolMessage. + * @memberof proto.Message + * @interface IProtocolMessage + * @property {proto.IMessageKey|null} [key] ProtocolMessage key + * @property {proto.Message.ProtocolMessage.Type|null} [type] ProtocolMessage type + * @property {number|null} [ephemeralExpiration] ProtocolMessage ephemeralExpiration + * @property {number|Long|null} [ephemeralSettingTimestamp] ProtocolMessage ephemeralSettingTimestamp + * @property {proto.Message.IHistorySyncNotification|null} [historySyncNotification] ProtocolMessage historySyncNotification + * @property {proto.Message.IAppStateSyncKeyShare|null} [appStateSyncKeyShare] ProtocolMessage appStateSyncKeyShare + * @property {proto.Message.IAppStateSyncKeyRequest|null} [appStateSyncKeyRequest] ProtocolMessage appStateSyncKeyRequest + * @property {proto.Message.IInitialSecurityNotificationSettingSync|null} [initialSecurityNotificationSettingSync] ProtocolMessage initialSecurityNotificationSettingSync + * @property {proto.Message.IAppStateFatalExceptionNotification|null} [appStateFatalExceptionNotification] ProtocolMessage appStateFatalExceptionNotification + * @property {proto.IDisappearingMode|null} [disappearingMode] ProtocolMessage disappearingMode + * @property {proto.IMessage|null} [editedMessage] ProtocolMessage editedMessage + * @property {number|Long|null} [timestampMs] ProtocolMessage timestampMs + * @property {proto.Message.IPeerDataOperationRequestMessage|null} [peerDataOperationRequestMessage] ProtocolMessage peerDataOperationRequestMessage + * @property {proto.Message.IPeerDataOperationRequestResponseMessage|null} [peerDataOperationRequestResponseMessage] ProtocolMessage peerDataOperationRequestResponseMessage + */ + + /** + * Constructs a new ProtocolMessage. + * @memberof proto.Message + * @classdesc Represents a ProtocolMessage. + * @implements IProtocolMessage + * @constructor + * @param {proto.Message.IProtocolMessage=} [properties] Properties to set + */ + function ProtocolMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ProtocolMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.key = null; + + /** + * ProtocolMessage type. + * @member {proto.Message.ProtocolMessage.Type} type + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.type = 0; + + /** + * ProtocolMessage ephemeralExpiration. + * @member {number} ephemeralExpiration + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.ephemeralExpiration = 0; + + /** + * ProtocolMessage ephemeralSettingTimestamp. + * @member {number|Long} ephemeralSettingTimestamp + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.ephemeralSettingTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ProtocolMessage historySyncNotification. + * @member {proto.Message.IHistorySyncNotification|null|undefined} historySyncNotification + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.historySyncNotification = null; + + /** + * ProtocolMessage appStateSyncKeyShare. + * @member {proto.Message.IAppStateSyncKeyShare|null|undefined} appStateSyncKeyShare + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.appStateSyncKeyShare = null; + + /** + * ProtocolMessage appStateSyncKeyRequest. + * @member {proto.Message.IAppStateSyncKeyRequest|null|undefined} appStateSyncKeyRequest + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.appStateSyncKeyRequest = null; + + /** + * ProtocolMessage initialSecurityNotificationSettingSync. + * @member {proto.Message.IInitialSecurityNotificationSettingSync|null|undefined} initialSecurityNotificationSettingSync + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.initialSecurityNotificationSettingSync = null; + + /** + * ProtocolMessage appStateFatalExceptionNotification. + * @member {proto.Message.IAppStateFatalExceptionNotification|null|undefined} appStateFatalExceptionNotification + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.appStateFatalExceptionNotification = null; + + /** + * ProtocolMessage disappearingMode. + * @member {proto.IDisappearingMode|null|undefined} disappearingMode + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.disappearingMode = null; + + /** + * ProtocolMessage editedMessage. + * @member {proto.IMessage|null|undefined} editedMessage + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.editedMessage = null; + + /** + * ProtocolMessage timestampMs. + * @member {number|Long} timestampMs + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.timestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ProtocolMessage peerDataOperationRequestMessage. + * @member {proto.Message.IPeerDataOperationRequestMessage|null|undefined} peerDataOperationRequestMessage + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.peerDataOperationRequestMessage = null; + + /** + * ProtocolMessage peerDataOperationRequestResponseMessage. + * @member {proto.Message.IPeerDataOperationRequestResponseMessage|null|undefined} peerDataOperationRequestResponseMessage + * @memberof proto.Message.ProtocolMessage + * @instance + */ + ProtocolMessage.prototype.peerDataOperationRequestResponseMessage = null; + + /** + * Creates a new ProtocolMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ProtocolMessage + * @static + * @param {proto.Message.IProtocolMessage=} [properties] Properties to set + * @returns {proto.Message.ProtocolMessage} ProtocolMessage instance + */ + ProtocolMessage.create = function create(properties) { + return new ProtocolMessage(properties); + }; + + /** + * Encodes the specified ProtocolMessage message. Does not implicitly {@link proto.Message.ProtocolMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ProtocolMessage + * @static + * @param {proto.Message.IProtocolMessage} message ProtocolMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProtocolMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.ephemeralExpiration != null && Object.hasOwnProperty.call(message, "ephemeralExpiration")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.ephemeralExpiration); + if (message.ephemeralSettingTimestamp != null && Object.hasOwnProperty.call(message, "ephemeralSettingTimestamp")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.ephemeralSettingTimestamp); + if (message.historySyncNotification != null && Object.hasOwnProperty.call(message, "historySyncNotification")) + $root.proto.Message.HistorySyncNotification.encode(message.historySyncNotification, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.appStateSyncKeyShare != null && Object.hasOwnProperty.call(message, "appStateSyncKeyShare")) + $root.proto.Message.AppStateSyncKeyShare.encode(message.appStateSyncKeyShare, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.appStateSyncKeyRequest != null && Object.hasOwnProperty.call(message, "appStateSyncKeyRequest")) + $root.proto.Message.AppStateSyncKeyRequest.encode(message.appStateSyncKeyRequest, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.initialSecurityNotificationSettingSync != null && Object.hasOwnProperty.call(message, "initialSecurityNotificationSettingSync")) + $root.proto.Message.InitialSecurityNotificationSettingSync.encode(message.initialSecurityNotificationSettingSync, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.appStateFatalExceptionNotification != null && Object.hasOwnProperty.call(message, "appStateFatalExceptionNotification")) + $root.proto.Message.AppStateFatalExceptionNotification.encode(message.appStateFatalExceptionNotification, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.disappearingMode != null && Object.hasOwnProperty.call(message, "disappearingMode")) + $root.proto.DisappearingMode.encode(message.disappearingMode, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.editedMessage != null && Object.hasOwnProperty.call(message, "editedMessage")) + $root.proto.Message.encode(message.editedMessage, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.timestampMs != null && Object.hasOwnProperty.call(message, "timestampMs")) + writer.uint32(/* id 15, wireType 0 =*/120).int64(message.timestampMs); + if (message.peerDataOperationRequestMessage != null && Object.hasOwnProperty.call(message, "peerDataOperationRequestMessage")) + $root.proto.Message.PeerDataOperationRequestMessage.encode(message.peerDataOperationRequestMessage, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.peerDataOperationRequestResponseMessage != null && Object.hasOwnProperty.call(message, "peerDataOperationRequestResponseMessage")) + $root.proto.Message.PeerDataOperationRequestResponseMessage.encode(message.peerDataOperationRequestResponseMessage, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProtocolMessage message, length delimited. Does not implicitly {@link proto.Message.ProtocolMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ProtocolMessage + * @static + * @param {proto.Message.IProtocolMessage} message ProtocolMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProtocolMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProtocolMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ProtocolMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ProtocolMessage} ProtocolMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProtocolMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ProtocolMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.type = reader.int32(); + break; + case 4: + message.ephemeralExpiration = reader.uint32(); + break; + case 5: + message.ephemeralSettingTimestamp = reader.int64(); + break; + case 6: + message.historySyncNotification = $root.proto.Message.HistorySyncNotification.decode(reader, reader.uint32()); + break; + case 7: + message.appStateSyncKeyShare = $root.proto.Message.AppStateSyncKeyShare.decode(reader, reader.uint32()); + break; + case 8: + message.appStateSyncKeyRequest = $root.proto.Message.AppStateSyncKeyRequest.decode(reader, reader.uint32()); + break; + case 9: + message.initialSecurityNotificationSettingSync = $root.proto.Message.InitialSecurityNotificationSettingSync.decode(reader, reader.uint32()); + break; + case 10: + message.appStateFatalExceptionNotification = $root.proto.Message.AppStateFatalExceptionNotification.decode(reader, reader.uint32()); + break; + case 11: + message.disappearingMode = $root.proto.DisappearingMode.decode(reader, reader.uint32()); + break; + case 14: + message.editedMessage = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 15: + message.timestampMs = reader.int64(); + break; + case 16: + message.peerDataOperationRequestMessage = $root.proto.Message.PeerDataOperationRequestMessage.decode(reader, reader.uint32()); + break; + case 17: + message.peerDataOperationRequestResponseMessage = $root.proto.Message.PeerDataOperationRequestResponseMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProtocolMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ProtocolMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ProtocolMessage} ProtocolMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProtocolMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProtocolMessage message. + * @function verify + * @memberof proto.Message.ProtocolMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProtocolMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 14: + case 16: + case 17: + break; + } + if (message.ephemeralExpiration != null && message.hasOwnProperty("ephemeralExpiration")) + if (!$util.isInteger(message.ephemeralExpiration)) + return "ephemeralExpiration: integer expected"; + if (message.ephemeralSettingTimestamp != null && message.hasOwnProperty("ephemeralSettingTimestamp")) + if (!$util.isInteger(message.ephemeralSettingTimestamp) && !(message.ephemeralSettingTimestamp && $util.isInteger(message.ephemeralSettingTimestamp.low) && $util.isInteger(message.ephemeralSettingTimestamp.high))) + return "ephemeralSettingTimestamp: integer|Long expected"; + if (message.historySyncNotification != null && message.hasOwnProperty("historySyncNotification")) { + var error = $root.proto.Message.HistorySyncNotification.verify(message.historySyncNotification); + if (error) + return "historySyncNotification." + error; + } + if (message.appStateSyncKeyShare != null && message.hasOwnProperty("appStateSyncKeyShare")) { + var error = $root.proto.Message.AppStateSyncKeyShare.verify(message.appStateSyncKeyShare); + if (error) + return "appStateSyncKeyShare." + error; + } + if (message.appStateSyncKeyRequest != null && message.hasOwnProperty("appStateSyncKeyRequest")) { + var error = $root.proto.Message.AppStateSyncKeyRequest.verify(message.appStateSyncKeyRequest); + if (error) + return "appStateSyncKeyRequest." + error; + } + if (message.initialSecurityNotificationSettingSync != null && message.hasOwnProperty("initialSecurityNotificationSettingSync")) { + var error = $root.proto.Message.InitialSecurityNotificationSettingSync.verify(message.initialSecurityNotificationSettingSync); + if (error) + return "initialSecurityNotificationSettingSync." + error; + } + if (message.appStateFatalExceptionNotification != null && message.hasOwnProperty("appStateFatalExceptionNotification")) { + var error = $root.proto.Message.AppStateFatalExceptionNotification.verify(message.appStateFatalExceptionNotification); + if (error) + return "appStateFatalExceptionNotification." + error; + } + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) { + var error = $root.proto.DisappearingMode.verify(message.disappearingMode); + if (error) + return "disappearingMode." + error; + } + if (message.editedMessage != null && message.hasOwnProperty("editedMessage")) { + var error = $root.proto.Message.verify(message.editedMessage); + if (error) + return "editedMessage." + error; + } + if (message.timestampMs != null && message.hasOwnProperty("timestampMs")) + if (!$util.isInteger(message.timestampMs) && !(message.timestampMs && $util.isInteger(message.timestampMs.low) && $util.isInteger(message.timestampMs.high))) + return "timestampMs: integer|Long expected"; + if (message.peerDataOperationRequestMessage != null && message.hasOwnProperty("peerDataOperationRequestMessage")) { + var error = $root.proto.Message.PeerDataOperationRequestMessage.verify(message.peerDataOperationRequestMessage); + if (error) + return "peerDataOperationRequestMessage." + error; + } + if (message.peerDataOperationRequestResponseMessage != null && message.hasOwnProperty("peerDataOperationRequestResponseMessage")) { + var error = $root.proto.Message.PeerDataOperationRequestResponseMessage.verify(message.peerDataOperationRequestResponseMessage); + if (error) + return "peerDataOperationRequestResponseMessage." + error; + } + return null; + }; + + /** + * Creates a ProtocolMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ProtocolMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ProtocolMessage} ProtocolMessage + */ + ProtocolMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ProtocolMessage) + return object; + var message = new $root.proto.Message.ProtocolMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.ProtocolMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + switch (object.type) { + case "REVOKE": + case 0: + message.type = 0; + break; + case "EPHEMERAL_SETTING": + case 3: + message.type = 3; + break; + case "EPHEMERAL_SYNC_RESPONSE": + case 4: + message.type = 4; + break; + case "HISTORY_SYNC_NOTIFICATION": + case 5: + message.type = 5; + break; + case "APP_STATE_SYNC_KEY_SHARE": + case 6: + message.type = 6; + break; + case "APP_STATE_SYNC_KEY_REQUEST": + case 7: + message.type = 7; + break; + case "MSG_FANOUT_BACKFILL_REQUEST": + case 8: + message.type = 8; + break; + case "INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC": + case 9: + message.type = 9; + break; + case "APP_STATE_FATAL_EXCEPTION_NOTIFICATION": + case 10: + message.type = 10; + break; + case "SHARE_PHONE_NUMBER": + case 11: + message.type = 11; + break; + case "MESSAGE_EDIT": + case 14: + message.type = 14; + break; + case "PEER_DATA_OPERATION_REQUEST_MESSAGE": + case 16: + message.type = 16; + break; + case "PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE": + case 17: + message.type = 17; + break; + } + if (object.ephemeralExpiration != null) + message.ephemeralExpiration = object.ephemeralExpiration >>> 0; + if (object.ephemeralSettingTimestamp != null) + if ($util.Long) + (message.ephemeralSettingTimestamp = $util.Long.fromValue(object.ephemeralSettingTimestamp)).unsigned = false; + else if (typeof object.ephemeralSettingTimestamp === "string") + message.ephemeralSettingTimestamp = parseInt(object.ephemeralSettingTimestamp, 10); + else if (typeof object.ephemeralSettingTimestamp === "number") + message.ephemeralSettingTimestamp = object.ephemeralSettingTimestamp; + else if (typeof object.ephemeralSettingTimestamp === "object") + message.ephemeralSettingTimestamp = new $util.LongBits(object.ephemeralSettingTimestamp.low >>> 0, object.ephemeralSettingTimestamp.high >>> 0).toNumber(); + if (object.historySyncNotification != null) { + if (typeof object.historySyncNotification !== "object") + throw TypeError(".proto.Message.ProtocolMessage.historySyncNotification: object expected"); + message.historySyncNotification = $root.proto.Message.HistorySyncNotification.fromObject(object.historySyncNotification); + } + if (object.appStateSyncKeyShare != null) { + if (typeof object.appStateSyncKeyShare !== "object") + throw TypeError(".proto.Message.ProtocolMessage.appStateSyncKeyShare: object expected"); + message.appStateSyncKeyShare = $root.proto.Message.AppStateSyncKeyShare.fromObject(object.appStateSyncKeyShare); + } + if (object.appStateSyncKeyRequest != null) { + if (typeof object.appStateSyncKeyRequest !== "object") + throw TypeError(".proto.Message.ProtocolMessage.appStateSyncKeyRequest: object expected"); + message.appStateSyncKeyRequest = $root.proto.Message.AppStateSyncKeyRequest.fromObject(object.appStateSyncKeyRequest); + } + if (object.initialSecurityNotificationSettingSync != null) { + if (typeof object.initialSecurityNotificationSettingSync !== "object") + throw TypeError(".proto.Message.ProtocolMessage.initialSecurityNotificationSettingSync: object expected"); + message.initialSecurityNotificationSettingSync = $root.proto.Message.InitialSecurityNotificationSettingSync.fromObject(object.initialSecurityNotificationSettingSync); + } + if (object.appStateFatalExceptionNotification != null) { + if (typeof object.appStateFatalExceptionNotification !== "object") + throw TypeError(".proto.Message.ProtocolMessage.appStateFatalExceptionNotification: object expected"); + message.appStateFatalExceptionNotification = $root.proto.Message.AppStateFatalExceptionNotification.fromObject(object.appStateFatalExceptionNotification); + } + if (object.disappearingMode != null) { + if (typeof object.disappearingMode !== "object") + throw TypeError(".proto.Message.ProtocolMessage.disappearingMode: object expected"); + message.disappearingMode = $root.proto.DisappearingMode.fromObject(object.disappearingMode); + } + if (object.editedMessage != null) { + if (typeof object.editedMessage !== "object") + throw TypeError(".proto.Message.ProtocolMessage.editedMessage: object expected"); + message.editedMessage = $root.proto.Message.fromObject(object.editedMessage); + } + if (object.timestampMs != null) + if ($util.Long) + (message.timestampMs = $util.Long.fromValue(object.timestampMs)).unsigned = false; + else if (typeof object.timestampMs === "string") + message.timestampMs = parseInt(object.timestampMs, 10); + else if (typeof object.timestampMs === "number") + message.timestampMs = object.timestampMs; + else if (typeof object.timestampMs === "object") + message.timestampMs = new $util.LongBits(object.timestampMs.low >>> 0, object.timestampMs.high >>> 0).toNumber(); + if (object.peerDataOperationRequestMessage != null) { + if (typeof object.peerDataOperationRequestMessage !== "object") + throw TypeError(".proto.Message.ProtocolMessage.peerDataOperationRequestMessage: object expected"); + message.peerDataOperationRequestMessage = $root.proto.Message.PeerDataOperationRequestMessage.fromObject(object.peerDataOperationRequestMessage); + } + if (object.peerDataOperationRequestResponseMessage != null) { + if (typeof object.peerDataOperationRequestResponseMessage !== "object") + throw TypeError(".proto.Message.ProtocolMessage.peerDataOperationRequestResponseMessage: object expected"); + message.peerDataOperationRequestResponseMessage = $root.proto.Message.PeerDataOperationRequestResponseMessage.fromObject(object.peerDataOperationRequestResponseMessage); + } + return message; + }; + + /** + * Creates a plain object from a ProtocolMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ProtocolMessage + * @static + * @param {proto.Message.ProtocolMessage} message ProtocolMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProtocolMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.type = options.enums === String ? "REVOKE" : 0; + object.ephemeralExpiration = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.ephemeralSettingTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ephemeralSettingTimestamp = options.longs === String ? "0" : 0; + object.historySyncNotification = null; + object.appStateSyncKeyShare = null; + object.appStateSyncKeyRequest = null; + object.initialSecurityNotificationSettingSync = null; + object.appStateFatalExceptionNotification = null; + object.disappearingMode = null; + object.editedMessage = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestampMs = options.longs === String ? "0" : 0; + object.peerDataOperationRequestMessage = null; + object.peerDataOperationRequestResponseMessage = null; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.proto.Message.ProtocolMessage.Type[message.type] : message.type; + if (message.ephemeralExpiration != null && message.hasOwnProperty("ephemeralExpiration")) + object.ephemeralExpiration = message.ephemeralExpiration; + if (message.ephemeralSettingTimestamp != null && message.hasOwnProperty("ephemeralSettingTimestamp")) + if (typeof message.ephemeralSettingTimestamp === "number") + object.ephemeralSettingTimestamp = options.longs === String ? String(message.ephemeralSettingTimestamp) : message.ephemeralSettingTimestamp; + else + object.ephemeralSettingTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.ephemeralSettingTimestamp) : options.longs === Number ? new $util.LongBits(message.ephemeralSettingTimestamp.low >>> 0, message.ephemeralSettingTimestamp.high >>> 0).toNumber() : message.ephemeralSettingTimestamp; + if (message.historySyncNotification != null && message.hasOwnProperty("historySyncNotification")) + object.historySyncNotification = $root.proto.Message.HistorySyncNotification.toObject(message.historySyncNotification, options); + if (message.appStateSyncKeyShare != null && message.hasOwnProperty("appStateSyncKeyShare")) + object.appStateSyncKeyShare = $root.proto.Message.AppStateSyncKeyShare.toObject(message.appStateSyncKeyShare, options); + if (message.appStateSyncKeyRequest != null && message.hasOwnProperty("appStateSyncKeyRequest")) + object.appStateSyncKeyRequest = $root.proto.Message.AppStateSyncKeyRequest.toObject(message.appStateSyncKeyRequest, options); + if (message.initialSecurityNotificationSettingSync != null && message.hasOwnProperty("initialSecurityNotificationSettingSync")) + object.initialSecurityNotificationSettingSync = $root.proto.Message.InitialSecurityNotificationSettingSync.toObject(message.initialSecurityNotificationSettingSync, options); + if (message.appStateFatalExceptionNotification != null && message.hasOwnProperty("appStateFatalExceptionNotification")) + object.appStateFatalExceptionNotification = $root.proto.Message.AppStateFatalExceptionNotification.toObject(message.appStateFatalExceptionNotification, options); + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) + object.disappearingMode = $root.proto.DisappearingMode.toObject(message.disappearingMode, options); + if (message.editedMessage != null && message.hasOwnProperty("editedMessage")) + object.editedMessage = $root.proto.Message.toObject(message.editedMessage, options); + if (message.timestampMs != null && message.hasOwnProperty("timestampMs")) + if (typeof message.timestampMs === "number") + object.timestampMs = options.longs === String ? String(message.timestampMs) : message.timestampMs; + else + object.timestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.timestampMs) : options.longs === Number ? new $util.LongBits(message.timestampMs.low >>> 0, message.timestampMs.high >>> 0).toNumber() : message.timestampMs; + if (message.peerDataOperationRequestMessage != null && message.hasOwnProperty("peerDataOperationRequestMessage")) + object.peerDataOperationRequestMessage = $root.proto.Message.PeerDataOperationRequestMessage.toObject(message.peerDataOperationRequestMessage, options); + if (message.peerDataOperationRequestResponseMessage != null && message.hasOwnProperty("peerDataOperationRequestResponseMessage")) + object.peerDataOperationRequestResponseMessage = $root.proto.Message.PeerDataOperationRequestResponseMessage.toObject(message.peerDataOperationRequestResponseMessage, options); + return object; + }; + + /** + * Converts this ProtocolMessage to JSON. + * @function toJSON + * @memberof proto.Message.ProtocolMessage + * @instance + * @returns {Object.} JSON object + */ + ProtocolMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name proto.Message.ProtocolMessage.Type + * @enum {number} + * @property {number} REVOKE=0 REVOKE value + * @property {number} EPHEMERAL_SETTING=3 EPHEMERAL_SETTING value + * @property {number} EPHEMERAL_SYNC_RESPONSE=4 EPHEMERAL_SYNC_RESPONSE value + * @property {number} HISTORY_SYNC_NOTIFICATION=5 HISTORY_SYNC_NOTIFICATION value + * @property {number} APP_STATE_SYNC_KEY_SHARE=6 APP_STATE_SYNC_KEY_SHARE value + * @property {number} APP_STATE_SYNC_KEY_REQUEST=7 APP_STATE_SYNC_KEY_REQUEST value + * @property {number} MSG_FANOUT_BACKFILL_REQUEST=8 MSG_FANOUT_BACKFILL_REQUEST value + * @property {number} INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC=9 INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC value + * @property {number} APP_STATE_FATAL_EXCEPTION_NOTIFICATION=10 APP_STATE_FATAL_EXCEPTION_NOTIFICATION value + * @property {number} SHARE_PHONE_NUMBER=11 SHARE_PHONE_NUMBER value + * @property {number} MESSAGE_EDIT=14 MESSAGE_EDIT value + * @property {number} PEER_DATA_OPERATION_REQUEST_MESSAGE=16 PEER_DATA_OPERATION_REQUEST_MESSAGE value + * @property {number} PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE=17 PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE value + */ + ProtocolMessage.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REVOKE"] = 0; + values[valuesById[3] = "EPHEMERAL_SETTING"] = 3; + values[valuesById[4] = "EPHEMERAL_SYNC_RESPONSE"] = 4; + values[valuesById[5] = "HISTORY_SYNC_NOTIFICATION"] = 5; + values[valuesById[6] = "APP_STATE_SYNC_KEY_SHARE"] = 6; + values[valuesById[7] = "APP_STATE_SYNC_KEY_REQUEST"] = 7; + values[valuesById[8] = "MSG_FANOUT_BACKFILL_REQUEST"] = 8; + values[valuesById[9] = "INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC"] = 9; + values[valuesById[10] = "APP_STATE_FATAL_EXCEPTION_NOTIFICATION"] = 10; + values[valuesById[11] = "SHARE_PHONE_NUMBER"] = 11; + values[valuesById[14] = "MESSAGE_EDIT"] = 14; + values[valuesById[16] = "PEER_DATA_OPERATION_REQUEST_MESSAGE"] = 16; + values[valuesById[17] = "PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE"] = 17; + return values; + })(); + + return ProtocolMessage; + })(); + + Message.ReactionMessage = (function() { + + /** + * Properties of a ReactionMessage. + * @memberof proto.Message + * @interface IReactionMessage + * @property {proto.IMessageKey|null} [key] ReactionMessage key + * @property {string|null} [text] ReactionMessage text + * @property {string|null} [groupingKey] ReactionMessage groupingKey + * @property {number|Long|null} [senderTimestampMs] ReactionMessage senderTimestampMs + */ + + /** + * Constructs a new ReactionMessage. + * @memberof proto.Message + * @classdesc Represents a ReactionMessage. + * @implements IReactionMessage + * @constructor + * @param {proto.Message.IReactionMessage=} [properties] Properties to set + */ + function ReactionMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReactionMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.ReactionMessage + * @instance + */ + ReactionMessage.prototype.key = null; + + /** + * ReactionMessage text. + * @member {string} text + * @memberof proto.Message.ReactionMessage + * @instance + */ + ReactionMessage.prototype.text = ""; + + /** + * ReactionMessage groupingKey. + * @member {string} groupingKey + * @memberof proto.Message.ReactionMessage + * @instance + */ + ReactionMessage.prototype.groupingKey = ""; + + /** + * ReactionMessage senderTimestampMs. + * @member {number|Long} senderTimestampMs + * @memberof proto.Message.ReactionMessage + * @instance + */ + ReactionMessage.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ReactionMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ReactionMessage + * @static + * @param {proto.Message.IReactionMessage=} [properties] Properties to set + * @returns {proto.Message.ReactionMessage} ReactionMessage instance + */ + ReactionMessage.create = function create(properties) { + return new ReactionMessage(properties); + }; + + /** + * Encodes the specified ReactionMessage message. Does not implicitly {@link proto.Message.ReactionMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ReactionMessage + * @static + * @param {proto.Message.IReactionMessage} message ReactionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReactionMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); + if (message.groupingKey != null && Object.hasOwnProperty.call(message, "groupingKey")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.groupingKey); + if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.senderTimestampMs); + return writer; + }; + + /** + * Encodes the specified ReactionMessage message, length delimited. Does not implicitly {@link proto.Message.ReactionMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ReactionMessage + * @static + * @param {proto.Message.IReactionMessage} message ReactionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReactionMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReactionMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ReactionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ReactionMessage} ReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReactionMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ReactionMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.text = reader.string(); + break; + case 3: + message.groupingKey = reader.string(); + break; + case 4: + message.senderTimestampMs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReactionMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ReactionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ReactionMessage} ReactionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReactionMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReactionMessage message. + * @function verify + * @memberof proto.Message.ReactionMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReactionMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.groupingKey != null && message.hasOwnProperty("groupingKey")) + if (!$util.isString(message.groupingKey)) + return "groupingKey: string expected"; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high))) + return "senderTimestampMs: integer|Long expected"; + return null; + }; + + /** + * Creates a ReactionMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ReactionMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ReactionMessage} ReactionMessage + */ + ReactionMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ReactionMessage) + return object; + var message = new $root.proto.Message.ReactionMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.ReactionMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + if (object.text != null) + message.text = String(object.text); + if (object.groupingKey != null) + message.groupingKey = String(object.groupingKey); + if (object.senderTimestampMs != null) + if ($util.Long) + (message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false; + else if (typeof object.senderTimestampMs === "string") + message.senderTimestampMs = parseInt(object.senderTimestampMs, 10); + else if (typeof object.senderTimestampMs === "number") + message.senderTimestampMs = object.senderTimestampMs; + else if (typeof object.senderTimestampMs === "object") + message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ReactionMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ReactionMessage + * @static + * @param {proto.Message.ReactionMessage} message ReactionMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReactionMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.text = ""; + object.groupingKey = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.senderTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestampMs = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.groupingKey != null && message.hasOwnProperty("groupingKey")) + object.groupingKey = message.groupingKey; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (typeof message.senderTimestampMs === "number") + object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs; + else + object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs; + return object; + }; + + /** + * Converts this ReactionMessage to JSON. + * @function toJSON + * @memberof proto.Message.ReactionMessage + * @instance + * @returns {Object.} JSON object + */ + ReactionMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReactionMessage; + })(); + + Message.RequestPaymentMessage = (function() { + + /** + * Properties of a RequestPaymentMessage. + * @memberof proto.Message + * @interface IRequestPaymentMessage + * @property {proto.IMessage|null} [noteMessage] RequestPaymentMessage noteMessage + * @property {string|null} [currencyCodeIso4217] RequestPaymentMessage currencyCodeIso4217 + * @property {number|Long|null} [amount1000] RequestPaymentMessage amount1000 + * @property {string|null} [requestFrom] RequestPaymentMessage requestFrom + * @property {number|Long|null} [expiryTimestamp] RequestPaymentMessage expiryTimestamp + * @property {proto.IMoney|null} [amount] RequestPaymentMessage amount + * @property {proto.IPaymentBackground|null} [background] RequestPaymentMessage background + */ + + /** + * Constructs a new RequestPaymentMessage. + * @memberof proto.Message + * @classdesc Represents a RequestPaymentMessage. + * @implements IRequestPaymentMessage + * @constructor + * @param {proto.Message.IRequestPaymentMessage=} [properties] Properties to set + */ + function RequestPaymentMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestPaymentMessage noteMessage. + * @member {proto.IMessage|null|undefined} noteMessage + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.noteMessage = null; + + /** + * RequestPaymentMessage currencyCodeIso4217. + * @member {string} currencyCodeIso4217 + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.currencyCodeIso4217 = ""; + + /** + * RequestPaymentMessage amount1000. + * @member {number|Long} amount1000 + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.amount1000 = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * RequestPaymentMessage requestFrom. + * @member {string} requestFrom + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.requestFrom = ""; + + /** + * RequestPaymentMessage expiryTimestamp. + * @member {number|Long} expiryTimestamp + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.expiryTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * RequestPaymentMessage amount. + * @member {proto.IMoney|null|undefined} amount + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.amount = null; + + /** + * RequestPaymentMessage background. + * @member {proto.IPaymentBackground|null|undefined} background + * @memberof proto.Message.RequestPaymentMessage + * @instance + */ + RequestPaymentMessage.prototype.background = null; + + /** + * Creates a new RequestPaymentMessage instance using the specified properties. + * @function create + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {proto.Message.IRequestPaymentMessage=} [properties] Properties to set + * @returns {proto.Message.RequestPaymentMessage} RequestPaymentMessage instance + */ + RequestPaymentMessage.create = function create(properties) { + return new RequestPaymentMessage(properties); + }; + + /** + * Encodes the specified RequestPaymentMessage message. Does not implicitly {@link proto.Message.RequestPaymentMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {proto.Message.IRequestPaymentMessage} message RequestPaymentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestPaymentMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCodeIso4217 != null && Object.hasOwnProperty.call(message, "currencyCodeIso4217")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCodeIso4217); + if (message.amount1000 != null && Object.hasOwnProperty.call(message, "amount1000")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.amount1000); + if (message.requestFrom != null && Object.hasOwnProperty.call(message, "requestFrom")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.requestFrom); + if (message.noteMessage != null && Object.hasOwnProperty.call(message, "noteMessage")) + $root.proto.Message.encode(message.noteMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.expiryTimestamp != null && Object.hasOwnProperty.call(message, "expiryTimestamp")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.expiryTimestamp); + if (message.amount != null && Object.hasOwnProperty.call(message, "amount")) + $root.proto.Money.encode(message.amount, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.background != null && Object.hasOwnProperty.call(message, "background")) + $root.proto.PaymentBackground.encode(message.background, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RequestPaymentMessage message, length delimited. Does not implicitly {@link proto.Message.RequestPaymentMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {proto.Message.IRequestPaymentMessage} message RequestPaymentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestPaymentMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestPaymentMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.RequestPaymentMessage} RequestPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestPaymentMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.RequestPaymentMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.noteMessage = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 1: + message.currencyCodeIso4217 = reader.string(); + break; + case 2: + message.amount1000 = reader.uint64(); + break; + case 3: + message.requestFrom = reader.string(); + break; + case 5: + message.expiryTimestamp = reader.int64(); + break; + case 6: + message.amount = $root.proto.Money.decode(reader, reader.uint32()); + break; + case 7: + message.background = $root.proto.PaymentBackground.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestPaymentMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.RequestPaymentMessage} RequestPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestPaymentMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestPaymentMessage message. + * @function verify + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestPaymentMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.noteMessage != null && message.hasOwnProperty("noteMessage")) { + var error = $root.proto.Message.verify(message.noteMessage); + if (error) + return "noteMessage." + error; + } + if (message.currencyCodeIso4217 != null && message.hasOwnProperty("currencyCodeIso4217")) + if (!$util.isString(message.currencyCodeIso4217)) + return "currencyCodeIso4217: string expected"; + if (message.amount1000 != null && message.hasOwnProperty("amount1000")) + if (!$util.isInteger(message.amount1000) && !(message.amount1000 && $util.isInteger(message.amount1000.low) && $util.isInteger(message.amount1000.high))) + return "amount1000: integer|Long expected"; + if (message.requestFrom != null && message.hasOwnProperty("requestFrom")) + if (!$util.isString(message.requestFrom)) + return "requestFrom: string expected"; + if (message.expiryTimestamp != null && message.hasOwnProperty("expiryTimestamp")) + if (!$util.isInteger(message.expiryTimestamp) && !(message.expiryTimestamp && $util.isInteger(message.expiryTimestamp.low) && $util.isInteger(message.expiryTimestamp.high))) + return "expiryTimestamp: integer|Long expected"; + if (message.amount != null && message.hasOwnProperty("amount")) { + var error = $root.proto.Money.verify(message.amount); + if (error) + return "amount." + error; + } + if (message.background != null && message.hasOwnProperty("background")) { + var error = $root.proto.PaymentBackground.verify(message.background); + if (error) + return "background." + error; + } + return null; + }; + + /** + * Creates a RequestPaymentMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.RequestPaymentMessage} RequestPaymentMessage + */ + RequestPaymentMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.RequestPaymentMessage) + return object; + var message = new $root.proto.Message.RequestPaymentMessage(); + if (object.noteMessage != null) { + if (typeof object.noteMessage !== "object") + throw TypeError(".proto.Message.RequestPaymentMessage.noteMessage: object expected"); + message.noteMessage = $root.proto.Message.fromObject(object.noteMessage); + } + if (object.currencyCodeIso4217 != null) + message.currencyCodeIso4217 = String(object.currencyCodeIso4217); + if (object.amount1000 != null) + if ($util.Long) + (message.amount1000 = $util.Long.fromValue(object.amount1000)).unsigned = true; + else if (typeof object.amount1000 === "string") + message.amount1000 = parseInt(object.amount1000, 10); + else if (typeof object.amount1000 === "number") + message.amount1000 = object.amount1000; + else if (typeof object.amount1000 === "object") + message.amount1000 = new $util.LongBits(object.amount1000.low >>> 0, object.amount1000.high >>> 0).toNumber(true); + if (object.requestFrom != null) + message.requestFrom = String(object.requestFrom); + if (object.expiryTimestamp != null) + if ($util.Long) + (message.expiryTimestamp = $util.Long.fromValue(object.expiryTimestamp)).unsigned = false; + else if (typeof object.expiryTimestamp === "string") + message.expiryTimestamp = parseInt(object.expiryTimestamp, 10); + else if (typeof object.expiryTimestamp === "number") + message.expiryTimestamp = object.expiryTimestamp; + else if (typeof object.expiryTimestamp === "object") + message.expiryTimestamp = new $util.LongBits(object.expiryTimestamp.low >>> 0, object.expiryTimestamp.high >>> 0).toNumber(); + if (object.amount != null) { + if (typeof object.amount !== "object") + throw TypeError(".proto.Message.RequestPaymentMessage.amount: object expected"); + message.amount = $root.proto.Money.fromObject(object.amount); + } + if (object.background != null) { + if (typeof object.background !== "object") + throw TypeError(".proto.Message.RequestPaymentMessage.background: object expected"); + message.background = $root.proto.PaymentBackground.fromObject(object.background); + } + return message; + }; + + /** + * Creates a plain object from a RequestPaymentMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.RequestPaymentMessage + * @static + * @param {proto.Message.RequestPaymentMessage} message RequestPaymentMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestPaymentMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCodeIso4217 = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.amount1000 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.amount1000 = options.longs === String ? "0" : 0; + object.requestFrom = ""; + object.noteMessage = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.expiryTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expiryTimestamp = options.longs === String ? "0" : 0; + object.amount = null; + object.background = null; + } + if (message.currencyCodeIso4217 != null && message.hasOwnProperty("currencyCodeIso4217")) + object.currencyCodeIso4217 = message.currencyCodeIso4217; + if (message.amount1000 != null && message.hasOwnProperty("amount1000")) + if (typeof message.amount1000 === "number") + object.amount1000 = options.longs === String ? String(message.amount1000) : message.amount1000; + else + object.amount1000 = options.longs === String ? $util.Long.prototype.toString.call(message.amount1000) : options.longs === Number ? new $util.LongBits(message.amount1000.low >>> 0, message.amount1000.high >>> 0).toNumber(true) : message.amount1000; + if (message.requestFrom != null && message.hasOwnProperty("requestFrom")) + object.requestFrom = message.requestFrom; + if (message.noteMessage != null && message.hasOwnProperty("noteMessage")) + object.noteMessage = $root.proto.Message.toObject(message.noteMessage, options); + if (message.expiryTimestamp != null && message.hasOwnProperty("expiryTimestamp")) + if (typeof message.expiryTimestamp === "number") + object.expiryTimestamp = options.longs === String ? String(message.expiryTimestamp) : message.expiryTimestamp; + else + object.expiryTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.expiryTimestamp) : options.longs === Number ? new $util.LongBits(message.expiryTimestamp.low >>> 0, message.expiryTimestamp.high >>> 0).toNumber() : message.expiryTimestamp; + if (message.amount != null && message.hasOwnProperty("amount")) + object.amount = $root.proto.Money.toObject(message.amount, options); + if (message.background != null && message.hasOwnProperty("background")) + object.background = $root.proto.PaymentBackground.toObject(message.background, options); + return object; + }; + + /** + * Converts this RequestPaymentMessage to JSON. + * @function toJSON + * @memberof proto.Message.RequestPaymentMessage + * @instance + * @returns {Object.} JSON object + */ + RequestPaymentMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestPaymentMessage; + })(); + + Message.RequestPhoneNumberMessage = (function() { + + /** + * Properties of a RequestPhoneNumberMessage. + * @memberof proto.Message + * @interface IRequestPhoneNumberMessage + * @property {proto.IContextInfo|null} [contextInfo] RequestPhoneNumberMessage contextInfo + */ + + /** + * Constructs a new RequestPhoneNumberMessage. + * @memberof proto.Message + * @classdesc Represents a RequestPhoneNumberMessage. + * @implements IRequestPhoneNumberMessage + * @constructor + * @param {proto.Message.IRequestPhoneNumberMessage=} [properties] Properties to set + */ + function RequestPhoneNumberMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RequestPhoneNumberMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.RequestPhoneNumberMessage + * @instance + */ + RequestPhoneNumberMessage.prototype.contextInfo = null; + + /** + * Creates a new RequestPhoneNumberMessage instance using the specified properties. + * @function create + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {proto.Message.IRequestPhoneNumberMessage=} [properties] Properties to set + * @returns {proto.Message.RequestPhoneNumberMessage} RequestPhoneNumberMessage instance + */ + RequestPhoneNumberMessage.create = function create(properties) { + return new RequestPhoneNumberMessage(properties); + }; + + /** + * Encodes the specified RequestPhoneNumberMessage message. Does not implicitly {@link proto.Message.RequestPhoneNumberMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {proto.Message.IRequestPhoneNumberMessage} message RequestPhoneNumberMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestPhoneNumberMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RequestPhoneNumberMessage message, length delimited. Does not implicitly {@link proto.Message.RequestPhoneNumberMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {proto.Message.IRequestPhoneNumberMessage} message RequestPhoneNumberMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestPhoneNumberMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestPhoneNumberMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.RequestPhoneNumberMessage} RequestPhoneNumberMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestPhoneNumberMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.RequestPhoneNumberMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestPhoneNumberMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.RequestPhoneNumberMessage} RequestPhoneNumberMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestPhoneNumberMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestPhoneNumberMessage message. + * @function verify + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestPhoneNumberMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + return null; + }; + + /** + * Creates a RequestPhoneNumberMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.RequestPhoneNumberMessage} RequestPhoneNumberMessage + */ + RequestPhoneNumberMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.RequestPhoneNumberMessage) + return object; + var message = new $root.proto.Message.RequestPhoneNumberMessage(); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.RequestPhoneNumberMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + return message; + }; + + /** + * Creates a plain object from a RequestPhoneNumberMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.RequestPhoneNumberMessage + * @static + * @param {proto.Message.RequestPhoneNumberMessage} message RequestPhoneNumberMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestPhoneNumberMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.contextInfo = null; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + return object; + }; + + /** + * Converts this RequestPhoneNumberMessage to JSON. + * @function toJSON + * @memberof proto.Message.RequestPhoneNumberMessage + * @instance + * @returns {Object.} JSON object + */ + RequestPhoneNumberMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RequestPhoneNumberMessage; + })(); + + Message.ScheduledCallCreationMessage = (function() { + + /** + * Properties of a ScheduledCallCreationMessage. + * @memberof proto.Message + * @interface IScheduledCallCreationMessage + * @property {number|Long|null} [scheduledTimestampMs] ScheduledCallCreationMessage scheduledTimestampMs + * @property {proto.Message.ScheduledCallCreationMessage.CallType|null} [callType] ScheduledCallCreationMessage callType + * @property {string|null} [title] ScheduledCallCreationMessage title + */ + + /** + * Constructs a new ScheduledCallCreationMessage. + * @memberof proto.Message + * @classdesc Represents a ScheduledCallCreationMessage. + * @implements IScheduledCallCreationMessage + * @constructor + * @param {proto.Message.IScheduledCallCreationMessage=} [properties] Properties to set + */ + function ScheduledCallCreationMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ScheduledCallCreationMessage scheduledTimestampMs. + * @member {number|Long} scheduledTimestampMs + * @memberof proto.Message.ScheduledCallCreationMessage + * @instance + */ + ScheduledCallCreationMessage.prototype.scheduledTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ScheduledCallCreationMessage callType. + * @member {proto.Message.ScheduledCallCreationMessage.CallType} callType + * @memberof proto.Message.ScheduledCallCreationMessage + * @instance + */ + ScheduledCallCreationMessage.prototype.callType = 0; + + /** + * ScheduledCallCreationMessage title. + * @member {string} title + * @memberof proto.Message.ScheduledCallCreationMessage + * @instance + */ + ScheduledCallCreationMessage.prototype.title = ""; + + /** + * Creates a new ScheduledCallCreationMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {proto.Message.IScheduledCallCreationMessage=} [properties] Properties to set + * @returns {proto.Message.ScheduledCallCreationMessage} ScheduledCallCreationMessage instance + */ + ScheduledCallCreationMessage.create = function create(properties) { + return new ScheduledCallCreationMessage(properties); + }; + + /** + * Encodes the specified ScheduledCallCreationMessage message. Does not implicitly {@link proto.Message.ScheduledCallCreationMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {proto.Message.IScheduledCallCreationMessage} message ScheduledCallCreationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScheduledCallCreationMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.scheduledTimestampMs != null && Object.hasOwnProperty.call(message, "scheduledTimestampMs")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.scheduledTimestampMs); + if (message.callType != null && Object.hasOwnProperty.call(message, "callType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.callType); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.title); + return writer; + }; + + /** + * Encodes the specified ScheduledCallCreationMessage message, length delimited. Does not implicitly {@link proto.Message.ScheduledCallCreationMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {proto.Message.IScheduledCallCreationMessage} message ScheduledCallCreationMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScheduledCallCreationMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScheduledCallCreationMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ScheduledCallCreationMessage} ScheduledCallCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScheduledCallCreationMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ScheduledCallCreationMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.scheduledTimestampMs = reader.int64(); + break; + case 2: + message.callType = reader.int32(); + break; + case 3: + message.title = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScheduledCallCreationMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ScheduledCallCreationMessage} ScheduledCallCreationMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScheduledCallCreationMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScheduledCallCreationMessage message. + * @function verify + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScheduledCallCreationMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.scheduledTimestampMs != null && message.hasOwnProperty("scheduledTimestampMs")) + if (!$util.isInteger(message.scheduledTimestampMs) && !(message.scheduledTimestampMs && $util.isInteger(message.scheduledTimestampMs.low) && $util.isInteger(message.scheduledTimestampMs.high))) + return "scheduledTimestampMs: integer|Long expected"; + if (message.callType != null && message.hasOwnProperty("callType")) + switch (message.callType) { + default: + return "callType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + return null; + }; + + /** + * Creates a ScheduledCallCreationMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ScheduledCallCreationMessage} ScheduledCallCreationMessage + */ + ScheduledCallCreationMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ScheduledCallCreationMessage) + return object; + var message = new $root.proto.Message.ScheduledCallCreationMessage(); + if (object.scheduledTimestampMs != null) + if ($util.Long) + (message.scheduledTimestampMs = $util.Long.fromValue(object.scheduledTimestampMs)).unsigned = false; + else if (typeof object.scheduledTimestampMs === "string") + message.scheduledTimestampMs = parseInt(object.scheduledTimestampMs, 10); + else if (typeof object.scheduledTimestampMs === "number") + message.scheduledTimestampMs = object.scheduledTimestampMs; + else if (typeof object.scheduledTimestampMs === "object") + message.scheduledTimestampMs = new $util.LongBits(object.scheduledTimestampMs.low >>> 0, object.scheduledTimestampMs.high >>> 0).toNumber(); + switch (object.callType) { + case "UNKNOWN": + case 0: + message.callType = 0; + break; + case "VOICE": + case 1: + message.callType = 1; + break; + case "VIDEO": + case 2: + message.callType = 2; + break; + } + if (object.title != null) + message.title = String(object.title); + return message; + }; + + /** + * Creates a plain object from a ScheduledCallCreationMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ScheduledCallCreationMessage + * @static + * @param {proto.Message.ScheduledCallCreationMessage} message ScheduledCallCreationMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScheduledCallCreationMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.scheduledTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.scheduledTimestampMs = options.longs === String ? "0" : 0; + object.callType = options.enums === String ? "UNKNOWN" : 0; + object.title = ""; + } + if (message.scheduledTimestampMs != null && message.hasOwnProperty("scheduledTimestampMs")) + if (typeof message.scheduledTimestampMs === "number") + object.scheduledTimestampMs = options.longs === String ? String(message.scheduledTimestampMs) : message.scheduledTimestampMs; + else + object.scheduledTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.scheduledTimestampMs) : options.longs === Number ? new $util.LongBits(message.scheduledTimestampMs.low >>> 0, message.scheduledTimestampMs.high >>> 0).toNumber() : message.scheduledTimestampMs; + if (message.callType != null && message.hasOwnProperty("callType")) + object.callType = options.enums === String ? $root.proto.Message.ScheduledCallCreationMessage.CallType[message.callType] : message.callType; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + return object; + }; + + /** + * Converts this ScheduledCallCreationMessage to JSON. + * @function toJSON + * @memberof proto.Message.ScheduledCallCreationMessage + * @instance + * @returns {Object.} JSON object + */ + ScheduledCallCreationMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CallType enum. + * @name proto.Message.ScheduledCallCreationMessage.CallType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} VOICE=1 VOICE value + * @property {number} VIDEO=2 VIDEO value + */ + ScheduledCallCreationMessage.CallType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "VOICE"] = 1; + values[valuesById[2] = "VIDEO"] = 2; + return values; + })(); + + return ScheduledCallCreationMessage; + })(); + + Message.ScheduledCallEditMessage = (function() { + + /** + * Properties of a ScheduledCallEditMessage. + * @memberof proto.Message + * @interface IScheduledCallEditMessage + * @property {proto.IMessageKey|null} [key] ScheduledCallEditMessage key + * @property {proto.Message.ScheduledCallEditMessage.EditType|null} [editType] ScheduledCallEditMessage editType + */ + + /** + * Constructs a new ScheduledCallEditMessage. + * @memberof proto.Message + * @classdesc Represents a ScheduledCallEditMessage. + * @implements IScheduledCallEditMessage + * @constructor + * @param {proto.Message.IScheduledCallEditMessage=} [properties] Properties to set + */ + function ScheduledCallEditMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ScheduledCallEditMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Message.ScheduledCallEditMessage + * @instance + */ + ScheduledCallEditMessage.prototype.key = null; + + /** + * ScheduledCallEditMessage editType. + * @member {proto.Message.ScheduledCallEditMessage.EditType} editType + * @memberof proto.Message.ScheduledCallEditMessage + * @instance + */ + ScheduledCallEditMessage.prototype.editType = 0; + + /** + * Creates a new ScheduledCallEditMessage instance using the specified properties. + * @function create + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {proto.Message.IScheduledCallEditMessage=} [properties] Properties to set + * @returns {proto.Message.ScheduledCallEditMessage} ScheduledCallEditMessage instance + */ + ScheduledCallEditMessage.create = function create(properties) { + return new ScheduledCallEditMessage(properties); + }; + + /** + * Encodes the specified ScheduledCallEditMessage message. Does not implicitly {@link proto.Message.ScheduledCallEditMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {proto.Message.IScheduledCallEditMessage} message ScheduledCallEditMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScheduledCallEditMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.editType != null && Object.hasOwnProperty.call(message, "editType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editType); + return writer; + }; + + /** + * Encodes the specified ScheduledCallEditMessage message, length delimited. Does not implicitly {@link proto.Message.ScheduledCallEditMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {proto.Message.IScheduledCallEditMessage} message ScheduledCallEditMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ScheduledCallEditMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ScheduledCallEditMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.ScheduledCallEditMessage} ScheduledCallEditMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScheduledCallEditMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.ScheduledCallEditMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.editType = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ScheduledCallEditMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.ScheduledCallEditMessage} ScheduledCallEditMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ScheduledCallEditMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ScheduledCallEditMessage message. + * @function verify + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ScheduledCallEditMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.editType != null && message.hasOwnProperty("editType")) + switch (message.editType) { + default: + return "editType: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a ScheduledCallEditMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.ScheduledCallEditMessage} ScheduledCallEditMessage + */ + ScheduledCallEditMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.ScheduledCallEditMessage) + return object; + var message = new $root.proto.Message.ScheduledCallEditMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Message.ScheduledCallEditMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + switch (object.editType) { + case "UNKNOWN": + case 0: + message.editType = 0; + break; + case "CANCEL": + case 1: + message.editType = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a ScheduledCallEditMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.ScheduledCallEditMessage + * @static + * @param {proto.Message.ScheduledCallEditMessage} message ScheduledCallEditMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ScheduledCallEditMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.editType = options.enums === String ? "UNKNOWN" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.editType != null && message.hasOwnProperty("editType")) + object.editType = options.enums === String ? $root.proto.Message.ScheduledCallEditMessage.EditType[message.editType] : message.editType; + return object; + }; + + /** + * Converts this ScheduledCallEditMessage to JSON. + * @function toJSON + * @memberof proto.Message.ScheduledCallEditMessage + * @instance + * @returns {Object.} JSON object + */ + ScheduledCallEditMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * EditType enum. + * @name proto.Message.ScheduledCallEditMessage.EditType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} CANCEL=1 CANCEL value + */ + ScheduledCallEditMessage.EditType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "CANCEL"] = 1; + return values; + })(); + + return ScheduledCallEditMessage; + })(); + + Message.SendPaymentMessage = (function() { + + /** + * Properties of a SendPaymentMessage. + * @memberof proto.Message + * @interface ISendPaymentMessage + * @property {proto.IMessage|null} [noteMessage] SendPaymentMessage noteMessage + * @property {proto.IMessageKey|null} [requestMessageKey] SendPaymentMessage requestMessageKey + * @property {proto.IPaymentBackground|null} [background] SendPaymentMessage background + */ + + /** + * Constructs a new SendPaymentMessage. + * @memberof proto.Message + * @classdesc Represents a SendPaymentMessage. + * @implements ISendPaymentMessage + * @constructor + * @param {proto.Message.ISendPaymentMessage=} [properties] Properties to set + */ + function SendPaymentMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SendPaymentMessage noteMessage. + * @member {proto.IMessage|null|undefined} noteMessage + * @memberof proto.Message.SendPaymentMessage + * @instance + */ + SendPaymentMessage.prototype.noteMessage = null; + + /** + * SendPaymentMessage requestMessageKey. + * @member {proto.IMessageKey|null|undefined} requestMessageKey + * @memberof proto.Message.SendPaymentMessage + * @instance + */ + SendPaymentMessage.prototype.requestMessageKey = null; + + /** + * SendPaymentMessage background. + * @member {proto.IPaymentBackground|null|undefined} background + * @memberof proto.Message.SendPaymentMessage + * @instance + */ + SendPaymentMessage.prototype.background = null; + + /** + * Creates a new SendPaymentMessage instance using the specified properties. + * @function create + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {proto.Message.ISendPaymentMessage=} [properties] Properties to set + * @returns {proto.Message.SendPaymentMessage} SendPaymentMessage instance + */ + SendPaymentMessage.create = function create(properties) { + return new SendPaymentMessage(properties); + }; + + /** + * Encodes the specified SendPaymentMessage message. Does not implicitly {@link proto.Message.SendPaymentMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {proto.Message.ISendPaymentMessage} message SendPaymentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SendPaymentMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.noteMessage != null && Object.hasOwnProperty.call(message, "noteMessage")) + $root.proto.Message.encode(message.noteMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.requestMessageKey != null && Object.hasOwnProperty.call(message, "requestMessageKey")) + $root.proto.MessageKey.encode(message.requestMessageKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.background != null && Object.hasOwnProperty.call(message, "background")) + $root.proto.PaymentBackground.encode(message.background, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SendPaymentMessage message, length delimited. Does not implicitly {@link proto.Message.SendPaymentMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {proto.Message.ISendPaymentMessage} message SendPaymentMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SendPaymentMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SendPaymentMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.SendPaymentMessage} SendPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SendPaymentMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.SendPaymentMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.noteMessage = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 3: + message.requestMessageKey = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 4: + message.background = $root.proto.PaymentBackground.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SendPaymentMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.SendPaymentMessage} SendPaymentMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SendPaymentMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SendPaymentMessage message. + * @function verify + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SendPaymentMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.noteMessage != null && message.hasOwnProperty("noteMessage")) { + var error = $root.proto.Message.verify(message.noteMessage); + if (error) + return "noteMessage." + error; + } + if (message.requestMessageKey != null && message.hasOwnProperty("requestMessageKey")) { + var error = $root.proto.MessageKey.verify(message.requestMessageKey); + if (error) + return "requestMessageKey." + error; + } + if (message.background != null && message.hasOwnProperty("background")) { + var error = $root.proto.PaymentBackground.verify(message.background); + if (error) + return "background." + error; + } + return null; + }; + + /** + * Creates a SendPaymentMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.SendPaymentMessage} SendPaymentMessage + */ + SendPaymentMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.SendPaymentMessage) + return object; + var message = new $root.proto.Message.SendPaymentMessage(); + if (object.noteMessage != null) { + if (typeof object.noteMessage !== "object") + throw TypeError(".proto.Message.SendPaymentMessage.noteMessage: object expected"); + message.noteMessage = $root.proto.Message.fromObject(object.noteMessage); + } + if (object.requestMessageKey != null) { + if (typeof object.requestMessageKey !== "object") + throw TypeError(".proto.Message.SendPaymentMessage.requestMessageKey: object expected"); + message.requestMessageKey = $root.proto.MessageKey.fromObject(object.requestMessageKey); + } + if (object.background != null) { + if (typeof object.background !== "object") + throw TypeError(".proto.Message.SendPaymentMessage.background: object expected"); + message.background = $root.proto.PaymentBackground.fromObject(object.background); + } + return message; + }; + + /** + * Creates a plain object from a SendPaymentMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.SendPaymentMessage + * @static + * @param {proto.Message.SendPaymentMessage} message SendPaymentMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SendPaymentMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.noteMessage = null; + object.requestMessageKey = null; + object.background = null; + } + if (message.noteMessage != null && message.hasOwnProperty("noteMessage")) + object.noteMessage = $root.proto.Message.toObject(message.noteMessage, options); + if (message.requestMessageKey != null && message.hasOwnProperty("requestMessageKey")) + object.requestMessageKey = $root.proto.MessageKey.toObject(message.requestMessageKey, options); + if (message.background != null && message.hasOwnProperty("background")) + object.background = $root.proto.PaymentBackground.toObject(message.background, options); + return object; + }; + + /** + * Converts this SendPaymentMessage to JSON. + * @function toJSON + * @memberof proto.Message.SendPaymentMessage + * @instance + * @returns {Object.} JSON object + */ + SendPaymentMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SendPaymentMessage; + })(); + + Message.SenderKeyDistributionMessage = (function() { + + /** + * Properties of a SenderKeyDistributionMessage. + * @memberof proto.Message + * @interface ISenderKeyDistributionMessage + * @property {string|null} [groupId] SenderKeyDistributionMessage groupId + * @property {Uint8Array|null} [axolotlSenderKeyDistributionMessage] SenderKeyDistributionMessage axolotlSenderKeyDistributionMessage + */ + + /** + * Constructs a new SenderKeyDistributionMessage. + * @memberof proto.Message + * @classdesc Represents a SenderKeyDistributionMessage. + * @implements ISenderKeyDistributionMessage + * @constructor + * @param {proto.Message.ISenderKeyDistributionMessage=} [properties] Properties to set + */ + function SenderKeyDistributionMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyDistributionMessage groupId. + * @member {string} groupId + * @memberof proto.Message.SenderKeyDistributionMessage + * @instance + */ + SenderKeyDistributionMessage.prototype.groupId = ""; + + /** + * SenderKeyDistributionMessage axolotlSenderKeyDistributionMessage. + * @member {Uint8Array} axolotlSenderKeyDistributionMessage + * @memberof proto.Message.SenderKeyDistributionMessage + * @instance + */ + SenderKeyDistributionMessage.prototype.axolotlSenderKeyDistributionMessage = $util.newBuffer([]); + + /** + * Creates a new SenderKeyDistributionMessage instance using the specified properties. + * @function create + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {proto.Message.ISenderKeyDistributionMessage=} [properties] Properties to set + * @returns {proto.Message.SenderKeyDistributionMessage} SenderKeyDistributionMessage instance + */ + SenderKeyDistributionMessage.create = function create(properties) { + return new SenderKeyDistributionMessage(properties); + }; + + /** + * Encodes the specified SenderKeyDistributionMessage message. Does not implicitly {@link proto.Message.SenderKeyDistributionMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {proto.Message.ISenderKeyDistributionMessage} message SenderKeyDistributionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyDistributionMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.groupId != null && Object.hasOwnProperty.call(message, "groupId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.groupId); + if (message.axolotlSenderKeyDistributionMessage != null && Object.hasOwnProperty.call(message, "axolotlSenderKeyDistributionMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.axolotlSenderKeyDistributionMessage); + return writer; + }; + + /** + * Encodes the specified SenderKeyDistributionMessage message, length delimited. Does not implicitly {@link proto.Message.SenderKeyDistributionMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {proto.Message.ISenderKeyDistributionMessage} message SenderKeyDistributionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyDistributionMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyDistributionMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.SenderKeyDistributionMessage} SenderKeyDistributionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyDistributionMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.SenderKeyDistributionMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.string(); + break; + case 2: + message.axolotlSenderKeyDistributionMessage = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyDistributionMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.SenderKeyDistributionMessage} SenderKeyDistributionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyDistributionMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyDistributionMessage message. + * @function verify + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyDistributionMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.groupId != null && message.hasOwnProperty("groupId")) + if (!$util.isString(message.groupId)) + return "groupId: string expected"; + if (message.axolotlSenderKeyDistributionMessage != null && message.hasOwnProperty("axolotlSenderKeyDistributionMessage")) + if (!(message.axolotlSenderKeyDistributionMessage && typeof message.axolotlSenderKeyDistributionMessage.length === "number" || $util.isString(message.axolotlSenderKeyDistributionMessage))) + return "axolotlSenderKeyDistributionMessage: buffer expected"; + return null; + }; + + /** + * Creates a SenderKeyDistributionMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.SenderKeyDistributionMessage} SenderKeyDistributionMessage + */ + SenderKeyDistributionMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.SenderKeyDistributionMessage) + return object; + var message = new $root.proto.Message.SenderKeyDistributionMessage(); + if (object.groupId != null) + message.groupId = String(object.groupId); + if (object.axolotlSenderKeyDistributionMessage != null) + if (typeof object.axolotlSenderKeyDistributionMessage === "string") + $util.base64.decode(object.axolotlSenderKeyDistributionMessage, message.axolotlSenderKeyDistributionMessage = $util.newBuffer($util.base64.length(object.axolotlSenderKeyDistributionMessage)), 0); + else if (object.axolotlSenderKeyDistributionMessage.length) + message.axolotlSenderKeyDistributionMessage = object.axolotlSenderKeyDistributionMessage; + return message; + }; + + /** + * Creates a plain object from a SenderKeyDistributionMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.SenderKeyDistributionMessage + * @static + * @param {proto.Message.SenderKeyDistributionMessage} message SenderKeyDistributionMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyDistributionMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.groupId = ""; + if (options.bytes === String) + object.axolotlSenderKeyDistributionMessage = ""; + else { + object.axolotlSenderKeyDistributionMessage = []; + if (options.bytes !== Array) + object.axolotlSenderKeyDistributionMessage = $util.newBuffer(object.axolotlSenderKeyDistributionMessage); + } + } + if (message.groupId != null && message.hasOwnProperty("groupId")) + object.groupId = message.groupId; + if (message.axolotlSenderKeyDistributionMessage != null && message.hasOwnProperty("axolotlSenderKeyDistributionMessage")) + object.axolotlSenderKeyDistributionMessage = options.bytes === String ? $util.base64.encode(message.axolotlSenderKeyDistributionMessage, 0, message.axolotlSenderKeyDistributionMessage.length) : options.bytes === Array ? Array.prototype.slice.call(message.axolotlSenderKeyDistributionMessage) : message.axolotlSenderKeyDistributionMessage; + return object; + }; + + /** + * Converts this SenderKeyDistributionMessage to JSON. + * @function toJSON + * @memberof proto.Message.SenderKeyDistributionMessage + * @instance + * @returns {Object.} JSON object + */ + SenderKeyDistributionMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderKeyDistributionMessage; + })(); + + Message.StickerMessage = (function() { + + /** + * Properties of a StickerMessage. + * @memberof proto.Message + * @interface IStickerMessage + * @property {string|null} [url] StickerMessage url + * @property {Uint8Array|null} [fileSha256] StickerMessage fileSha256 + * @property {Uint8Array|null} [fileEncSha256] StickerMessage fileEncSha256 + * @property {Uint8Array|null} [mediaKey] StickerMessage mediaKey + * @property {string|null} [mimetype] StickerMessage mimetype + * @property {number|null} [height] StickerMessage height + * @property {number|null} [width] StickerMessage width + * @property {string|null} [directPath] StickerMessage directPath + * @property {number|Long|null} [fileLength] StickerMessage fileLength + * @property {number|Long|null} [mediaKeyTimestamp] StickerMessage mediaKeyTimestamp + * @property {number|null} [firstFrameLength] StickerMessage firstFrameLength + * @property {Uint8Array|null} [firstFrameSidecar] StickerMessage firstFrameSidecar + * @property {boolean|null} [isAnimated] StickerMessage isAnimated + * @property {Uint8Array|null} [pngThumbnail] StickerMessage pngThumbnail + * @property {proto.IContextInfo|null} [contextInfo] StickerMessage contextInfo + * @property {number|Long|null} [stickerSentTs] StickerMessage stickerSentTs + * @property {boolean|null} [isAvatar] StickerMessage isAvatar + */ + + /** + * Constructs a new StickerMessage. + * @memberof proto.Message + * @classdesc Represents a StickerMessage. + * @implements IStickerMessage + * @constructor + * @param {proto.Message.IStickerMessage=} [properties] Properties to set + */ + function StickerMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StickerMessage url. + * @member {string} url + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.url = ""; + + /** + * StickerMessage fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.fileSha256 = $util.newBuffer([]); + + /** + * StickerMessage fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * StickerMessage mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.mediaKey = $util.newBuffer([]); + + /** + * StickerMessage mimetype. + * @member {string} mimetype + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.mimetype = ""; + + /** + * StickerMessage height. + * @member {number} height + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.height = 0; + + /** + * StickerMessage width. + * @member {number} width + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.width = 0; + + /** + * StickerMessage directPath. + * @member {string} directPath + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.directPath = ""; + + /** + * StickerMessage fileLength. + * @member {number|Long} fileLength + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * StickerMessage mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * StickerMessage firstFrameLength. + * @member {number} firstFrameLength + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.firstFrameLength = 0; + + /** + * StickerMessage firstFrameSidecar. + * @member {Uint8Array} firstFrameSidecar + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.firstFrameSidecar = $util.newBuffer([]); + + /** + * StickerMessage isAnimated. + * @member {boolean} isAnimated + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.isAnimated = false; + + /** + * StickerMessage pngThumbnail. + * @member {Uint8Array} pngThumbnail + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.pngThumbnail = $util.newBuffer([]); + + /** + * StickerMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.contextInfo = null; + + /** + * StickerMessage stickerSentTs. + * @member {number|Long} stickerSentTs + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.stickerSentTs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * StickerMessage isAvatar. + * @member {boolean} isAvatar + * @memberof proto.Message.StickerMessage + * @instance + */ + StickerMessage.prototype.isAvatar = false; + + /** + * Creates a new StickerMessage instance using the specified properties. + * @function create + * @memberof proto.Message.StickerMessage + * @static + * @param {proto.Message.IStickerMessage=} [properties] Properties to set + * @returns {proto.Message.StickerMessage} StickerMessage instance + */ + StickerMessage.create = function create(properties) { + return new StickerMessage(properties); + }; + + /** + * Encodes the specified StickerMessage message. Does not implicitly {@link proto.Message.StickerMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.StickerMessage + * @static + * @param {proto.Message.IStickerMessage} message StickerMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.fileSha256); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.fileEncSha256); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.mediaKey); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.mimetype); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.width); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.directPath); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 9, wireType 0 =*/72).uint64(message.fileLength); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.mediaKeyTimestamp); + if (message.firstFrameLength != null && Object.hasOwnProperty.call(message, "firstFrameLength")) + writer.uint32(/* id 11, wireType 0 =*/88).uint32(message.firstFrameLength); + if (message.firstFrameSidecar != null && Object.hasOwnProperty.call(message, "firstFrameSidecar")) + writer.uint32(/* id 12, wireType 2 =*/98).bytes(message.firstFrameSidecar); + if (message.isAnimated != null && Object.hasOwnProperty.call(message, "isAnimated")) + writer.uint32(/* id 13, wireType 0 =*/104).bool(message.isAnimated); + if (message.pngThumbnail != null && Object.hasOwnProperty.call(message, "pngThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.pngThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.stickerSentTs != null && Object.hasOwnProperty.call(message, "stickerSentTs")) + writer.uint32(/* id 18, wireType 0 =*/144).int64(message.stickerSentTs); + if (message.isAvatar != null && Object.hasOwnProperty.call(message, "isAvatar")) + writer.uint32(/* id 19, wireType 0 =*/152).bool(message.isAvatar); + return writer; + }; + + /** + * Encodes the specified StickerMessage message, length delimited. Does not implicitly {@link proto.Message.StickerMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.StickerMessage + * @static + * @param {proto.Message.IStickerMessage} message StickerMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StickerMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.StickerMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.StickerMessage} StickerMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.StickerMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.fileSha256 = reader.bytes(); + break; + case 3: + message.fileEncSha256 = reader.bytes(); + break; + case 4: + message.mediaKey = reader.bytes(); + break; + case 5: + message.mimetype = reader.string(); + break; + case 6: + message.height = reader.uint32(); + break; + case 7: + message.width = reader.uint32(); + break; + case 8: + message.directPath = reader.string(); + break; + case 9: + message.fileLength = reader.uint64(); + break; + case 10: + message.mediaKeyTimestamp = reader.int64(); + break; + case 11: + message.firstFrameLength = reader.uint32(); + break; + case 12: + message.firstFrameSidecar = reader.bytes(); + break; + case 13: + message.isAnimated = reader.bool(); + break; + case 16: + message.pngThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 18: + message.stickerSentTs = reader.int64(); + break; + case 19: + message.isAvatar = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StickerMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.StickerMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.StickerMessage} StickerMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StickerMessage message. + * @function verify + * @memberof proto.Message.StickerMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StickerMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.firstFrameLength != null && message.hasOwnProperty("firstFrameLength")) + if (!$util.isInteger(message.firstFrameLength)) + return "firstFrameLength: integer expected"; + if (message.firstFrameSidecar != null && message.hasOwnProperty("firstFrameSidecar")) + if (!(message.firstFrameSidecar && typeof message.firstFrameSidecar.length === "number" || $util.isString(message.firstFrameSidecar))) + return "firstFrameSidecar: buffer expected"; + if (message.isAnimated != null && message.hasOwnProperty("isAnimated")) + if (typeof message.isAnimated !== "boolean") + return "isAnimated: boolean expected"; + if (message.pngThumbnail != null && message.hasOwnProperty("pngThumbnail")) + if (!(message.pngThumbnail && typeof message.pngThumbnail.length === "number" || $util.isString(message.pngThumbnail))) + return "pngThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.stickerSentTs != null && message.hasOwnProperty("stickerSentTs")) + if (!$util.isInteger(message.stickerSentTs) && !(message.stickerSentTs && $util.isInteger(message.stickerSentTs.low) && $util.isInteger(message.stickerSentTs.high))) + return "stickerSentTs: integer|Long expected"; + if (message.isAvatar != null && message.hasOwnProperty("isAvatar")) + if (typeof message.isAvatar !== "boolean") + return "isAvatar: boolean expected"; + return null; + }; + + /** + * Creates a StickerMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.StickerMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.StickerMessage} StickerMessage + */ + StickerMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.StickerMessage) + return object; + var message = new $root.proto.Message.StickerMessage(); + if (object.url != null) + message.url = String(object.url); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.height != null) + message.height = object.height >>> 0; + if (object.width != null) + message.width = object.width >>> 0; + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.firstFrameLength != null) + message.firstFrameLength = object.firstFrameLength >>> 0; + if (object.firstFrameSidecar != null) + if (typeof object.firstFrameSidecar === "string") + $util.base64.decode(object.firstFrameSidecar, message.firstFrameSidecar = $util.newBuffer($util.base64.length(object.firstFrameSidecar)), 0); + else if (object.firstFrameSidecar.length) + message.firstFrameSidecar = object.firstFrameSidecar; + if (object.isAnimated != null) + message.isAnimated = Boolean(object.isAnimated); + if (object.pngThumbnail != null) + if (typeof object.pngThumbnail === "string") + $util.base64.decode(object.pngThumbnail, message.pngThumbnail = $util.newBuffer($util.base64.length(object.pngThumbnail)), 0); + else if (object.pngThumbnail.length) + message.pngThumbnail = object.pngThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.StickerMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.stickerSentTs != null) + if ($util.Long) + (message.stickerSentTs = $util.Long.fromValue(object.stickerSentTs)).unsigned = false; + else if (typeof object.stickerSentTs === "string") + message.stickerSentTs = parseInt(object.stickerSentTs, 10); + else if (typeof object.stickerSentTs === "number") + message.stickerSentTs = object.stickerSentTs; + else if (typeof object.stickerSentTs === "object") + message.stickerSentTs = new $util.LongBits(object.stickerSentTs.low >>> 0, object.stickerSentTs.high >>> 0).toNumber(); + if (object.isAvatar != null) + message.isAvatar = Boolean(object.isAvatar); + return message; + }; + + /** + * Creates a plain object from a StickerMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.StickerMessage + * @static + * @param {proto.Message.StickerMessage} message StickerMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StickerMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + object.mimetype = ""; + object.height = 0; + object.width = 0; + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + object.firstFrameLength = 0; + if (options.bytes === String) + object.firstFrameSidecar = ""; + else { + object.firstFrameSidecar = []; + if (options.bytes !== Array) + object.firstFrameSidecar = $util.newBuffer(object.firstFrameSidecar); + } + object.isAnimated = false; + if (options.bytes === String) + object.pngThumbnail = ""; + else { + object.pngThumbnail = []; + if (options.bytes !== Array) + object.pngThumbnail = $util.newBuffer(object.pngThumbnail); + } + object.contextInfo = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.stickerSentTs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.stickerSentTs = options.longs === String ? "0" : 0; + object.isAvatar = false; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.firstFrameLength != null && message.hasOwnProperty("firstFrameLength")) + object.firstFrameLength = message.firstFrameLength; + if (message.firstFrameSidecar != null && message.hasOwnProperty("firstFrameSidecar")) + object.firstFrameSidecar = options.bytes === String ? $util.base64.encode(message.firstFrameSidecar, 0, message.firstFrameSidecar.length) : options.bytes === Array ? Array.prototype.slice.call(message.firstFrameSidecar) : message.firstFrameSidecar; + if (message.isAnimated != null && message.hasOwnProperty("isAnimated")) + object.isAnimated = message.isAnimated; + if (message.pngThumbnail != null && message.hasOwnProperty("pngThumbnail")) + object.pngThumbnail = options.bytes === String ? $util.base64.encode(message.pngThumbnail, 0, message.pngThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.pngThumbnail) : message.pngThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.stickerSentTs != null && message.hasOwnProperty("stickerSentTs")) + if (typeof message.stickerSentTs === "number") + object.stickerSentTs = options.longs === String ? String(message.stickerSentTs) : message.stickerSentTs; + else + object.stickerSentTs = options.longs === String ? $util.Long.prototype.toString.call(message.stickerSentTs) : options.longs === Number ? new $util.LongBits(message.stickerSentTs.low >>> 0, message.stickerSentTs.high >>> 0).toNumber() : message.stickerSentTs; + if (message.isAvatar != null && message.hasOwnProperty("isAvatar")) + object.isAvatar = message.isAvatar; + return object; + }; + + /** + * Converts this StickerMessage to JSON. + * @function toJSON + * @memberof proto.Message.StickerMessage + * @instance + * @returns {Object.} JSON object + */ + StickerMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StickerMessage; + })(); + + Message.StickerSyncRMRMessage = (function() { + + /** + * Properties of a StickerSyncRMRMessage. + * @memberof proto.Message + * @interface IStickerSyncRMRMessage + * @property {Array.|null} [filehash] StickerSyncRMRMessage filehash + * @property {string|null} [rmrSource] StickerSyncRMRMessage rmrSource + * @property {number|Long|null} [requestTimestamp] StickerSyncRMRMessage requestTimestamp + */ + + /** + * Constructs a new StickerSyncRMRMessage. + * @memberof proto.Message + * @classdesc Represents a StickerSyncRMRMessage. + * @implements IStickerSyncRMRMessage + * @constructor + * @param {proto.Message.IStickerSyncRMRMessage=} [properties] Properties to set + */ + function StickerSyncRMRMessage(properties) { + this.filehash = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StickerSyncRMRMessage filehash. + * @member {Array.} filehash + * @memberof proto.Message.StickerSyncRMRMessage + * @instance + */ + StickerSyncRMRMessage.prototype.filehash = $util.emptyArray; + + /** + * StickerSyncRMRMessage rmrSource. + * @member {string} rmrSource + * @memberof proto.Message.StickerSyncRMRMessage + * @instance + */ + StickerSyncRMRMessage.prototype.rmrSource = ""; + + /** + * StickerSyncRMRMessage requestTimestamp. + * @member {number|Long} requestTimestamp + * @memberof proto.Message.StickerSyncRMRMessage + * @instance + */ + StickerSyncRMRMessage.prototype.requestTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StickerSyncRMRMessage instance using the specified properties. + * @function create + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {proto.Message.IStickerSyncRMRMessage=} [properties] Properties to set + * @returns {proto.Message.StickerSyncRMRMessage} StickerSyncRMRMessage instance + */ + StickerSyncRMRMessage.create = function create(properties) { + return new StickerSyncRMRMessage(properties); + }; + + /** + * Encodes the specified StickerSyncRMRMessage message. Does not implicitly {@link proto.Message.StickerSyncRMRMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {proto.Message.IStickerSyncRMRMessage} message StickerSyncRMRMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerSyncRMRMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filehash != null && message.filehash.length) + for (var i = 0; i < message.filehash.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filehash[i]); + if (message.rmrSource != null && Object.hasOwnProperty.call(message, "rmrSource")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.rmrSource); + if (message.requestTimestamp != null && Object.hasOwnProperty.call(message, "requestTimestamp")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.requestTimestamp); + return writer; + }; + + /** + * Encodes the specified StickerSyncRMRMessage message, length delimited. Does not implicitly {@link proto.Message.StickerSyncRMRMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {proto.Message.IStickerSyncRMRMessage} message StickerSyncRMRMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerSyncRMRMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StickerSyncRMRMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.StickerSyncRMRMessage} StickerSyncRMRMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerSyncRMRMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.StickerSyncRMRMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.filehash && message.filehash.length)) + message.filehash = []; + message.filehash.push(reader.string()); + break; + case 2: + message.rmrSource = reader.string(); + break; + case 3: + message.requestTimestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StickerSyncRMRMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.StickerSyncRMRMessage} StickerSyncRMRMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerSyncRMRMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StickerSyncRMRMessage message. + * @function verify + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StickerSyncRMRMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filehash != null && message.hasOwnProperty("filehash")) { + if (!Array.isArray(message.filehash)) + return "filehash: array expected"; + for (var i = 0; i < message.filehash.length; ++i) + if (!$util.isString(message.filehash[i])) + return "filehash: string[] expected"; + } + if (message.rmrSource != null && message.hasOwnProperty("rmrSource")) + if (!$util.isString(message.rmrSource)) + return "rmrSource: string expected"; + if (message.requestTimestamp != null && message.hasOwnProperty("requestTimestamp")) + if (!$util.isInteger(message.requestTimestamp) && !(message.requestTimestamp && $util.isInteger(message.requestTimestamp.low) && $util.isInteger(message.requestTimestamp.high))) + return "requestTimestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a StickerSyncRMRMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.StickerSyncRMRMessage} StickerSyncRMRMessage + */ + StickerSyncRMRMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.StickerSyncRMRMessage) + return object; + var message = new $root.proto.Message.StickerSyncRMRMessage(); + if (object.filehash) { + if (!Array.isArray(object.filehash)) + throw TypeError(".proto.Message.StickerSyncRMRMessage.filehash: array expected"); + message.filehash = []; + for (var i = 0; i < object.filehash.length; ++i) + message.filehash[i] = String(object.filehash[i]); + } + if (object.rmrSource != null) + message.rmrSource = String(object.rmrSource); + if (object.requestTimestamp != null) + if ($util.Long) + (message.requestTimestamp = $util.Long.fromValue(object.requestTimestamp)).unsigned = false; + else if (typeof object.requestTimestamp === "string") + message.requestTimestamp = parseInt(object.requestTimestamp, 10); + else if (typeof object.requestTimestamp === "number") + message.requestTimestamp = object.requestTimestamp; + else if (typeof object.requestTimestamp === "object") + message.requestTimestamp = new $util.LongBits(object.requestTimestamp.low >>> 0, object.requestTimestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StickerSyncRMRMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.StickerSyncRMRMessage + * @static + * @param {proto.Message.StickerSyncRMRMessage} message StickerSyncRMRMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StickerSyncRMRMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.filehash = []; + if (options.defaults) { + object.rmrSource = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.requestTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.requestTimestamp = options.longs === String ? "0" : 0; + } + if (message.filehash && message.filehash.length) { + object.filehash = []; + for (var j = 0; j < message.filehash.length; ++j) + object.filehash[j] = message.filehash[j]; + } + if (message.rmrSource != null && message.hasOwnProperty("rmrSource")) + object.rmrSource = message.rmrSource; + if (message.requestTimestamp != null && message.hasOwnProperty("requestTimestamp")) + if (typeof message.requestTimestamp === "number") + object.requestTimestamp = options.longs === String ? String(message.requestTimestamp) : message.requestTimestamp; + else + object.requestTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.requestTimestamp) : options.longs === Number ? new $util.LongBits(message.requestTimestamp.low >>> 0, message.requestTimestamp.high >>> 0).toNumber() : message.requestTimestamp; + return object; + }; + + /** + * Converts this StickerSyncRMRMessage to JSON. + * @function toJSON + * @memberof proto.Message.StickerSyncRMRMessage + * @instance + * @returns {Object.} JSON object + */ + StickerSyncRMRMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StickerSyncRMRMessage; + })(); + + Message.TemplateButtonReplyMessage = (function() { + + /** + * Properties of a TemplateButtonReplyMessage. + * @memberof proto.Message + * @interface ITemplateButtonReplyMessage + * @property {string|null} [selectedId] TemplateButtonReplyMessage selectedId + * @property {string|null} [selectedDisplayText] TemplateButtonReplyMessage selectedDisplayText + * @property {proto.IContextInfo|null} [contextInfo] TemplateButtonReplyMessage contextInfo + * @property {number|null} [selectedIndex] TemplateButtonReplyMessage selectedIndex + */ + + /** + * Constructs a new TemplateButtonReplyMessage. + * @memberof proto.Message + * @classdesc Represents a TemplateButtonReplyMessage. + * @implements ITemplateButtonReplyMessage + * @constructor + * @param {proto.Message.ITemplateButtonReplyMessage=} [properties] Properties to set + */ + function TemplateButtonReplyMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TemplateButtonReplyMessage selectedId. + * @member {string} selectedId + * @memberof proto.Message.TemplateButtonReplyMessage + * @instance + */ + TemplateButtonReplyMessage.prototype.selectedId = ""; + + /** + * TemplateButtonReplyMessage selectedDisplayText. + * @member {string} selectedDisplayText + * @memberof proto.Message.TemplateButtonReplyMessage + * @instance + */ + TemplateButtonReplyMessage.prototype.selectedDisplayText = ""; + + /** + * TemplateButtonReplyMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.TemplateButtonReplyMessage + * @instance + */ + TemplateButtonReplyMessage.prototype.contextInfo = null; + + /** + * TemplateButtonReplyMessage selectedIndex. + * @member {number} selectedIndex + * @memberof proto.Message.TemplateButtonReplyMessage + * @instance + */ + TemplateButtonReplyMessage.prototype.selectedIndex = 0; + + /** + * Creates a new TemplateButtonReplyMessage instance using the specified properties. + * @function create + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {proto.Message.ITemplateButtonReplyMessage=} [properties] Properties to set + * @returns {proto.Message.TemplateButtonReplyMessage} TemplateButtonReplyMessage instance + */ + TemplateButtonReplyMessage.create = function create(properties) { + return new TemplateButtonReplyMessage(properties); + }; + + /** + * Encodes the specified TemplateButtonReplyMessage message. Does not implicitly {@link proto.Message.TemplateButtonReplyMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {proto.Message.ITemplateButtonReplyMessage} message TemplateButtonReplyMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemplateButtonReplyMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selectedId != null && Object.hasOwnProperty.call(message, "selectedId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectedId); + if (message.selectedDisplayText != null && Object.hasOwnProperty.call(message, "selectedDisplayText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.selectedDisplayText); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.selectedIndex != null && Object.hasOwnProperty.call(message, "selectedIndex")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.selectedIndex); + return writer; + }; + + /** + * Encodes the specified TemplateButtonReplyMessage message, length delimited. Does not implicitly {@link proto.Message.TemplateButtonReplyMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {proto.Message.ITemplateButtonReplyMessage} message TemplateButtonReplyMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemplateButtonReplyMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TemplateButtonReplyMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.TemplateButtonReplyMessage} TemplateButtonReplyMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemplateButtonReplyMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.TemplateButtonReplyMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selectedId = reader.string(); + break; + case 2: + message.selectedDisplayText = reader.string(); + break; + case 3: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 4: + message.selectedIndex = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TemplateButtonReplyMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.TemplateButtonReplyMessage} TemplateButtonReplyMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemplateButtonReplyMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TemplateButtonReplyMessage message. + * @function verify + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TemplateButtonReplyMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selectedId != null && message.hasOwnProperty("selectedId")) + if (!$util.isString(message.selectedId)) + return "selectedId: string expected"; + if (message.selectedDisplayText != null && message.hasOwnProperty("selectedDisplayText")) + if (!$util.isString(message.selectedDisplayText)) + return "selectedDisplayText: string expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.selectedIndex != null && message.hasOwnProperty("selectedIndex")) + if (!$util.isInteger(message.selectedIndex)) + return "selectedIndex: integer expected"; + return null; + }; + + /** + * Creates a TemplateButtonReplyMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.TemplateButtonReplyMessage} TemplateButtonReplyMessage + */ + TemplateButtonReplyMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.TemplateButtonReplyMessage) + return object; + var message = new $root.proto.Message.TemplateButtonReplyMessage(); + if (object.selectedId != null) + message.selectedId = String(object.selectedId); + if (object.selectedDisplayText != null) + message.selectedDisplayText = String(object.selectedDisplayText); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.TemplateButtonReplyMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.selectedIndex != null) + message.selectedIndex = object.selectedIndex >>> 0; + return message; + }; + + /** + * Creates a plain object from a TemplateButtonReplyMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.TemplateButtonReplyMessage + * @static + * @param {proto.Message.TemplateButtonReplyMessage} message TemplateButtonReplyMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TemplateButtonReplyMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.selectedId = ""; + object.selectedDisplayText = ""; + object.contextInfo = null; + object.selectedIndex = 0; + } + if (message.selectedId != null && message.hasOwnProperty("selectedId")) + object.selectedId = message.selectedId; + if (message.selectedDisplayText != null && message.hasOwnProperty("selectedDisplayText")) + object.selectedDisplayText = message.selectedDisplayText; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.selectedIndex != null && message.hasOwnProperty("selectedIndex")) + object.selectedIndex = message.selectedIndex; + return object; + }; + + /** + * Converts this TemplateButtonReplyMessage to JSON. + * @function toJSON + * @memberof proto.Message.TemplateButtonReplyMessage + * @instance + * @returns {Object.} JSON object + */ + TemplateButtonReplyMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TemplateButtonReplyMessage; + })(); + + Message.TemplateMessage = (function() { + + /** + * Properties of a TemplateMessage. + * @memberof proto.Message + * @interface ITemplateMessage + * @property {proto.IContextInfo|null} [contextInfo] TemplateMessage contextInfo + * @property {proto.Message.TemplateMessage.IHydratedFourRowTemplate|null} [hydratedTemplate] TemplateMessage hydratedTemplate + * @property {string|null} [templateId] TemplateMessage templateId + * @property {proto.Message.TemplateMessage.IFourRowTemplate|null} [fourRowTemplate] TemplateMessage fourRowTemplate + * @property {proto.Message.TemplateMessage.IHydratedFourRowTemplate|null} [hydratedFourRowTemplate] TemplateMessage hydratedFourRowTemplate + * @property {proto.Message.IInteractiveMessage|null} [interactiveMessageTemplate] TemplateMessage interactiveMessageTemplate + */ + + /** + * Constructs a new TemplateMessage. + * @memberof proto.Message + * @classdesc Represents a TemplateMessage. + * @implements ITemplateMessage + * @constructor + * @param {proto.Message.ITemplateMessage=} [properties] Properties to set + */ + function TemplateMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TemplateMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.TemplateMessage + * @instance + */ + TemplateMessage.prototype.contextInfo = null; + + /** + * TemplateMessage hydratedTemplate. + * @member {proto.Message.TemplateMessage.IHydratedFourRowTemplate|null|undefined} hydratedTemplate + * @memberof proto.Message.TemplateMessage + * @instance + */ + TemplateMessage.prototype.hydratedTemplate = null; + + /** + * TemplateMessage templateId. + * @member {string} templateId + * @memberof proto.Message.TemplateMessage + * @instance + */ + TemplateMessage.prototype.templateId = ""; + + /** + * TemplateMessage fourRowTemplate. + * @member {proto.Message.TemplateMessage.IFourRowTemplate|null|undefined} fourRowTemplate + * @memberof proto.Message.TemplateMessage + * @instance + */ + TemplateMessage.prototype.fourRowTemplate = null; + + /** + * TemplateMessage hydratedFourRowTemplate. + * @member {proto.Message.TemplateMessage.IHydratedFourRowTemplate|null|undefined} hydratedFourRowTemplate + * @memberof proto.Message.TemplateMessage + * @instance + */ + TemplateMessage.prototype.hydratedFourRowTemplate = null; + + /** + * TemplateMessage interactiveMessageTemplate. + * @member {proto.Message.IInteractiveMessage|null|undefined} interactiveMessageTemplate + * @memberof proto.Message.TemplateMessage + * @instance + */ + TemplateMessage.prototype.interactiveMessageTemplate = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TemplateMessage format. + * @member {"fourRowTemplate"|"hydratedFourRowTemplate"|"interactiveMessageTemplate"|undefined} format + * @memberof proto.Message.TemplateMessage + * @instance + */ + Object.defineProperty(TemplateMessage.prototype, "format", { + get: $util.oneOfGetter($oneOfFields = ["fourRowTemplate", "hydratedFourRowTemplate", "interactiveMessageTemplate"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TemplateMessage instance using the specified properties. + * @function create + * @memberof proto.Message.TemplateMessage + * @static + * @param {proto.Message.ITemplateMessage=} [properties] Properties to set + * @returns {proto.Message.TemplateMessage} TemplateMessage instance + */ + TemplateMessage.create = function create(properties) { + return new TemplateMessage(properties); + }; + + /** + * Encodes the specified TemplateMessage message. Does not implicitly {@link proto.Message.TemplateMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.TemplateMessage + * @static + * @param {proto.Message.ITemplateMessage} message TemplateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemplateMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fourRowTemplate != null && Object.hasOwnProperty.call(message, "fourRowTemplate")) + $root.proto.Message.TemplateMessage.FourRowTemplate.encode(message.fourRowTemplate, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.hydratedFourRowTemplate != null && Object.hasOwnProperty.call(message, "hydratedFourRowTemplate")) + $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.encode(message.hydratedFourRowTemplate, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.hydratedTemplate != null && Object.hasOwnProperty.call(message, "hydratedTemplate")) + $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.encode(message.hydratedTemplate, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.interactiveMessageTemplate != null && Object.hasOwnProperty.call(message, "interactiveMessageTemplate")) + $root.proto.Message.InteractiveMessage.encode(message.interactiveMessageTemplate, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.templateId != null && Object.hasOwnProperty.call(message, "templateId")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.templateId); + return writer; + }; + + /** + * Encodes the specified TemplateMessage message, length delimited. Does not implicitly {@link proto.Message.TemplateMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.TemplateMessage + * @static + * @param {proto.Message.ITemplateMessage} message TemplateMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemplateMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TemplateMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.TemplateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.TemplateMessage} TemplateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemplateMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.TemplateMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 4: + message.hydratedTemplate = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.decode(reader, reader.uint32()); + break; + case 9: + message.templateId = reader.string(); + break; + case 1: + message.fourRowTemplate = $root.proto.Message.TemplateMessage.FourRowTemplate.decode(reader, reader.uint32()); + break; + case 2: + message.hydratedFourRowTemplate = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.decode(reader, reader.uint32()); + break; + case 5: + message.interactiveMessageTemplate = $root.proto.Message.InteractiveMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TemplateMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.TemplateMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.TemplateMessage} TemplateMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemplateMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TemplateMessage message. + * @function verify + * @memberof proto.Message.TemplateMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TemplateMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.hydratedTemplate != null && message.hasOwnProperty("hydratedTemplate")) { + var error = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.verify(message.hydratedTemplate); + if (error) + return "hydratedTemplate." + error; + } + if (message.templateId != null && message.hasOwnProperty("templateId")) + if (!$util.isString(message.templateId)) + return "templateId: string expected"; + if (message.fourRowTemplate != null && message.hasOwnProperty("fourRowTemplate")) { + properties.format = 1; + { + var error = $root.proto.Message.TemplateMessage.FourRowTemplate.verify(message.fourRowTemplate); + if (error) + return "fourRowTemplate." + error; + } + } + if (message.hydratedFourRowTemplate != null && message.hasOwnProperty("hydratedFourRowTemplate")) { + if (properties.format === 1) + return "format: multiple values"; + properties.format = 1; + { + var error = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.verify(message.hydratedFourRowTemplate); + if (error) + return "hydratedFourRowTemplate." + error; + } + } + if (message.interactiveMessageTemplate != null && message.hasOwnProperty("interactiveMessageTemplate")) { + if (properties.format === 1) + return "format: multiple values"; + properties.format = 1; + { + var error = $root.proto.Message.InteractiveMessage.verify(message.interactiveMessageTemplate); + if (error) + return "interactiveMessageTemplate." + error; + } + } + return null; + }; + + /** + * Creates a TemplateMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.TemplateMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.TemplateMessage} TemplateMessage + */ + TemplateMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.TemplateMessage) + return object; + var message = new $root.proto.Message.TemplateMessage(); + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.TemplateMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.hydratedTemplate != null) { + if (typeof object.hydratedTemplate !== "object") + throw TypeError(".proto.Message.TemplateMessage.hydratedTemplate: object expected"); + message.hydratedTemplate = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.fromObject(object.hydratedTemplate); + } + if (object.templateId != null) + message.templateId = String(object.templateId); + if (object.fourRowTemplate != null) { + if (typeof object.fourRowTemplate !== "object") + throw TypeError(".proto.Message.TemplateMessage.fourRowTemplate: object expected"); + message.fourRowTemplate = $root.proto.Message.TemplateMessage.FourRowTemplate.fromObject(object.fourRowTemplate); + } + if (object.hydratedFourRowTemplate != null) { + if (typeof object.hydratedFourRowTemplate !== "object") + throw TypeError(".proto.Message.TemplateMessage.hydratedFourRowTemplate: object expected"); + message.hydratedFourRowTemplate = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.fromObject(object.hydratedFourRowTemplate); + } + if (object.interactiveMessageTemplate != null) { + if (typeof object.interactiveMessageTemplate !== "object") + throw TypeError(".proto.Message.TemplateMessage.interactiveMessageTemplate: object expected"); + message.interactiveMessageTemplate = $root.proto.Message.InteractiveMessage.fromObject(object.interactiveMessageTemplate); + } + return message; + }; + + /** + * Creates a plain object from a TemplateMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.TemplateMessage + * @static + * @param {proto.Message.TemplateMessage} message TemplateMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TemplateMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.contextInfo = null; + object.hydratedTemplate = null; + object.templateId = ""; + } + if (message.fourRowTemplate != null && message.hasOwnProperty("fourRowTemplate")) { + object.fourRowTemplate = $root.proto.Message.TemplateMessage.FourRowTemplate.toObject(message.fourRowTemplate, options); + if (options.oneofs) + object.format = "fourRowTemplate"; + } + if (message.hydratedFourRowTemplate != null && message.hasOwnProperty("hydratedFourRowTemplate")) { + object.hydratedFourRowTemplate = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.toObject(message.hydratedFourRowTemplate, options); + if (options.oneofs) + object.format = "hydratedFourRowTemplate"; + } + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.hydratedTemplate != null && message.hasOwnProperty("hydratedTemplate")) + object.hydratedTemplate = $root.proto.Message.TemplateMessage.HydratedFourRowTemplate.toObject(message.hydratedTemplate, options); + if (message.interactiveMessageTemplate != null && message.hasOwnProperty("interactiveMessageTemplate")) { + object.interactiveMessageTemplate = $root.proto.Message.InteractiveMessage.toObject(message.interactiveMessageTemplate, options); + if (options.oneofs) + object.format = "interactiveMessageTemplate"; + } + if (message.templateId != null && message.hasOwnProperty("templateId")) + object.templateId = message.templateId; + return object; + }; + + /** + * Converts this TemplateMessage to JSON. + * @function toJSON + * @memberof proto.Message.TemplateMessage + * @instance + * @returns {Object.} JSON object + */ + TemplateMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TemplateMessage.FourRowTemplate = (function() { + + /** + * Properties of a FourRowTemplate. + * @memberof proto.Message.TemplateMessage + * @interface IFourRowTemplate + * @property {proto.Message.IHighlyStructuredMessage|null} [content] FourRowTemplate content + * @property {proto.Message.IHighlyStructuredMessage|null} [footer] FourRowTemplate footer + * @property {Array.|null} [buttons] FourRowTemplate buttons + * @property {proto.Message.IDocumentMessage|null} [documentMessage] FourRowTemplate documentMessage + * @property {proto.Message.IHighlyStructuredMessage|null} [highlyStructuredMessage] FourRowTemplate highlyStructuredMessage + * @property {proto.Message.IImageMessage|null} [imageMessage] FourRowTemplate imageMessage + * @property {proto.Message.IVideoMessage|null} [videoMessage] FourRowTemplate videoMessage + * @property {proto.Message.ILocationMessage|null} [locationMessage] FourRowTemplate locationMessage + */ + + /** + * Constructs a new FourRowTemplate. + * @memberof proto.Message.TemplateMessage + * @classdesc Represents a FourRowTemplate. + * @implements IFourRowTemplate + * @constructor + * @param {proto.Message.TemplateMessage.IFourRowTemplate=} [properties] Properties to set + */ + function FourRowTemplate(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FourRowTemplate content. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} content + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.content = null; + + /** + * FourRowTemplate footer. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} footer + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.footer = null; + + /** + * FourRowTemplate buttons. + * @member {Array.} buttons + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.buttons = $util.emptyArray; + + /** + * FourRowTemplate documentMessage. + * @member {proto.Message.IDocumentMessage|null|undefined} documentMessage + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.documentMessage = null; + + /** + * FourRowTemplate highlyStructuredMessage. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} highlyStructuredMessage + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.highlyStructuredMessage = null; + + /** + * FourRowTemplate imageMessage. + * @member {proto.Message.IImageMessage|null|undefined} imageMessage + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.imageMessage = null; + + /** + * FourRowTemplate videoMessage. + * @member {proto.Message.IVideoMessage|null|undefined} videoMessage + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.videoMessage = null; + + /** + * FourRowTemplate locationMessage. + * @member {proto.Message.ILocationMessage|null|undefined} locationMessage + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + FourRowTemplate.prototype.locationMessage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * FourRowTemplate title. + * @member {"documentMessage"|"highlyStructuredMessage"|"imageMessage"|"videoMessage"|"locationMessage"|undefined} title + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + */ + Object.defineProperty(FourRowTemplate.prototype, "title", { + get: $util.oneOfGetter($oneOfFields = ["documentMessage", "highlyStructuredMessage", "imageMessage", "videoMessage", "locationMessage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FourRowTemplate instance using the specified properties. + * @function create + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.IFourRowTemplate=} [properties] Properties to set + * @returns {proto.Message.TemplateMessage.FourRowTemplate} FourRowTemplate instance + */ + FourRowTemplate.create = function create(properties) { + return new FourRowTemplate(properties); + }; + + /** + * Encodes the specified FourRowTemplate message. Does not implicitly {@link proto.Message.TemplateMessage.FourRowTemplate.verify|verify} messages. + * @function encode + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.IFourRowTemplate} message FourRowTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FourRowTemplate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentMessage != null && Object.hasOwnProperty.call(message, "documentMessage")) + $root.proto.Message.DocumentMessage.encode(message.documentMessage, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.highlyStructuredMessage != null && Object.hasOwnProperty.call(message, "highlyStructuredMessage")) + $root.proto.Message.HighlyStructuredMessage.encode(message.highlyStructuredMessage, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageMessage != null && Object.hasOwnProperty.call(message, "imageMessage")) + $root.proto.Message.ImageMessage.encode(message.imageMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.videoMessage != null && Object.hasOwnProperty.call(message, "videoMessage")) + $root.proto.Message.VideoMessage.encode(message.videoMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.locationMessage != null && Object.hasOwnProperty.call(message, "locationMessage")) + $root.proto.Message.LocationMessage.encode(message.locationMessage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + $root.proto.Message.HighlyStructuredMessage.encode(message.content, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.footer != null && Object.hasOwnProperty.call(message, "footer")) + $root.proto.Message.HighlyStructuredMessage.encode(message.footer, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.proto.TemplateButton.encode(message.buttons[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FourRowTemplate message, length delimited. Does not implicitly {@link proto.Message.TemplateMessage.FourRowTemplate.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.IFourRowTemplate} message FourRowTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FourRowTemplate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FourRowTemplate message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.TemplateMessage.FourRowTemplate} FourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FourRowTemplate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.TemplateMessage.FourRowTemplate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.content = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 7: + message.footer = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.proto.TemplateButton.decode(reader, reader.uint32())); + break; + case 1: + message.documentMessage = $root.proto.Message.DocumentMessage.decode(reader, reader.uint32()); + break; + case 2: + message.highlyStructuredMessage = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 3: + message.imageMessage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 4: + message.videoMessage = $root.proto.Message.VideoMessage.decode(reader, reader.uint32()); + break; + case 5: + message.locationMessage = $root.proto.Message.LocationMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FourRowTemplate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.TemplateMessage.FourRowTemplate} FourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FourRowTemplate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FourRowTemplate message. + * @function verify + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FourRowTemplate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.content != null && message.hasOwnProperty("content")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.content); + if (error) + return "content." + error; + } + if (message.footer != null && message.hasOwnProperty("footer")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.footer); + if (error) + return "footer." + error; + } + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.proto.TemplateButton.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + properties.title = 1; + { + var error = $root.proto.Message.DocumentMessage.verify(message.documentMessage); + if (error) + return "documentMessage." + error; + } + } + if (message.highlyStructuredMessage != null && message.hasOwnProperty("highlyStructuredMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.highlyStructuredMessage); + if (error) + return "highlyStructuredMessage." + error; + } + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.ImageMessage.verify(message.imageMessage); + if (error) + return "imageMessage." + error; + } + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.VideoMessage.verify(message.videoMessage); + if (error) + return "videoMessage." + error; + } + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.LocationMessage.verify(message.locationMessage); + if (error) + return "locationMessage." + error; + } + } + return null; + }; + + /** + * Creates a FourRowTemplate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.TemplateMessage.FourRowTemplate} FourRowTemplate + */ + FourRowTemplate.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.TemplateMessage.FourRowTemplate) + return object; + var message = new $root.proto.Message.TemplateMessage.FourRowTemplate(); + if (object.content != null) { + if (typeof object.content !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.content: object expected"); + message.content = $root.proto.Message.HighlyStructuredMessage.fromObject(object.content); + } + if (object.footer != null) { + if (typeof object.footer !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.footer: object expected"); + message.footer = $root.proto.Message.HighlyStructuredMessage.fromObject(object.footer); + } + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.buttons: object expected"); + message.buttons[i] = $root.proto.TemplateButton.fromObject(object.buttons[i]); + } + } + if (object.documentMessage != null) { + if (typeof object.documentMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.documentMessage: object expected"); + message.documentMessage = $root.proto.Message.DocumentMessage.fromObject(object.documentMessage); + } + if (object.highlyStructuredMessage != null) { + if (typeof object.highlyStructuredMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.highlyStructuredMessage: object expected"); + message.highlyStructuredMessage = $root.proto.Message.HighlyStructuredMessage.fromObject(object.highlyStructuredMessage); + } + if (object.imageMessage != null) { + if (typeof object.imageMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.imageMessage: object expected"); + message.imageMessage = $root.proto.Message.ImageMessage.fromObject(object.imageMessage); + } + if (object.videoMessage != null) { + if (typeof object.videoMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.videoMessage: object expected"); + message.videoMessage = $root.proto.Message.VideoMessage.fromObject(object.videoMessage); + } + if (object.locationMessage != null) { + if (typeof object.locationMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.FourRowTemplate.locationMessage: object expected"); + message.locationMessage = $root.proto.Message.LocationMessage.fromObject(object.locationMessage); + } + return message; + }; + + /** + * Creates a plain object from a FourRowTemplate message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.FourRowTemplate} message FourRowTemplate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FourRowTemplate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.content = null; + object.footer = null; + } + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + object.documentMessage = $root.proto.Message.DocumentMessage.toObject(message.documentMessage, options); + if (options.oneofs) + object.title = "documentMessage"; + } + if (message.highlyStructuredMessage != null && message.hasOwnProperty("highlyStructuredMessage")) { + object.highlyStructuredMessage = $root.proto.Message.HighlyStructuredMessage.toObject(message.highlyStructuredMessage, options); + if (options.oneofs) + object.title = "highlyStructuredMessage"; + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + object.imageMessage = $root.proto.Message.ImageMessage.toObject(message.imageMessage, options); + if (options.oneofs) + object.title = "imageMessage"; + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + object.videoMessage = $root.proto.Message.VideoMessage.toObject(message.videoMessage, options); + if (options.oneofs) + object.title = "videoMessage"; + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + object.locationMessage = $root.proto.Message.LocationMessage.toObject(message.locationMessage, options); + if (options.oneofs) + object.title = "locationMessage"; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = $root.proto.Message.HighlyStructuredMessage.toObject(message.content, options); + if (message.footer != null && message.hasOwnProperty("footer")) + object.footer = $root.proto.Message.HighlyStructuredMessage.toObject(message.footer, options); + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.proto.TemplateButton.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this FourRowTemplate to JSON. + * @function toJSON + * @memberof proto.Message.TemplateMessage.FourRowTemplate + * @instance + * @returns {Object.} JSON object + */ + FourRowTemplate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FourRowTemplate; + })(); + + TemplateMessage.HydratedFourRowTemplate = (function() { + + /** + * Properties of a HydratedFourRowTemplate. + * @memberof proto.Message.TemplateMessage + * @interface IHydratedFourRowTemplate + * @property {string|null} [hydratedContentText] HydratedFourRowTemplate hydratedContentText + * @property {string|null} [hydratedFooterText] HydratedFourRowTemplate hydratedFooterText + * @property {Array.|null} [hydratedButtons] HydratedFourRowTemplate hydratedButtons + * @property {string|null} [templateId] HydratedFourRowTemplate templateId + * @property {proto.Message.IDocumentMessage|null} [documentMessage] HydratedFourRowTemplate documentMessage + * @property {string|null} [hydratedTitleText] HydratedFourRowTemplate hydratedTitleText + * @property {proto.Message.IImageMessage|null} [imageMessage] HydratedFourRowTemplate imageMessage + * @property {proto.Message.IVideoMessage|null} [videoMessage] HydratedFourRowTemplate videoMessage + * @property {proto.Message.ILocationMessage|null} [locationMessage] HydratedFourRowTemplate locationMessage + */ + + /** + * Constructs a new HydratedFourRowTemplate. + * @memberof proto.Message.TemplateMessage + * @classdesc Represents a HydratedFourRowTemplate. + * @implements IHydratedFourRowTemplate + * @constructor + * @param {proto.Message.TemplateMessage.IHydratedFourRowTemplate=} [properties] Properties to set + */ + function HydratedFourRowTemplate(properties) { + this.hydratedButtons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HydratedFourRowTemplate hydratedContentText. + * @member {string} hydratedContentText + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.hydratedContentText = ""; + + /** + * HydratedFourRowTemplate hydratedFooterText. + * @member {string} hydratedFooterText + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.hydratedFooterText = ""; + + /** + * HydratedFourRowTemplate hydratedButtons. + * @member {Array.} hydratedButtons + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.hydratedButtons = $util.emptyArray; + + /** + * HydratedFourRowTemplate templateId. + * @member {string} templateId + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.templateId = ""; + + /** + * HydratedFourRowTemplate documentMessage. + * @member {proto.Message.IDocumentMessage|null|undefined} documentMessage + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.documentMessage = null; + + /** + * HydratedFourRowTemplate hydratedTitleText. + * @member {string|null|undefined} hydratedTitleText + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.hydratedTitleText = null; + + /** + * HydratedFourRowTemplate imageMessage. + * @member {proto.Message.IImageMessage|null|undefined} imageMessage + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.imageMessage = null; + + /** + * HydratedFourRowTemplate videoMessage. + * @member {proto.Message.IVideoMessage|null|undefined} videoMessage + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.videoMessage = null; + + /** + * HydratedFourRowTemplate locationMessage. + * @member {proto.Message.ILocationMessage|null|undefined} locationMessage + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + HydratedFourRowTemplate.prototype.locationMessage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HydratedFourRowTemplate title. + * @member {"documentMessage"|"hydratedTitleText"|"imageMessage"|"videoMessage"|"locationMessage"|undefined} title + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + */ + Object.defineProperty(HydratedFourRowTemplate.prototype, "title", { + get: $util.oneOfGetter($oneOfFields = ["documentMessage", "hydratedTitleText", "imageMessage", "videoMessage", "locationMessage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HydratedFourRowTemplate instance using the specified properties. + * @function create + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.IHydratedFourRowTemplate=} [properties] Properties to set + * @returns {proto.Message.TemplateMessage.HydratedFourRowTemplate} HydratedFourRowTemplate instance + */ + HydratedFourRowTemplate.create = function create(properties) { + return new HydratedFourRowTemplate(properties); + }; + + /** + * Encodes the specified HydratedFourRowTemplate message. Does not implicitly {@link proto.Message.TemplateMessage.HydratedFourRowTemplate.verify|verify} messages. + * @function encode + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.IHydratedFourRowTemplate} message HydratedFourRowTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedFourRowTemplate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentMessage != null && Object.hasOwnProperty.call(message, "documentMessage")) + $root.proto.Message.DocumentMessage.encode(message.documentMessage, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.hydratedTitleText != null && Object.hasOwnProperty.call(message, "hydratedTitleText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.hydratedTitleText); + if (message.imageMessage != null && Object.hasOwnProperty.call(message, "imageMessage")) + $root.proto.Message.ImageMessage.encode(message.imageMessage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.videoMessage != null && Object.hasOwnProperty.call(message, "videoMessage")) + $root.proto.Message.VideoMessage.encode(message.videoMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.locationMessage != null && Object.hasOwnProperty.call(message, "locationMessage")) + $root.proto.Message.LocationMessage.encode(message.locationMessage, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.hydratedContentText != null && Object.hasOwnProperty.call(message, "hydratedContentText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.hydratedContentText); + if (message.hydratedFooterText != null && Object.hasOwnProperty.call(message, "hydratedFooterText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.hydratedFooterText); + if (message.hydratedButtons != null && message.hydratedButtons.length) + for (var i = 0; i < message.hydratedButtons.length; ++i) + $root.proto.HydratedTemplateButton.encode(message.hydratedButtons[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.templateId != null && Object.hasOwnProperty.call(message, "templateId")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.templateId); + return writer; + }; + + /** + * Encodes the specified HydratedFourRowTemplate message, length delimited. Does not implicitly {@link proto.Message.TemplateMessage.HydratedFourRowTemplate.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.IHydratedFourRowTemplate} message HydratedFourRowTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HydratedFourRowTemplate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HydratedFourRowTemplate message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.TemplateMessage.HydratedFourRowTemplate} HydratedFourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedFourRowTemplate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.TemplateMessage.HydratedFourRowTemplate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + message.hydratedContentText = reader.string(); + break; + case 7: + message.hydratedFooterText = reader.string(); + break; + case 8: + if (!(message.hydratedButtons && message.hydratedButtons.length)) + message.hydratedButtons = []; + message.hydratedButtons.push($root.proto.HydratedTemplateButton.decode(reader, reader.uint32())); + break; + case 9: + message.templateId = reader.string(); + break; + case 1: + message.documentMessage = $root.proto.Message.DocumentMessage.decode(reader, reader.uint32()); + break; + case 2: + message.hydratedTitleText = reader.string(); + break; + case 3: + message.imageMessage = $root.proto.Message.ImageMessage.decode(reader, reader.uint32()); + break; + case 4: + message.videoMessage = $root.proto.Message.VideoMessage.decode(reader, reader.uint32()); + break; + case 5: + message.locationMessage = $root.proto.Message.LocationMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HydratedFourRowTemplate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.TemplateMessage.HydratedFourRowTemplate} HydratedFourRowTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HydratedFourRowTemplate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HydratedFourRowTemplate message. + * @function verify + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HydratedFourRowTemplate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.hydratedContentText != null && message.hasOwnProperty("hydratedContentText")) + if (!$util.isString(message.hydratedContentText)) + return "hydratedContentText: string expected"; + if (message.hydratedFooterText != null && message.hasOwnProperty("hydratedFooterText")) + if (!$util.isString(message.hydratedFooterText)) + return "hydratedFooterText: string expected"; + if (message.hydratedButtons != null && message.hasOwnProperty("hydratedButtons")) { + if (!Array.isArray(message.hydratedButtons)) + return "hydratedButtons: array expected"; + for (var i = 0; i < message.hydratedButtons.length; ++i) { + var error = $root.proto.HydratedTemplateButton.verify(message.hydratedButtons[i]); + if (error) + return "hydratedButtons." + error; + } + } + if (message.templateId != null && message.hasOwnProperty("templateId")) + if (!$util.isString(message.templateId)) + return "templateId: string expected"; + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + properties.title = 1; + { + var error = $root.proto.Message.DocumentMessage.verify(message.documentMessage); + if (error) + return "documentMessage." + error; + } + } + if (message.hydratedTitleText != null && message.hasOwnProperty("hydratedTitleText")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + if (!$util.isString(message.hydratedTitleText)) + return "hydratedTitleText: string expected"; + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.ImageMessage.verify(message.imageMessage); + if (error) + return "imageMessage." + error; + } + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.VideoMessage.verify(message.videoMessage); + if (error) + return "videoMessage." + error; + } + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + if (properties.title === 1) + return "title: multiple values"; + properties.title = 1; + { + var error = $root.proto.Message.LocationMessage.verify(message.locationMessage); + if (error) + return "locationMessage." + error; + } + } + return null; + }; + + /** + * Creates a HydratedFourRowTemplate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.TemplateMessage.HydratedFourRowTemplate} HydratedFourRowTemplate + */ + HydratedFourRowTemplate.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.TemplateMessage.HydratedFourRowTemplate) + return object; + var message = new $root.proto.Message.TemplateMessage.HydratedFourRowTemplate(); + if (object.hydratedContentText != null) + message.hydratedContentText = String(object.hydratedContentText); + if (object.hydratedFooterText != null) + message.hydratedFooterText = String(object.hydratedFooterText); + if (object.hydratedButtons) { + if (!Array.isArray(object.hydratedButtons)) + throw TypeError(".proto.Message.TemplateMessage.HydratedFourRowTemplate.hydratedButtons: array expected"); + message.hydratedButtons = []; + for (var i = 0; i < object.hydratedButtons.length; ++i) { + if (typeof object.hydratedButtons[i] !== "object") + throw TypeError(".proto.Message.TemplateMessage.HydratedFourRowTemplate.hydratedButtons: object expected"); + message.hydratedButtons[i] = $root.proto.HydratedTemplateButton.fromObject(object.hydratedButtons[i]); + } + } + if (object.templateId != null) + message.templateId = String(object.templateId); + if (object.documentMessage != null) { + if (typeof object.documentMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.HydratedFourRowTemplate.documentMessage: object expected"); + message.documentMessage = $root.proto.Message.DocumentMessage.fromObject(object.documentMessage); + } + if (object.hydratedTitleText != null) + message.hydratedTitleText = String(object.hydratedTitleText); + if (object.imageMessage != null) { + if (typeof object.imageMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.HydratedFourRowTemplate.imageMessage: object expected"); + message.imageMessage = $root.proto.Message.ImageMessage.fromObject(object.imageMessage); + } + if (object.videoMessage != null) { + if (typeof object.videoMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.HydratedFourRowTemplate.videoMessage: object expected"); + message.videoMessage = $root.proto.Message.VideoMessage.fromObject(object.videoMessage); + } + if (object.locationMessage != null) { + if (typeof object.locationMessage !== "object") + throw TypeError(".proto.Message.TemplateMessage.HydratedFourRowTemplate.locationMessage: object expected"); + message.locationMessage = $root.proto.Message.LocationMessage.fromObject(object.locationMessage); + } + return message; + }; + + /** + * Creates a plain object from a HydratedFourRowTemplate message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @static + * @param {proto.Message.TemplateMessage.HydratedFourRowTemplate} message HydratedFourRowTemplate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HydratedFourRowTemplate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.hydratedButtons = []; + if (options.defaults) { + object.hydratedContentText = ""; + object.hydratedFooterText = ""; + object.templateId = ""; + } + if (message.documentMessage != null && message.hasOwnProperty("documentMessage")) { + object.documentMessage = $root.proto.Message.DocumentMessage.toObject(message.documentMessage, options); + if (options.oneofs) + object.title = "documentMessage"; + } + if (message.hydratedTitleText != null && message.hasOwnProperty("hydratedTitleText")) { + object.hydratedTitleText = message.hydratedTitleText; + if (options.oneofs) + object.title = "hydratedTitleText"; + } + if (message.imageMessage != null && message.hasOwnProperty("imageMessage")) { + object.imageMessage = $root.proto.Message.ImageMessage.toObject(message.imageMessage, options); + if (options.oneofs) + object.title = "imageMessage"; + } + if (message.videoMessage != null && message.hasOwnProperty("videoMessage")) { + object.videoMessage = $root.proto.Message.VideoMessage.toObject(message.videoMessage, options); + if (options.oneofs) + object.title = "videoMessage"; + } + if (message.locationMessage != null && message.hasOwnProperty("locationMessage")) { + object.locationMessage = $root.proto.Message.LocationMessage.toObject(message.locationMessage, options); + if (options.oneofs) + object.title = "locationMessage"; + } + if (message.hydratedContentText != null && message.hasOwnProperty("hydratedContentText")) + object.hydratedContentText = message.hydratedContentText; + if (message.hydratedFooterText != null && message.hasOwnProperty("hydratedFooterText")) + object.hydratedFooterText = message.hydratedFooterText; + if (message.hydratedButtons && message.hydratedButtons.length) { + object.hydratedButtons = []; + for (var j = 0; j < message.hydratedButtons.length; ++j) + object.hydratedButtons[j] = $root.proto.HydratedTemplateButton.toObject(message.hydratedButtons[j], options); + } + if (message.templateId != null && message.hasOwnProperty("templateId")) + object.templateId = message.templateId; + return object; + }; + + /** + * Converts this HydratedFourRowTemplate to JSON. + * @function toJSON + * @memberof proto.Message.TemplateMessage.HydratedFourRowTemplate + * @instance + * @returns {Object.} JSON object + */ + HydratedFourRowTemplate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HydratedFourRowTemplate; + })(); + + return TemplateMessage; + })(); + + Message.VideoMessage = (function() { + + /** + * Properties of a VideoMessage. + * @memberof proto.Message + * @interface IVideoMessage + * @property {string|null} [url] VideoMessage url + * @property {string|null} [mimetype] VideoMessage mimetype + * @property {Uint8Array|null} [fileSha256] VideoMessage fileSha256 + * @property {number|Long|null} [fileLength] VideoMessage fileLength + * @property {number|null} [seconds] VideoMessage seconds + * @property {Uint8Array|null} [mediaKey] VideoMessage mediaKey + * @property {string|null} [caption] VideoMessage caption + * @property {boolean|null} [gifPlayback] VideoMessage gifPlayback + * @property {number|null} [height] VideoMessage height + * @property {number|null} [width] VideoMessage width + * @property {Uint8Array|null} [fileEncSha256] VideoMessage fileEncSha256 + * @property {Array.|null} [interactiveAnnotations] VideoMessage interactiveAnnotations + * @property {string|null} [directPath] VideoMessage directPath + * @property {number|Long|null} [mediaKeyTimestamp] VideoMessage mediaKeyTimestamp + * @property {Uint8Array|null} [jpegThumbnail] VideoMessage jpegThumbnail + * @property {proto.IContextInfo|null} [contextInfo] VideoMessage contextInfo + * @property {Uint8Array|null} [streamingSidecar] VideoMessage streamingSidecar + * @property {proto.Message.VideoMessage.Attribution|null} [gifAttribution] VideoMessage gifAttribution + * @property {boolean|null} [viewOnce] VideoMessage viewOnce + * @property {string|null} [thumbnailDirectPath] VideoMessage thumbnailDirectPath + * @property {Uint8Array|null} [thumbnailSha256] VideoMessage thumbnailSha256 + * @property {Uint8Array|null} [thumbnailEncSha256] VideoMessage thumbnailEncSha256 + * @property {string|null} [staticUrl] VideoMessage staticUrl + */ + + /** + * Constructs a new VideoMessage. + * @memberof proto.Message + * @classdesc Represents a VideoMessage. + * @implements IVideoMessage + * @constructor + * @param {proto.Message.IVideoMessage=} [properties] Properties to set + */ + function VideoMessage(properties) { + this.interactiveAnnotations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VideoMessage url. + * @member {string} url + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.url = ""; + + /** + * VideoMessage mimetype. + * @member {string} mimetype + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.mimetype = ""; + + /** + * VideoMessage fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.fileSha256 = $util.newBuffer([]); + + /** + * VideoMessage fileLength. + * @member {number|Long} fileLength + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * VideoMessage seconds. + * @member {number} seconds + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.seconds = 0; + + /** + * VideoMessage mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.mediaKey = $util.newBuffer([]); + + /** + * VideoMessage caption. + * @member {string} caption + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.caption = ""; + + /** + * VideoMessage gifPlayback. + * @member {boolean} gifPlayback + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.gifPlayback = false; + + /** + * VideoMessage height. + * @member {number} height + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.height = 0; + + /** + * VideoMessage width. + * @member {number} width + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.width = 0; + + /** + * VideoMessage fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * VideoMessage interactiveAnnotations. + * @member {Array.} interactiveAnnotations + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.interactiveAnnotations = $util.emptyArray; + + /** + * VideoMessage directPath. + * @member {string} directPath + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.directPath = ""; + + /** + * VideoMessage mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * VideoMessage jpegThumbnail. + * @member {Uint8Array} jpegThumbnail + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.jpegThumbnail = $util.newBuffer([]); + + /** + * VideoMessage contextInfo. + * @member {proto.IContextInfo|null|undefined} contextInfo + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.contextInfo = null; + + /** + * VideoMessage streamingSidecar. + * @member {Uint8Array} streamingSidecar + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.streamingSidecar = $util.newBuffer([]); + + /** + * VideoMessage gifAttribution. + * @member {proto.Message.VideoMessage.Attribution} gifAttribution + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.gifAttribution = 0; + + /** + * VideoMessage viewOnce. + * @member {boolean} viewOnce + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.viewOnce = false; + + /** + * VideoMessage thumbnailDirectPath. + * @member {string} thumbnailDirectPath + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.thumbnailDirectPath = ""; + + /** + * VideoMessage thumbnailSha256. + * @member {Uint8Array} thumbnailSha256 + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.thumbnailSha256 = $util.newBuffer([]); + + /** + * VideoMessage thumbnailEncSha256. + * @member {Uint8Array} thumbnailEncSha256 + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.thumbnailEncSha256 = $util.newBuffer([]); + + /** + * VideoMessage staticUrl. + * @member {string} staticUrl + * @memberof proto.Message.VideoMessage + * @instance + */ + VideoMessage.prototype.staticUrl = ""; + + /** + * Creates a new VideoMessage instance using the specified properties. + * @function create + * @memberof proto.Message.VideoMessage + * @static + * @param {proto.Message.IVideoMessage=} [properties] Properties to set + * @returns {proto.Message.VideoMessage} VideoMessage instance + */ + VideoMessage.create = function create(properties) { + return new VideoMessage(properties); + }; + + /** + * Encodes the specified VideoMessage message. Does not implicitly {@link proto.Message.VideoMessage.verify|verify} messages. + * @function encode + * @memberof proto.Message.VideoMessage + * @static + * @param {proto.Message.IVideoMessage} message VideoMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VideoMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimetype); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.fileSha256); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.fileLength); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.seconds); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.mediaKey); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.caption); + if (message.gifPlayback != null && Object.hasOwnProperty.call(message, "gifPlayback")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.gifPlayback); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 9, wireType 0 =*/72).uint32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.width); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 11, wireType 2 =*/90).bytes(message.fileEncSha256); + if (message.interactiveAnnotations != null && message.interactiveAnnotations.length) + for (var i = 0; i < message.interactiveAnnotations.length; ++i) + $root.proto.InteractiveAnnotation.encode(message.interactiveAnnotations[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.directPath); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 14, wireType 0 =*/112).int64(message.mediaKeyTimestamp); + if (message.jpegThumbnail != null && Object.hasOwnProperty.call(message, "jpegThumbnail")) + writer.uint32(/* id 16, wireType 2 =*/130).bytes(message.jpegThumbnail); + if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) + $root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.streamingSidecar != null && Object.hasOwnProperty.call(message, "streamingSidecar")) + writer.uint32(/* id 18, wireType 2 =*/146).bytes(message.streamingSidecar); + if (message.gifAttribution != null && Object.hasOwnProperty.call(message, "gifAttribution")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.gifAttribution); + if (message.viewOnce != null && Object.hasOwnProperty.call(message, "viewOnce")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.viewOnce); + if (message.thumbnailDirectPath != null && Object.hasOwnProperty.call(message, "thumbnailDirectPath")) + writer.uint32(/* id 21, wireType 2 =*/170).string(message.thumbnailDirectPath); + if (message.thumbnailSha256 != null && Object.hasOwnProperty.call(message, "thumbnailSha256")) + writer.uint32(/* id 22, wireType 2 =*/178).bytes(message.thumbnailSha256); + if (message.thumbnailEncSha256 != null && Object.hasOwnProperty.call(message, "thumbnailEncSha256")) + writer.uint32(/* id 23, wireType 2 =*/186).bytes(message.thumbnailEncSha256); + if (message.staticUrl != null && Object.hasOwnProperty.call(message, "staticUrl")) + writer.uint32(/* id 24, wireType 2 =*/194).string(message.staticUrl); + return writer; + }; + + /** + * Encodes the specified VideoMessage message, length delimited. Does not implicitly {@link proto.Message.VideoMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Message.VideoMessage + * @static + * @param {proto.Message.IVideoMessage} message VideoMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VideoMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VideoMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.Message.VideoMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Message.VideoMessage} VideoMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VideoMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.VideoMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.mimetype = reader.string(); + break; + case 3: + message.fileSha256 = reader.bytes(); + break; + case 4: + message.fileLength = reader.uint64(); + break; + case 5: + message.seconds = reader.uint32(); + break; + case 6: + message.mediaKey = reader.bytes(); + break; + case 7: + message.caption = reader.string(); + break; + case 8: + message.gifPlayback = reader.bool(); + break; + case 9: + message.height = reader.uint32(); + break; + case 10: + message.width = reader.uint32(); + break; + case 11: + message.fileEncSha256 = reader.bytes(); + break; + case 12: + if (!(message.interactiveAnnotations && message.interactiveAnnotations.length)) + message.interactiveAnnotations = []; + message.interactiveAnnotations.push($root.proto.InteractiveAnnotation.decode(reader, reader.uint32())); + break; + case 13: + message.directPath = reader.string(); + break; + case 14: + message.mediaKeyTimestamp = reader.int64(); + break; + case 16: + message.jpegThumbnail = reader.bytes(); + break; + case 17: + message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32()); + break; + case 18: + message.streamingSidecar = reader.bytes(); + break; + case 19: + message.gifAttribution = reader.int32(); + break; + case 20: + message.viewOnce = reader.bool(); + break; + case 21: + message.thumbnailDirectPath = reader.string(); + break; + case 22: + message.thumbnailSha256 = reader.bytes(); + break; + case 23: + message.thumbnailEncSha256 = reader.bytes(); + break; + case 24: + message.staticUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VideoMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Message.VideoMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Message.VideoMessage} VideoMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VideoMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VideoMessage message. + * @function verify + * @memberof proto.Message.VideoMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VideoMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds)) + return "seconds: integer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + if (message.gifPlayback != null && message.hasOwnProperty("gifPlayback")) + if (typeof message.gifPlayback !== "boolean") + return "gifPlayback: boolean expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.interactiveAnnotations != null && message.hasOwnProperty("interactiveAnnotations")) { + if (!Array.isArray(message.interactiveAnnotations)) + return "interactiveAnnotations: array expected"; + for (var i = 0; i < message.interactiveAnnotations.length; ++i) { + var error = $root.proto.InteractiveAnnotation.verify(message.interactiveAnnotations[i]); + if (error) + return "interactiveAnnotations." + error; + } + } + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + if (!(message.jpegThumbnail && typeof message.jpegThumbnail.length === "number" || $util.isString(message.jpegThumbnail))) + return "jpegThumbnail: buffer expected"; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) { + var error = $root.proto.ContextInfo.verify(message.contextInfo); + if (error) + return "contextInfo." + error; + } + if (message.streamingSidecar != null && message.hasOwnProperty("streamingSidecar")) + if (!(message.streamingSidecar && typeof message.streamingSidecar.length === "number" || $util.isString(message.streamingSidecar))) + return "streamingSidecar: buffer expected"; + if (message.gifAttribution != null && message.hasOwnProperty("gifAttribution")) + switch (message.gifAttribution) { + default: + return "gifAttribution: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + if (typeof message.viewOnce !== "boolean") + return "viewOnce: boolean expected"; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + if (!$util.isString(message.thumbnailDirectPath)) + return "thumbnailDirectPath: string expected"; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + if (!(message.thumbnailSha256 && typeof message.thumbnailSha256.length === "number" || $util.isString(message.thumbnailSha256))) + return "thumbnailSha256: buffer expected"; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + if (!(message.thumbnailEncSha256 && typeof message.thumbnailEncSha256.length === "number" || $util.isString(message.thumbnailEncSha256))) + return "thumbnailEncSha256: buffer expected"; + if (message.staticUrl != null && message.hasOwnProperty("staticUrl")) + if (!$util.isString(message.staticUrl)) + return "staticUrl: string expected"; + return null; + }; + + /** + * Creates a VideoMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Message.VideoMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.Message.VideoMessage} VideoMessage + */ + VideoMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Message.VideoMessage) + return object; + var message = new $root.proto.Message.VideoMessage(); + if (object.url != null) + message.url = String(object.url); + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.seconds != null) + message.seconds = object.seconds >>> 0; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.caption != null) + message.caption = String(object.caption); + if (object.gifPlayback != null) + message.gifPlayback = Boolean(object.gifPlayback); + if (object.height != null) + message.height = object.height >>> 0; + if (object.width != null) + message.width = object.width >>> 0; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.interactiveAnnotations) { + if (!Array.isArray(object.interactiveAnnotations)) + throw TypeError(".proto.Message.VideoMessage.interactiveAnnotations: array expected"); + message.interactiveAnnotations = []; + for (var i = 0; i < object.interactiveAnnotations.length; ++i) { + if (typeof object.interactiveAnnotations[i] !== "object") + throw TypeError(".proto.Message.VideoMessage.interactiveAnnotations: object expected"); + message.interactiveAnnotations[i] = $root.proto.InteractiveAnnotation.fromObject(object.interactiveAnnotations[i]); + } + } + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.jpegThumbnail != null) + if (typeof object.jpegThumbnail === "string") + $util.base64.decode(object.jpegThumbnail, message.jpegThumbnail = $util.newBuffer($util.base64.length(object.jpegThumbnail)), 0); + else if (object.jpegThumbnail.length) + message.jpegThumbnail = object.jpegThumbnail; + if (object.contextInfo != null) { + if (typeof object.contextInfo !== "object") + throw TypeError(".proto.Message.VideoMessage.contextInfo: object expected"); + message.contextInfo = $root.proto.ContextInfo.fromObject(object.contextInfo); + } + if (object.streamingSidecar != null) + if (typeof object.streamingSidecar === "string") + $util.base64.decode(object.streamingSidecar, message.streamingSidecar = $util.newBuffer($util.base64.length(object.streamingSidecar)), 0); + else if (object.streamingSidecar.length) + message.streamingSidecar = object.streamingSidecar; + switch (object.gifAttribution) { + case "NONE": + case 0: + message.gifAttribution = 0; + break; + case "GIPHY": + case 1: + message.gifAttribution = 1; + break; + case "TENOR": + case 2: + message.gifAttribution = 2; + break; + } + if (object.viewOnce != null) + message.viewOnce = Boolean(object.viewOnce); + if (object.thumbnailDirectPath != null) + message.thumbnailDirectPath = String(object.thumbnailDirectPath); + if (object.thumbnailSha256 != null) + if (typeof object.thumbnailSha256 === "string") + $util.base64.decode(object.thumbnailSha256, message.thumbnailSha256 = $util.newBuffer($util.base64.length(object.thumbnailSha256)), 0); + else if (object.thumbnailSha256.length) + message.thumbnailSha256 = object.thumbnailSha256; + if (object.thumbnailEncSha256 != null) + if (typeof object.thumbnailEncSha256 === "string") + $util.base64.decode(object.thumbnailEncSha256, message.thumbnailEncSha256 = $util.newBuffer($util.base64.length(object.thumbnailEncSha256)), 0); + else if (object.thumbnailEncSha256.length) + message.thumbnailEncSha256 = object.thumbnailEncSha256; + if (object.staticUrl != null) + message.staticUrl = String(object.staticUrl); + return message; + }; + + /** + * Creates a plain object from a VideoMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Message.VideoMessage + * @static + * @param {proto.Message.VideoMessage} message VideoMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VideoMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.interactiveAnnotations = []; + if (options.defaults) { + object.url = ""; + object.mimetype = ""; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.seconds = 0; + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + object.caption = ""; + object.gifPlayback = false; + object.height = 0; + object.width = 0; + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.jpegThumbnail = ""; + else { + object.jpegThumbnail = []; + if (options.bytes !== Array) + object.jpegThumbnail = $util.newBuffer(object.jpegThumbnail); + } + object.contextInfo = null; + if (options.bytes === String) + object.streamingSidecar = ""; + else { + object.streamingSidecar = []; + if (options.bytes !== Array) + object.streamingSidecar = $util.newBuffer(object.streamingSidecar); + } + object.gifAttribution = options.enums === String ? "NONE" : 0; + object.viewOnce = false; + object.thumbnailDirectPath = ""; + if (options.bytes === String) + object.thumbnailSha256 = ""; + else { + object.thumbnailSha256 = []; + if (options.bytes !== Array) + object.thumbnailSha256 = $util.newBuffer(object.thumbnailSha256); + } + if (options.bytes === String) + object.thumbnailEncSha256 = ""; + else { + object.thumbnailEncSha256 = []; + if (options.bytes !== Array) + object.thumbnailEncSha256 = $util.newBuffer(object.thumbnailEncSha256); + } + object.staticUrl = ""; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.seconds != null && message.hasOwnProperty("seconds")) + object.seconds = message.seconds; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + if (message.gifPlayback != null && message.hasOwnProperty("gifPlayback")) + object.gifPlayback = message.gifPlayback; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.interactiveAnnotations && message.interactiveAnnotations.length) { + object.interactiveAnnotations = []; + for (var j = 0; j < message.interactiveAnnotations.length; ++j) + object.interactiveAnnotations[j] = $root.proto.InteractiveAnnotation.toObject(message.interactiveAnnotations[j], options); + } + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.jpegThumbnail != null && message.hasOwnProperty("jpegThumbnail")) + object.jpegThumbnail = options.bytes === String ? $util.base64.encode(message.jpegThumbnail, 0, message.jpegThumbnail.length) : options.bytes === Array ? Array.prototype.slice.call(message.jpegThumbnail) : message.jpegThumbnail; + if (message.contextInfo != null && message.hasOwnProperty("contextInfo")) + object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options); + if (message.streamingSidecar != null && message.hasOwnProperty("streamingSidecar")) + object.streamingSidecar = options.bytes === String ? $util.base64.encode(message.streamingSidecar, 0, message.streamingSidecar.length) : options.bytes === Array ? Array.prototype.slice.call(message.streamingSidecar) : message.streamingSidecar; + if (message.gifAttribution != null && message.hasOwnProperty("gifAttribution")) + object.gifAttribution = options.enums === String ? $root.proto.Message.VideoMessage.Attribution[message.gifAttribution] : message.gifAttribution; + if (message.viewOnce != null && message.hasOwnProperty("viewOnce")) + object.viewOnce = message.viewOnce; + if (message.thumbnailDirectPath != null && message.hasOwnProperty("thumbnailDirectPath")) + object.thumbnailDirectPath = message.thumbnailDirectPath; + if (message.thumbnailSha256 != null && message.hasOwnProperty("thumbnailSha256")) + object.thumbnailSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailSha256, 0, message.thumbnailSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailSha256) : message.thumbnailSha256; + if (message.thumbnailEncSha256 != null && message.hasOwnProperty("thumbnailEncSha256")) + object.thumbnailEncSha256 = options.bytes === String ? $util.base64.encode(message.thumbnailEncSha256, 0, message.thumbnailEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.thumbnailEncSha256) : message.thumbnailEncSha256; + if (message.staticUrl != null && message.hasOwnProperty("staticUrl")) + object.staticUrl = message.staticUrl; + return object; + }; + + /** + * Converts this VideoMessage to JSON. + * @function toJSON + * @memberof proto.Message.VideoMessage + * @instance + * @returns {Object.} JSON object + */ + VideoMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Attribution enum. + * @name proto.Message.VideoMessage.Attribution + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} GIPHY=1 GIPHY value + * @property {number} TENOR=2 TENOR value + */ + VideoMessage.Attribution = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "GIPHY"] = 1; + values[valuesById[2] = "TENOR"] = 2; + return values; + })(); + + return VideoMessage; + })(); + + return Message; + })(); + + proto.MessageContextInfo = (function() { + + /** + * Properties of a MessageContextInfo. + * @memberof proto + * @interface IMessageContextInfo + * @property {proto.IDeviceListMetadata|null} [deviceListMetadata] MessageContextInfo deviceListMetadata + * @property {number|null} [deviceListMetadataVersion] MessageContextInfo deviceListMetadataVersion + * @property {Uint8Array|null} [messageSecret] MessageContextInfo messageSecret + * @property {Uint8Array|null} [paddingBytes] MessageContextInfo paddingBytes + */ + + /** + * Constructs a new MessageContextInfo. + * @memberof proto + * @classdesc Represents a MessageContextInfo. + * @implements IMessageContextInfo + * @constructor + * @param {proto.IMessageContextInfo=} [properties] Properties to set + */ + function MessageContextInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageContextInfo deviceListMetadata. + * @member {proto.IDeviceListMetadata|null|undefined} deviceListMetadata + * @memberof proto.MessageContextInfo + * @instance + */ + MessageContextInfo.prototype.deviceListMetadata = null; + + /** + * MessageContextInfo deviceListMetadataVersion. + * @member {number} deviceListMetadataVersion + * @memberof proto.MessageContextInfo + * @instance + */ + MessageContextInfo.prototype.deviceListMetadataVersion = 0; + + /** + * MessageContextInfo messageSecret. + * @member {Uint8Array} messageSecret + * @memberof proto.MessageContextInfo + * @instance + */ + MessageContextInfo.prototype.messageSecret = $util.newBuffer([]); + + /** + * MessageContextInfo paddingBytes. + * @member {Uint8Array} paddingBytes + * @memberof proto.MessageContextInfo + * @instance + */ + MessageContextInfo.prototype.paddingBytes = $util.newBuffer([]); + + /** + * Creates a new MessageContextInfo instance using the specified properties. + * @function create + * @memberof proto.MessageContextInfo + * @static + * @param {proto.IMessageContextInfo=} [properties] Properties to set + * @returns {proto.MessageContextInfo} MessageContextInfo instance + */ + MessageContextInfo.create = function create(properties) { + return new MessageContextInfo(properties); + }; + + /** + * Encodes the specified MessageContextInfo message. Does not implicitly {@link proto.MessageContextInfo.verify|verify} messages. + * @function encode + * @memberof proto.MessageContextInfo + * @static + * @param {proto.IMessageContextInfo} message MessageContextInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageContextInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deviceListMetadata != null && Object.hasOwnProperty.call(message, "deviceListMetadata")) + $root.proto.DeviceListMetadata.encode(message.deviceListMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.deviceListMetadataVersion != null && Object.hasOwnProperty.call(message, "deviceListMetadataVersion")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.deviceListMetadataVersion); + if (message.messageSecret != null && Object.hasOwnProperty.call(message, "messageSecret")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.messageSecret); + if (message.paddingBytes != null && Object.hasOwnProperty.call(message, "paddingBytes")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.paddingBytes); + return writer; + }; + + /** + * Encodes the specified MessageContextInfo message, length delimited. Does not implicitly {@link proto.MessageContextInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MessageContextInfo + * @static + * @param {proto.IMessageContextInfo} message MessageContextInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageContextInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageContextInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.MessageContextInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MessageContextInfo} MessageContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageContextInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MessageContextInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deviceListMetadata = $root.proto.DeviceListMetadata.decode(reader, reader.uint32()); + break; + case 2: + message.deviceListMetadataVersion = reader.int32(); + break; + case 3: + message.messageSecret = reader.bytes(); + break; + case 4: + message.paddingBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageContextInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MessageContextInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MessageContextInfo} MessageContextInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageContextInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageContextInfo message. + * @function verify + * @memberof proto.MessageContextInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageContextInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deviceListMetadata != null && message.hasOwnProperty("deviceListMetadata")) { + var error = $root.proto.DeviceListMetadata.verify(message.deviceListMetadata); + if (error) + return "deviceListMetadata." + error; + } + if (message.deviceListMetadataVersion != null && message.hasOwnProperty("deviceListMetadataVersion")) + if (!$util.isInteger(message.deviceListMetadataVersion)) + return "deviceListMetadataVersion: integer expected"; + if (message.messageSecret != null && message.hasOwnProperty("messageSecret")) + if (!(message.messageSecret && typeof message.messageSecret.length === "number" || $util.isString(message.messageSecret))) + return "messageSecret: buffer expected"; + if (message.paddingBytes != null && message.hasOwnProperty("paddingBytes")) + if (!(message.paddingBytes && typeof message.paddingBytes.length === "number" || $util.isString(message.paddingBytes))) + return "paddingBytes: buffer expected"; + return null; + }; + + /** + * Creates a MessageContextInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MessageContextInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.MessageContextInfo} MessageContextInfo + */ + MessageContextInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MessageContextInfo) + return object; + var message = new $root.proto.MessageContextInfo(); + if (object.deviceListMetadata != null) { + if (typeof object.deviceListMetadata !== "object") + throw TypeError(".proto.MessageContextInfo.deviceListMetadata: object expected"); + message.deviceListMetadata = $root.proto.DeviceListMetadata.fromObject(object.deviceListMetadata); + } + if (object.deviceListMetadataVersion != null) + message.deviceListMetadataVersion = object.deviceListMetadataVersion | 0; + if (object.messageSecret != null) + if (typeof object.messageSecret === "string") + $util.base64.decode(object.messageSecret, message.messageSecret = $util.newBuffer($util.base64.length(object.messageSecret)), 0); + else if (object.messageSecret.length) + message.messageSecret = object.messageSecret; + if (object.paddingBytes != null) + if (typeof object.paddingBytes === "string") + $util.base64.decode(object.paddingBytes, message.paddingBytes = $util.newBuffer($util.base64.length(object.paddingBytes)), 0); + else if (object.paddingBytes.length) + message.paddingBytes = object.paddingBytes; + return message; + }; + + /** + * Creates a plain object from a MessageContextInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MessageContextInfo + * @static + * @param {proto.MessageContextInfo} message MessageContextInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageContextInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.deviceListMetadata = null; + object.deviceListMetadataVersion = 0; + if (options.bytes === String) + object.messageSecret = ""; + else { + object.messageSecret = []; + if (options.bytes !== Array) + object.messageSecret = $util.newBuffer(object.messageSecret); + } + if (options.bytes === String) + object.paddingBytes = ""; + else { + object.paddingBytes = []; + if (options.bytes !== Array) + object.paddingBytes = $util.newBuffer(object.paddingBytes); + } + } + if (message.deviceListMetadata != null && message.hasOwnProperty("deviceListMetadata")) + object.deviceListMetadata = $root.proto.DeviceListMetadata.toObject(message.deviceListMetadata, options); + if (message.deviceListMetadataVersion != null && message.hasOwnProperty("deviceListMetadataVersion")) + object.deviceListMetadataVersion = message.deviceListMetadataVersion; + if (message.messageSecret != null && message.hasOwnProperty("messageSecret")) + object.messageSecret = options.bytes === String ? $util.base64.encode(message.messageSecret, 0, message.messageSecret.length) : options.bytes === Array ? Array.prototype.slice.call(message.messageSecret) : message.messageSecret; + if (message.paddingBytes != null && message.hasOwnProperty("paddingBytes")) + object.paddingBytes = options.bytes === String ? $util.base64.encode(message.paddingBytes, 0, message.paddingBytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.paddingBytes) : message.paddingBytes; + return object; + }; + + /** + * Converts this MessageContextInfo to JSON. + * @function toJSON + * @memberof proto.MessageContextInfo + * @instance + * @returns {Object.} JSON object + */ + MessageContextInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageContextInfo; + })(); + + proto.MessageKey = (function() { + + /** + * Properties of a MessageKey. + * @memberof proto + * @interface IMessageKey + * @property {string|null} [remoteJid] MessageKey remoteJid + * @property {boolean|null} [fromMe] MessageKey fromMe + * @property {string|null} [id] MessageKey id + * @property {string|null} [participant] MessageKey participant + */ + + /** + * Constructs a new MessageKey. + * @memberof proto + * @classdesc Represents a MessageKey. + * @implements IMessageKey + * @constructor + * @param {proto.IMessageKey=} [properties] Properties to set + */ + function MessageKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageKey remoteJid. + * @member {string} remoteJid + * @memberof proto.MessageKey + * @instance + */ + MessageKey.prototype.remoteJid = ""; + + /** + * MessageKey fromMe. + * @member {boolean} fromMe + * @memberof proto.MessageKey + * @instance + */ + MessageKey.prototype.fromMe = false; + + /** + * MessageKey id. + * @member {string} id + * @memberof proto.MessageKey + * @instance + */ + MessageKey.prototype.id = ""; + + /** + * MessageKey participant. + * @member {string} participant + * @memberof proto.MessageKey + * @instance + */ + MessageKey.prototype.participant = ""; + + /** + * Creates a new MessageKey instance using the specified properties. + * @function create + * @memberof proto.MessageKey + * @static + * @param {proto.IMessageKey=} [properties] Properties to set + * @returns {proto.MessageKey} MessageKey instance + */ + MessageKey.create = function create(properties) { + return new MessageKey(properties); + }; + + /** + * Encodes the specified MessageKey message. Does not implicitly {@link proto.MessageKey.verify|verify} messages. + * @function encode + * @memberof proto.MessageKey + * @static + * @param {proto.IMessageKey} message MessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.remoteJid != null && Object.hasOwnProperty.call(message, "remoteJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.remoteJid); + if (message.fromMe != null && Object.hasOwnProperty.call(message, "fromMe")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fromMe); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.id); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.participant); + return writer; + }; + + /** + * Encodes the specified MessageKey message, length delimited. Does not implicitly {@link proto.MessageKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MessageKey + * @static + * @param {proto.IMessageKey} message MessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageKey message from the specified reader or buffer. + * @function decode + * @memberof proto.MessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MessageKey} MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MessageKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.remoteJid = reader.string(); + break; + case 2: + message.fromMe = reader.bool(); + break; + case 3: + message.id = reader.string(); + break; + case 4: + message.participant = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MessageKey} MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageKey message. + * @function verify + * @memberof proto.MessageKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.remoteJid != null && message.hasOwnProperty("remoteJid")) + if (!$util.isString(message.remoteJid)) + return "remoteJid: string expected"; + if (message.fromMe != null && message.hasOwnProperty("fromMe")) + if (typeof message.fromMe !== "boolean") + return "fromMe: boolean expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + return null; + }; + + /** + * Creates a MessageKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MessageKey + * @static + * @param {Object.} object Plain object + * @returns {proto.MessageKey} MessageKey + */ + MessageKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MessageKey) + return object; + var message = new $root.proto.MessageKey(); + if (object.remoteJid != null) + message.remoteJid = String(object.remoteJid); + if (object.fromMe != null) + message.fromMe = Boolean(object.fromMe); + if (object.id != null) + message.id = String(object.id); + if (object.participant != null) + message.participant = String(object.participant); + return message; + }; + + /** + * Creates a plain object from a MessageKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MessageKey + * @static + * @param {proto.MessageKey} message MessageKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.remoteJid = ""; + object.fromMe = false; + object.id = ""; + object.participant = ""; + } + if (message.remoteJid != null && message.hasOwnProperty("remoteJid")) + object.remoteJid = message.remoteJid; + if (message.fromMe != null && message.hasOwnProperty("fromMe")) + object.fromMe = message.fromMe; + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + return object; + }; + + /** + * Converts this MessageKey to JSON. + * @function toJSON + * @memberof proto.MessageKey + * @instance + * @returns {Object.} JSON object + */ + MessageKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageKey; + })(); + + proto.Money = (function() { + + /** + * Properties of a Money. + * @memberof proto + * @interface IMoney + * @property {number|Long|null} [value] Money value + * @property {number|null} [offset] Money offset + * @property {string|null} [currencyCode] Money currencyCode + */ + + /** + * Constructs a new Money. + * @memberof proto + * @classdesc Represents a Money. + * @implements IMoney + * @constructor + * @param {proto.IMoney=} [properties] Properties to set + */ + function Money(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Money value. + * @member {number|Long} value + * @memberof proto.Money + * @instance + */ + Money.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Money offset. + * @member {number} offset + * @memberof proto.Money + * @instance + */ + Money.prototype.offset = 0; + + /** + * Money currencyCode. + * @member {string} currencyCode + * @memberof proto.Money + * @instance + */ + Money.prototype.currencyCode = ""; + + /** + * Creates a new Money instance using the specified properties. + * @function create + * @memberof proto.Money + * @static + * @param {proto.IMoney=} [properties] Properties to set + * @returns {proto.Money} Money instance + */ + Money.create = function create(properties) { + return new Money(properties); + }; + + /** + * Encodes the specified Money message. Does not implicitly {@link proto.Money.verify|verify} messages. + * @function encode + * @memberof proto.Money + * @static + * @param {proto.IMoney} message Money message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Money.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.offset); + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.currencyCode); + return writer; + }; + + /** + * Encodes the specified Money message, length delimited. Does not implicitly {@link proto.Money.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Money + * @static + * @param {proto.IMoney} message Money message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Money.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Money message from the specified reader or buffer. + * @function decode + * @memberof proto.Money + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Money} Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Money.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Money(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = reader.int64(); + break; + case 2: + message.offset = reader.uint32(); + break; + case 3: + message.currencyCode = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Money message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Money + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Money} Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Money.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Money message. + * @function verify + * @memberof proto.Money + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Money.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (!$util.isInteger(message.offset)) + return "offset: integer expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + return null; + }; + + /** + * Creates a Money message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Money + * @static + * @param {Object.} object Plain object + * @returns {proto.Money} Money + */ + Money.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Money) + return object; + var message = new $root.proto.Money(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + if (object.offset != null) + message.offset = object.offset >>> 0; + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + return message; + }; + + /** + * Creates a plain object from a Money message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Money + * @static + * @param {proto.Money} message Money + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Money.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + object.offset = 0; + object.currencyCode = ""; + } + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = message.offset; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + return object; + }; + + /** + * Converts this Money to JSON. + * @function toJSON + * @memberof proto.Money + * @instance + * @returns {Object.} JSON object + */ + Money.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Money; + })(); + + proto.MsgOpaqueData = (function() { + + /** + * Properties of a MsgOpaqueData. + * @memberof proto + * @interface IMsgOpaqueData + * @property {string|null} [body] MsgOpaqueData body + * @property {string|null} [caption] MsgOpaqueData caption + * @property {number|null} [lng] MsgOpaqueData lng + * @property {boolean|null} [isLive] MsgOpaqueData isLive + * @property {number|null} [lat] MsgOpaqueData lat + * @property {number|null} [paymentAmount1000] MsgOpaqueData paymentAmount1000 + * @property {string|null} [paymentNoteMsgBody] MsgOpaqueData paymentNoteMsgBody + * @property {string|null} [canonicalUrl] MsgOpaqueData canonicalUrl + * @property {string|null} [matchedText] MsgOpaqueData matchedText + * @property {string|null} [title] MsgOpaqueData title + * @property {string|null} [description] MsgOpaqueData description + * @property {Uint8Array|null} [futureproofBuffer] MsgOpaqueData futureproofBuffer + * @property {string|null} [clientUrl] MsgOpaqueData clientUrl + * @property {string|null} [loc] MsgOpaqueData loc + * @property {string|null} [pollName] MsgOpaqueData pollName + * @property {Array.|null} [pollOptions] MsgOpaqueData pollOptions + * @property {number|null} [pollSelectableOptionsCount] MsgOpaqueData pollSelectableOptionsCount + * @property {Uint8Array|null} [messageSecret] MsgOpaqueData messageSecret + * @property {string|null} [originalSelfAuthor] MsgOpaqueData originalSelfAuthor + * @property {number|Long|null} [senderTimestampMs] MsgOpaqueData senderTimestampMs + * @property {string|null} [pollUpdateParentKey] MsgOpaqueData pollUpdateParentKey + * @property {proto.IPollEncValue|null} [encPollVote] MsgOpaqueData encPollVote + * @property {boolean|null} [isSentCagPollCreation] MsgOpaqueData isSentCagPollCreation + * @property {string|null} [encReactionTargetMessageKey] MsgOpaqueData encReactionTargetMessageKey + * @property {Uint8Array|null} [encReactionEncPayload] MsgOpaqueData encReactionEncPayload + * @property {Uint8Array|null} [encReactionEncIv] MsgOpaqueData encReactionEncIv + */ + + /** + * Constructs a new MsgOpaqueData. + * @memberof proto + * @classdesc Represents a MsgOpaqueData. + * @implements IMsgOpaqueData + * @constructor + * @param {proto.IMsgOpaqueData=} [properties] Properties to set + */ + function MsgOpaqueData(properties) { + this.pollOptions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgOpaqueData body. + * @member {string} body + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.body = ""; + + /** + * MsgOpaqueData caption. + * @member {string} caption + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.caption = ""; + + /** + * MsgOpaqueData lng. + * @member {number} lng + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.lng = 0; + + /** + * MsgOpaqueData isLive. + * @member {boolean} isLive + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.isLive = false; + + /** + * MsgOpaqueData lat. + * @member {number} lat + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.lat = 0; + + /** + * MsgOpaqueData paymentAmount1000. + * @member {number} paymentAmount1000 + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.paymentAmount1000 = 0; + + /** + * MsgOpaqueData paymentNoteMsgBody. + * @member {string} paymentNoteMsgBody + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.paymentNoteMsgBody = ""; + + /** + * MsgOpaqueData canonicalUrl. + * @member {string} canonicalUrl + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.canonicalUrl = ""; + + /** + * MsgOpaqueData matchedText. + * @member {string} matchedText + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.matchedText = ""; + + /** + * MsgOpaqueData title. + * @member {string} title + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.title = ""; + + /** + * MsgOpaqueData description. + * @member {string} description + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.description = ""; + + /** + * MsgOpaqueData futureproofBuffer. + * @member {Uint8Array} futureproofBuffer + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.futureproofBuffer = $util.newBuffer([]); + + /** + * MsgOpaqueData clientUrl. + * @member {string} clientUrl + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.clientUrl = ""; + + /** + * MsgOpaqueData loc. + * @member {string} loc + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.loc = ""; + + /** + * MsgOpaqueData pollName. + * @member {string} pollName + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.pollName = ""; + + /** + * MsgOpaqueData pollOptions. + * @member {Array.} pollOptions + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.pollOptions = $util.emptyArray; + + /** + * MsgOpaqueData pollSelectableOptionsCount. + * @member {number} pollSelectableOptionsCount + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.pollSelectableOptionsCount = 0; + + /** + * MsgOpaqueData messageSecret. + * @member {Uint8Array} messageSecret + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.messageSecret = $util.newBuffer([]); + + /** + * MsgOpaqueData originalSelfAuthor. + * @member {string} originalSelfAuthor + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.originalSelfAuthor = ""; + + /** + * MsgOpaqueData senderTimestampMs. + * @member {number|Long} senderTimestampMs + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * MsgOpaqueData pollUpdateParentKey. + * @member {string} pollUpdateParentKey + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.pollUpdateParentKey = ""; + + /** + * MsgOpaqueData encPollVote. + * @member {proto.IPollEncValue|null|undefined} encPollVote + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.encPollVote = null; + + /** + * MsgOpaqueData isSentCagPollCreation. + * @member {boolean} isSentCagPollCreation + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.isSentCagPollCreation = false; + + /** + * MsgOpaqueData encReactionTargetMessageKey. + * @member {string} encReactionTargetMessageKey + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.encReactionTargetMessageKey = ""; + + /** + * MsgOpaqueData encReactionEncPayload. + * @member {Uint8Array} encReactionEncPayload + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.encReactionEncPayload = $util.newBuffer([]); + + /** + * MsgOpaqueData encReactionEncIv. + * @member {Uint8Array} encReactionEncIv + * @memberof proto.MsgOpaqueData + * @instance + */ + MsgOpaqueData.prototype.encReactionEncIv = $util.newBuffer([]); + + /** + * Creates a new MsgOpaqueData instance using the specified properties. + * @function create + * @memberof proto.MsgOpaqueData + * @static + * @param {proto.IMsgOpaqueData=} [properties] Properties to set + * @returns {proto.MsgOpaqueData} MsgOpaqueData instance + */ + MsgOpaqueData.create = function create(properties) { + return new MsgOpaqueData(properties); + }; + + /** + * Encodes the specified MsgOpaqueData message. Does not implicitly {@link proto.MsgOpaqueData.verify|verify} messages. + * @function encode + * @memberof proto.MsgOpaqueData + * @static + * @param {proto.IMsgOpaqueData} message MsgOpaqueData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgOpaqueData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.body); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.caption); + if (message.lng != null && Object.hasOwnProperty.call(message, "lng")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.lng); + if (message.isLive != null && Object.hasOwnProperty.call(message, "isLive")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.isLive); + if (message.lat != null && Object.hasOwnProperty.call(message, "lat")) + writer.uint32(/* id 7, wireType 1 =*/57).double(message.lat); + if (message.paymentAmount1000 != null && Object.hasOwnProperty.call(message, "paymentAmount1000")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.paymentAmount1000); + if (message.paymentNoteMsgBody != null && Object.hasOwnProperty.call(message, "paymentNoteMsgBody")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.paymentNoteMsgBody); + if (message.canonicalUrl != null && Object.hasOwnProperty.call(message, "canonicalUrl")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.canonicalUrl); + if (message.matchedText != null && Object.hasOwnProperty.call(message, "matchedText")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.matchedText); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.description); + if (message.futureproofBuffer != null && Object.hasOwnProperty.call(message, "futureproofBuffer")) + writer.uint32(/* id 14, wireType 2 =*/114).bytes(message.futureproofBuffer); + if (message.clientUrl != null && Object.hasOwnProperty.call(message, "clientUrl")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.clientUrl); + if (message.loc != null && Object.hasOwnProperty.call(message, "loc")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.loc); + if (message.pollName != null && Object.hasOwnProperty.call(message, "pollName")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.pollName); + if (message.pollOptions != null && message.pollOptions.length) + for (var i = 0; i < message.pollOptions.length; ++i) + $root.proto.MsgOpaqueData.PollOption.encode(message.pollOptions[i], writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.pollSelectableOptionsCount != null && Object.hasOwnProperty.call(message, "pollSelectableOptionsCount")) + writer.uint32(/* id 20, wireType 0 =*/160).uint32(message.pollSelectableOptionsCount); + if (message.messageSecret != null && Object.hasOwnProperty.call(message, "messageSecret")) + writer.uint32(/* id 21, wireType 2 =*/170).bytes(message.messageSecret); + if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs")) + writer.uint32(/* id 22, wireType 0 =*/176).int64(message.senderTimestampMs); + if (message.pollUpdateParentKey != null && Object.hasOwnProperty.call(message, "pollUpdateParentKey")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.pollUpdateParentKey); + if (message.encPollVote != null && Object.hasOwnProperty.call(message, "encPollVote")) + $root.proto.PollEncValue.encode(message.encPollVote, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.encReactionTargetMessageKey != null && Object.hasOwnProperty.call(message, "encReactionTargetMessageKey")) + writer.uint32(/* id 25, wireType 2 =*/202).string(message.encReactionTargetMessageKey); + if (message.encReactionEncPayload != null && Object.hasOwnProperty.call(message, "encReactionEncPayload")) + writer.uint32(/* id 26, wireType 2 =*/210).bytes(message.encReactionEncPayload); + if (message.encReactionEncIv != null && Object.hasOwnProperty.call(message, "encReactionEncIv")) + writer.uint32(/* id 27, wireType 2 =*/218).bytes(message.encReactionEncIv); + if (message.isSentCagPollCreation != null && Object.hasOwnProperty.call(message, "isSentCagPollCreation")) + writer.uint32(/* id 28, wireType 0 =*/224).bool(message.isSentCagPollCreation); + if (message.originalSelfAuthor != null && Object.hasOwnProperty.call(message, "originalSelfAuthor")) + writer.uint32(/* id 51, wireType 2 =*/410).string(message.originalSelfAuthor); + return writer; + }; + + /** + * Encodes the specified MsgOpaqueData message, length delimited. Does not implicitly {@link proto.MsgOpaqueData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MsgOpaqueData + * @static + * @param {proto.IMsgOpaqueData} message MsgOpaqueData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgOpaqueData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgOpaqueData message from the specified reader or buffer. + * @function decode + * @memberof proto.MsgOpaqueData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MsgOpaqueData} MsgOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgOpaqueData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MsgOpaqueData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body = reader.string(); + break; + case 3: + message.caption = reader.string(); + break; + case 5: + message.lng = reader.double(); + break; + case 6: + message.isLive = reader.bool(); + break; + case 7: + message.lat = reader.double(); + break; + case 8: + message.paymentAmount1000 = reader.int32(); + break; + case 9: + message.paymentNoteMsgBody = reader.string(); + break; + case 10: + message.canonicalUrl = reader.string(); + break; + case 11: + message.matchedText = reader.string(); + break; + case 12: + message.title = reader.string(); + break; + case 13: + message.description = reader.string(); + break; + case 14: + message.futureproofBuffer = reader.bytes(); + break; + case 15: + message.clientUrl = reader.string(); + break; + case 16: + message.loc = reader.string(); + break; + case 17: + message.pollName = reader.string(); + break; + case 18: + if (!(message.pollOptions && message.pollOptions.length)) + message.pollOptions = []; + message.pollOptions.push($root.proto.MsgOpaqueData.PollOption.decode(reader, reader.uint32())); + break; + case 20: + message.pollSelectableOptionsCount = reader.uint32(); + break; + case 21: + message.messageSecret = reader.bytes(); + break; + case 51: + message.originalSelfAuthor = reader.string(); + break; + case 22: + message.senderTimestampMs = reader.int64(); + break; + case 23: + message.pollUpdateParentKey = reader.string(); + break; + case 24: + message.encPollVote = $root.proto.PollEncValue.decode(reader, reader.uint32()); + break; + case 28: + message.isSentCagPollCreation = reader.bool(); + break; + case 25: + message.encReactionTargetMessageKey = reader.string(); + break; + case 26: + message.encReactionEncPayload = reader.bytes(); + break; + case 27: + message.encReactionEncIv = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgOpaqueData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MsgOpaqueData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MsgOpaqueData} MsgOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgOpaqueData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgOpaqueData message. + * @function verify + * @memberof proto.MsgOpaqueData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgOpaqueData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + if (message.lng != null && message.hasOwnProperty("lng")) + if (typeof message.lng !== "number") + return "lng: number expected"; + if (message.isLive != null && message.hasOwnProperty("isLive")) + if (typeof message.isLive !== "boolean") + return "isLive: boolean expected"; + if (message.lat != null && message.hasOwnProperty("lat")) + if (typeof message.lat !== "number") + return "lat: number expected"; + if (message.paymentAmount1000 != null && message.hasOwnProperty("paymentAmount1000")) + if (!$util.isInteger(message.paymentAmount1000)) + return "paymentAmount1000: integer expected"; + if (message.paymentNoteMsgBody != null && message.hasOwnProperty("paymentNoteMsgBody")) + if (!$util.isString(message.paymentNoteMsgBody)) + return "paymentNoteMsgBody: string expected"; + if (message.canonicalUrl != null && message.hasOwnProperty("canonicalUrl")) + if (!$util.isString(message.canonicalUrl)) + return "canonicalUrl: string expected"; + if (message.matchedText != null && message.hasOwnProperty("matchedText")) + if (!$util.isString(message.matchedText)) + return "matchedText: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.futureproofBuffer != null && message.hasOwnProperty("futureproofBuffer")) + if (!(message.futureproofBuffer && typeof message.futureproofBuffer.length === "number" || $util.isString(message.futureproofBuffer))) + return "futureproofBuffer: buffer expected"; + if (message.clientUrl != null && message.hasOwnProperty("clientUrl")) + if (!$util.isString(message.clientUrl)) + return "clientUrl: string expected"; + if (message.loc != null && message.hasOwnProperty("loc")) + if (!$util.isString(message.loc)) + return "loc: string expected"; + if (message.pollName != null && message.hasOwnProperty("pollName")) + if (!$util.isString(message.pollName)) + return "pollName: string expected"; + if (message.pollOptions != null && message.hasOwnProperty("pollOptions")) { + if (!Array.isArray(message.pollOptions)) + return "pollOptions: array expected"; + for (var i = 0; i < message.pollOptions.length; ++i) { + var error = $root.proto.MsgOpaqueData.PollOption.verify(message.pollOptions[i]); + if (error) + return "pollOptions." + error; + } + } + if (message.pollSelectableOptionsCount != null && message.hasOwnProperty("pollSelectableOptionsCount")) + if (!$util.isInteger(message.pollSelectableOptionsCount)) + return "pollSelectableOptionsCount: integer expected"; + if (message.messageSecret != null && message.hasOwnProperty("messageSecret")) + if (!(message.messageSecret && typeof message.messageSecret.length === "number" || $util.isString(message.messageSecret))) + return "messageSecret: buffer expected"; + if (message.originalSelfAuthor != null && message.hasOwnProperty("originalSelfAuthor")) + if (!$util.isString(message.originalSelfAuthor)) + return "originalSelfAuthor: string expected"; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high))) + return "senderTimestampMs: integer|Long expected"; + if (message.pollUpdateParentKey != null && message.hasOwnProperty("pollUpdateParentKey")) + if (!$util.isString(message.pollUpdateParentKey)) + return "pollUpdateParentKey: string expected"; + if (message.encPollVote != null && message.hasOwnProperty("encPollVote")) { + var error = $root.proto.PollEncValue.verify(message.encPollVote); + if (error) + return "encPollVote." + error; + } + if (message.isSentCagPollCreation != null && message.hasOwnProperty("isSentCagPollCreation")) + if (typeof message.isSentCagPollCreation !== "boolean") + return "isSentCagPollCreation: boolean expected"; + if (message.encReactionTargetMessageKey != null && message.hasOwnProperty("encReactionTargetMessageKey")) + if (!$util.isString(message.encReactionTargetMessageKey)) + return "encReactionTargetMessageKey: string expected"; + if (message.encReactionEncPayload != null && message.hasOwnProperty("encReactionEncPayload")) + if (!(message.encReactionEncPayload && typeof message.encReactionEncPayload.length === "number" || $util.isString(message.encReactionEncPayload))) + return "encReactionEncPayload: buffer expected"; + if (message.encReactionEncIv != null && message.hasOwnProperty("encReactionEncIv")) + if (!(message.encReactionEncIv && typeof message.encReactionEncIv.length === "number" || $util.isString(message.encReactionEncIv))) + return "encReactionEncIv: buffer expected"; + return null; + }; + + /** + * Creates a MsgOpaqueData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MsgOpaqueData + * @static + * @param {Object.} object Plain object + * @returns {proto.MsgOpaqueData} MsgOpaqueData + */ + MsgOpaqueData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MsgOpaqueData) + return object; + var message = new $root.proto.MsgOpaqueData(); + if (object.body != null) + message.body = String(object.body); + if (object.caption != null) + message.caption = String(object.caption); + if (object.lng != null) + message.lng = Number(object.lng); + if (object.isLive != null) + message.isLive = Boolean(object.isLive); + if (object.lat != null) + message.lat = Number(object.lat); + if (object.paymentAmount1000 != null) + message.paymentAmount1000 = object.paymentAmount1000 | 0; + if (object.paymentNoteMsgBody != null) + message.paymentNoteMsgBody = String(object.paymentNoteMsgBody); + if (object.canonicalUrl != null) + message.canonicalUrl = String(object.canonicalUrl); + if (object.matchedText != null) + message.matchedText = String(object.matchedText); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.futureproofBuffer != null) + if (typeof object.futureproofBuffer === "string") + $util.base64.decode(object.futureproofBuffer, message.futureproofBuffer = $util.newBuffer($util.base64.length(object.futureproofBuffer)), 0); + else if (object.futureproofBuffer.length) + message.futureproofBuffer = object.futureproofBuffer; + if (object.clientUrl != null) + message.clientUrl = String(object.clientUrl); + if (object.loc != null) + message.loc = String(object.loc); + if (object.pollName != null) + message.pollName = String(object.pollName); + if (object.pollOptions) { + if (!Array.isArray(object.pollOptions)) + throw TypeError(".proto.MsgOpaqueData.pollOptions: array expected"); + message.pollOptions = []; + for (var i = 0; i < object.pollOptions.length; ++i) { + if (typeof object.pollOptions[i] !== "object") + throw TypeError(".proto.MsgOpaqueData.pollOptions: object expected"); + message.pollOptions[i] = $root.proto.MsgOpaqueData.PollOption.fromObject(object.pollOptions[i]); + } + } + if (object.pollSelectableOptionsCount != null) + message.pollSelectableOptionsCount = object.pollSelectableOptionsCount >>> 0; + if (object.messageSecret != null) + if (typeof object.messageSecret === "string") + $util.base64.decode(object.messageSecret, message.messageSecret = $util.newBuffer($util.base64.length(object.messageSecret)), 0); + else if (object.messageSecret.length) + message.messageSecret = object.messageSecret; + if (object.originalSelfAuthor != null) + message.originalSelfAuthor = String(object.originalSelfAuthor); + if (object.senderTimestampMs != null) + if ($util.Long) + (message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false; + else if (typeof object.senderTimestampMs === "string") + message.senderTimestampMs = parseInt(object.senderTimestampMs, 10); + else if (typeof object.senderTimestampMs === "number") + message.senderTimestampMs = object.senderTimestampMs; + else if (typeof object.senderTimestampMs === "object") + message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber(); + if (object.pollUpdateParentKey != null) + message.pollUpdateParentKey = String(object.pollUpdateParentKey); + if (object.encPollVote != null) { + if (typeof object.encPollVote !== "object") + throw TypeError(".proto.MsgOpaqueData.encPollVote: object expected"); + message.encPollVote = $root.proto.PollEncValue.fromObject(object.encPollVote); + } + if (object.isSentCagPollCreation != null) + message.isSentCagPollCreation = Boolean(object.isSentCagPollCreation); + if (object.encReactionTargetMessageKey != null) + message.encReactionTargetMessageKey = String(object.encReactionTargetMessageKey); + if (object.encReactionEncPayload != null) + if (typeof object.encReactionEncPayload === "string") + $util.base64.decode(object.encReactionEncPayload, message.encReactionEncPayload = $util.newBuffer($util.base64.length(object.encReactionEncPayload)), 0); + else if (object.encReactionEncPayload.length) + message.encReactionEncPayload = object.encReactionEncPayload; + if (object.encReactionEncIv != null) + if (typeof object.encReactionEncIv === "string") + $util.base64.decode(object.encReactionEncIv, message.encReactionEncIv = $util.newBuffer($util.base64.length(object.encReactionEncIv)), 0); + else if (object.encReactionEncIv.length) + message.encReactionEncIv = object.encReactionEncIv; + return message; + }; + + /** + * Creates a plain object from a MsgOpaqueData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MsgOpaqueData + * @static + * @param {proto.MsgOpaqueData} message MsgOpaqueData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgOpaqueData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pollOptions = []; + if (options.defaults) { + object.body = ""; + object.caption = ""; + object.lng = 0; + object.isLive = false; + object.lat = 0; + object.paymentAmount1000 = 0; + object.paymentNoteMsgBody = ""; + object.canonicalUrl = ""; + object.matchedText = ""; + object.title = ""; + object.description = ""; + if (options.bytes === String) + object.futureproofBuffer = ""; + else { + object.futureproofBuffer = []; + if (options.bytes !== Array) + object.futureproofBuffer = $util.newBuffer(object.futureproofBuffer); + } + object.clientUrl = ""; + object.loc = ""; + object.pollName = ""; + object.pollSelectableOptionsCount = 0; + if (options.bytes === String) + object.messageSecret = ""; + else { + object.messageSecret = []; + if (options.bytes !== Array) + object.messageSecret = $util.newBuffer(object.messageSecret); + } + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.senderTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestampMs = options.longs === String ? "0" : 0; + object.pollUpdateParentKey = ""; + object.encPollVote = null; + object.encReactionTargetMessageKey = ""; + if (options.bytes === String) + object.encReactionEncPayload = ""; + else { + object.encReactionEncPayload = []; + if (options.bytes !== Array) + object.encReactionEncPayload = $util.newBuffer(object.encReactionEncPayload); + } + if (options.bytes === String) + object.encReactionEncIv = ""; + else { + object.encReactionEncIv = []; + if (options.bytes !== Array) + object.encReactionEncIv = $util.newBuffer(object.encReactionEncIv); + } + object.isSentCagPollCreation = false; + object.originalSelfAuthor = ""; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + if (message.lng != null && message.hasOwnProperty("lng")) + object.lng = options.json && !isFinite(message.lng) ? String(message.lng) : message.lng; + if (message.isLive != null && message.hasOwnProperty("isLive")) + object.isLive = message.isLive; + if (message.lat != null && message.hasOwnProperty("lat")) + object.lat = options.json && !isFinite(message.lat) ? String(message.lat) : message.lat; + if (message.paymentAmount1000 != null && message.hasOwnProperty("paymentAmount1000")) + object.paymentAmount1000 = message.paymentAmount1000; + if (message.paymentNoteMsgBody != null && message.hasOwnProperty("paymentNoteMsgBody")) + object.paymentNoteMsgBody = message.paymentNoteMsgBody; + if (message.canonicalUrl != null && message.hasOwnProperty("canonicalUrl")) + object.canonicalUrl = message.canonicalUrl; + if (message.matchedText != null && message.hasOwnProperty("matchedText")) + object.matchedText = message.matchedText; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.futureproofBuffer != null && message.hasOwnProperty("futureproofBuffer")) + object.futureproofBuffer = options.bytes === String ? $util.base64.encode(message.futureproofBuffer, 0, message.futureproofBuffer.length) : options.bytes === Array ? Array.prototype.slice.call(message.futureproofBuffer) : message.futureproofBuffer; + if (message.clientUrl != null && message.hasOwnProperty("clientUrl")) + object.clientUrl = message.clientUrl; + if (message.loc != null && message.hasOwnProperty("loc")) + object.loc = message.loc; + if (message.pollName != null && message.hasOwnProperty("pollName")) + object.pollName = message.pollName; + if (message.pollOptions && message.pollOptions.length) { + object.pollOptions = []; + for (var j = 0; j < message.pollOptions.length; ++j) + object.pollOptions[j] = $root.proto.MsgOpaqueData.PollOption.toObject(message.pollOptions[j], options); + } + if (message.pollSelectableOptionsCount != null && message.hasOwnProperty("pollSelectableOptionsCount")) + object.pollSelectableOptionsCount = message.pollSelectableOptionsCount; + if (message.messageSecret != null && message.hasOwnProperty("messageSecret")) + object.messageSecret = options.bytes === String ? $util.base64.encode(message.messageSecret, 0, message.messageSecret.length) : options.bytes === Array ? Array.prototype.slice.call(message.messageSecret) : message.messageSecret; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (typeof message.senderTimestampMs === "number") + object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs; + else + object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs; + if (message.pollUpdateParentKey != null && message.hasOwnProperty("pollUpdateParentKey")) + object.pollUpdateParentKey = message.pollUpdateParentKey; + if (message.encPollVote != null && message.hasOwnProperty("encPollVote")) + object.encPollVote = $root.proto.PollEncValue.toObject(message.encPollVote, options); + if (message.encReactionTargetMessageKey != null && message.hasOwnProperty("encReactionTargetMessageKey")) + object.encReactionTargetMessageKey = message.encReactionTargetMessageKey; + if (message.encReactionEncPayload != null && message.hasOwnProperty("encReactionEncPayload")) + object.encReactionEncPayload = options.bytes === String ? $util.base64.encode(message.encReactionEncPayload, 0, message.encReactionEncPayload.length) : options.bytes === Array ? Array.prototype.slice.call(message.encReactionEncPayload) : message.encReactionEncPayload; + if (message.encReactionEncIv != null && message.hasOwnProperty("encReactionEncIv")) + object.encReactionEncIv = options.bytes === String ? $util.base64.encode(message.encReactionEncIv, 0, message.encReactionEncIv.length) : options.bytes === Array ? Array.prototype.slice.call(message.encReactionEncIv) : message.encReactionEncIv; + if (message.isSentCagPollCreation != null && message.hasOwnProperty("isSentCagPollCreation")) + object.isSentCagPollCreation = message.isSentCagPollCreation; + if (message.originalSelfAuthor != null && message.hasOwnProperty("originalSelfAuthor")) + object.originalSelfAuthor = message.originalSelfAuthor; + return object; + }; + + /** + * Converts this MsgOpaqueData to JSON. + * @function toJSON + * @memberof proto.MsgOpaqueData + * @instance + * @returns {Object.} JSON object + */ + MsgOpaqueData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + MsgOpaqueData.PollOption = (function() { + + /** + * Properties of a PollOption. + * @memberof proto.MsgOpaqueData + * @interface IPollOption + * @property {string|null} [name] PollOption name + */ + + /** + * Constructs a new PollOption. + * @memberof proto.MsgOpaqueData + * @classdesc Represents a PollOption. + * @implements IPollOption + * @constructor + * @param {proto.MsgOpaqueData.IPollOption=} [properties] Properties to set + */ + function PollOption(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollOption name. + * @member {string} name + * @memberof proto.MsgOpaqueData.PollOption + * @instance + */ + PollOption.prototype.name = ""; + + /** + * Creates a new PollOption instance using the specified properties. + * @function create + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {proto.MsgOpaqueData.IPollOption=} [properties] Properties to set + * @returns {proto.MsgOpaqueData.PollOption} PollOption instance + */ + PollOption.create = function create(properties) { + return new PollOption(properties); + }; + + /** + * Encodes the specified PollOption message. Does not implicitly {@link proto.MsgOpaqueData.PollOption.verify|verify} messages. + * @function encode + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {proto.MsgOpaqueData.IPollOption} message PollOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified PollOption message, length delimited. Does not implicitly {@link proto.MsgOpaqueData.PollOption.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {proto.MsgOpaqueData.IPollOption} message PollOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollOption message from the specified reader or buffer. + * @function decode + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MsgOpaqueData.PollOption} PollOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MsgOpaqueData.PollOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MsgOpaqueData.PollOption} PollOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollOption message. + * @function verify + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a PollOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {Object.} object Plain object + * @returns {proto.MsgOpaqueData.PollOption} PollOption + */ + PollOption.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MsgOpaqueData.PollOption) + return object; + var message = new $root.proto.MsgOpaqueData.PollOption(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a PollOption message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MsgOpaqueData.PollOption + * @static + * @param {proto.MsgOpaqueData.PollOption} message PollOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this PollOption to JSON. + * @function toJSON + * @memberof proto.MsgOpaqueData.PollOption + * @instance + * @returns {Object.} JSON object + */ + PollOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollOption; + })(); + + return MsgOpaqueData; + })(); + + proto.MsgRowOpaqueData = (function() { + + /** + * Properties of a MsgRowOpaqueData. + * @memberof proto + * @interface IMsgRowOpaqueData + * @property {proto.IMsgOpaqueData|null} [currentMsg] MsgRowOpaqueData currentMsg + * @property {proto.IMsgOpaqueData|null} [quotedMsg] MsgRowOpaqueData quotedMsg + */ + + /** + * Constructs a new MsgRowOpaqueData. + * @memberof proto + * @classdesc Represents a MsgRowOpaqueData. + * @implements IMsgRowOpaqueData + * @constructor + * @param {proto.IMsgRowOpaqueData=} [properties] Properties to set + */ + function MsgRowOpaqueData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MsgRowOpaqueData currentMsg. + * @member {proto.IMsgOpaqueData|null|undefined} currentMsg + * @memberof proto.MsgRowOpaqueData + * @instance + */ + MsgRowOpaqueData.prototype.currentMsg = null; + + /** + * MsgRowOpaqueData quotedMsg. + * @member {proto.IMsgOpaqueData|null|undefined} quotedMsg + * @memberof proto.MsgRowOpaqueData + * @instance + */ + MsgRowOpaqueData.prototype.quotedMsg = null; + + /** + * Creates a new MsgRowOpaqueData instance using the specified properties. + * @function create + * @memberof proto.MsgRowOpaqueData + * @static + * @param {proto.IMsgRowOpaqueData=} [properties] Properties to set + * @returns {proto.MsgRowOpaqueData} MsgRowOpaqueData instance + */ + MsgRowOpaqueData.create = function create(properties) { + return new MsgRowOpaqueData(properties); + }; + + /** + * Encodes the specified MsgRowOpaqueData message. Does not implicitly {@link proto.MsgRowOpaqueData.verify|verify} messages. + * @function encode + * @memberof proto.MsgRowOpaqueData + * @static + * @param {proto.IMsgRowOpaqueData} message MsgRowOpaqueData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgRowOpaqueData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currentMsg != null && Object.hasOwnProperty.call(message, "currentMsg")) + $root.proto.MsgOpaqueData.encode(message.currentMsg, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quotedMsg != null && Object.hasOwnProperty.call(message, "quotedMsg")) + $root.proto.MsgOpaqueData.encode(message.quotedMsg, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MsgRowOpaqueData message, length delimited. Does not implicitly {@link proto.MsgRowOpaqueData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.MsgRowOpaqueData + * @static + * @param {proto.IMsgRowOpaqueData} message MsgRowOpaqueData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MsgRowOpaqueData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MsgRowOpaqueData message from the specified reader or buffer. + * @function decode + * @memberof proto.MsgRowOpaqueData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.MsgRowOpaqueData} MsgRowOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgRowOpaqueData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.MsgRowOpaqueData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currentMsg = $root.proto.MsgOpaqueData.decode(reader, reader.uint32()); + break; + case 2: + message.quotedMsg = $root.proto.MsgOpaqueData.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MsgRowOpaqueData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.MsgRowOpaqueData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.MsgRowOpaqueData} MsgRowOpaqueData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MsgRowOpaqueData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MsgRowOpaqueData message. + * @function verify + * @memberof proto.MsgRowOpaqueData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MsgRowOpaqueData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currentMsg != null && message.hasOwnProperty("currentMsg")) { + var error = $root.proto.MsgOpaqueData.verify(message.currentMsg); + if (error) + return "currentMsg." + error; + } + if (message.quotedMsg != null && message.hasOwnProperty("quotedMsg")) { + var error = $root.proto.MsgOpaqueData.verify(message.quotedMsg); + if (error) + return "quotedMsg." + error; + } + return null; + }; + + /** + * Creates a MsgRowOpaqueData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.MsgRowOpaqueData + * @static + * @param {Object.} object Plain object + * @returns {proto.MsgRowOpaqueData} MsgRowOpaqueData + */ + MsgRowOpaqueData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.MsgRowOpaqueData) + return object; + var message = new $root.proto.MsgRowOpaqueData(); + if (object.currentMsg != null) { + if (typeof object.currentMsg !== "object") + throw TypeError(".proto.MsgRowOpaqueData.currentMsg: object expected"); + message.currentMsg = $root.proto.MsgOpaqueData.fromObject(object.currentMsg); + } + if (object.quotedMsg != null) { + if (typeof object.quotedMsg !== "object") + throw TypeError(".proto.MsgRowOpaqueData.quotedMsg: object expected"); + message.quotedMsg = $root.proto.MsgOpaqueData.fromObject(object.quotedMsg); + } + return message; + }; + + /** + * Creates a plain object from a MsgRowOpaqueData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.MsgRowOpaqueData + * @static + * @param {proto.MsgRowOpaqueData} message MsgRowOpaqueData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MsgRowOpaqueData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currentMsg = null; + object.quotedMsg = null; + } + if (message.currentMsg != null && message.hasOwnProperty("currentMsg")) + object.currentMsg = $root.proto.MsgOpaqueData.toObject(message.currentMsg, options); + if (message.quotedMsg != null && message.hasOwnProperty("quotedMsg")) + object.quotedMsg = $root.proto.MsgOpaqueData.toObject(message.quotedMsg, options); + return object; + }; + + /** + * Converts this MsgRowOpaqueData to JSON. + * @function toJSON + * @memberof proto.MsgRowOpaqueData + * @instance + * @returns {Object.} JSON object + */ + MsgRowOpaqueData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MsgRowOpaqueData; + })(); + + proto.NoiseCertificate = (function() { + + /** + * Properties of a NoiseCertificate. + * @memberof proto + * @interface INoiseCertificate + * @property {Uint8Array|null} [details] NoiseCertificate details + * @property {Uint8Array|null} [signature] NoiseCertificate signature + */ + + /** + * Constructs a new NoiseCertificate. + * @memberof proto + * @classdesc Represents a NoiseCertificate. + * @implements INoiseCertificate + * @constructor + * @param {proto.INoiseCertificate=} [properties] Properties to set + */ + function NoiseCertificate(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NoiseCertificate details. + * @member {Uint8Array} details + * @memberof proto.NoiseCertificate + * @instance + */ + NoiseCertificate.prototype.details = $util.newBuffer([]); + + /** + * NoiseCertificate signature. + * @member {Uint8Array} signature + * @memberof proto.NoiseCertificate + * @instance + */ + NoiseCertificate.prototype.signature = $util.newBuffer([]); + + /** + * Creates a new NoiseCertificate instance using the specified properties. + * @function create + * @memberof proto.NoiseCertificate + * @static + * @param {proto.INoiseCertificate=} [properties] Properties to set + * @returns {proto.NoiseCertificate} NoiseCertificate instance + */ + NoiseCertificate.create = function create(properties) { + return new NoiseCertificate(properties); + }; + + /** + * Encodes the specified NoiseCertificate message. Does not implicitly {@link proto.NoiseCertificate.verify|verify} messages. + * @function encode + * @memberof proto.NoiseCertificate + * @static + * @param {proto.INoiseCertificate} message NoiseCertificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NoiseCertificate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature); + return writer; + }; + + /** + * Encodes the specified NoiseCertificate message, length delimited. Does not implicitly {@link proto.NoiseCertificate.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.NoiseCertificate + * @static + * @param {proto.INoiseCertificate} message NoiseCertificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NoiseCertificate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer. + * @function decode + * @memberof proto.NoiseCertificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.NoiseCertificate} NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NoiseCertificate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.NoiseCertificate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.details = reader.bytes(); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NoiseCertificate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.NoiseCertificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.NoiseCertificate} NoiseCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NoiseCertificate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NoiseCertificate message. + * @function verify + * @memberof proto.NoiseCertificate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NoiseCertificate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) + return "details: buffer expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + return null; + }; + + /** + * Creates a NoiseCertificate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.NoiseCertificate + * @static + * @param {Object.} object Plain object + * @returns {proto.NoiseCertificate} NoiseCertificate + */ + NoiseCertificate.fromObject = function fromObject(object) { + if (object instanceof $root.proto.NoiseCertificate) + return object; + var message = new $root.proto.NoiseCertificate(); + if (object.details != null) + if (typeof object.details === "string") + $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); + else if (object.details.length) + message.details = object.details; + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + return message; + }; + + /** + * Creates a plain object from a NoiseCertificate message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.NoiseCertificate + * @static + * @param {proto.NoiseCertificate} message NoiseCertificate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NoiseCertificate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.details = ""; + else { + object.details = []; + if (options.bytes !== Array) + object.details = $util.newBuffer(object.details); + } + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + return object; + }; + + /** + * Converts this NoiseCertificate to JSON. + * @function toJSON + * @memberof proto.NoiseCertificate + * @instance + * @returns {Object.} JSON object + */ + NoiseCertificate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + NoiseCertificate.Details = (function() { + + /** + * Properties of a Details. + * @memberof proto.NoiseCertificate + * @interface IDetails + * @property {number|null} [serial] Details serial + * @property {string|null} [issuer] Details issuer + * @property {number|Long|null} [expires] Details expires + * @property {string|null} [subject] Details subject + * @property {Uint8Array|null} [key] Details key + */ + + /** + * Constructs a new Details. + * @memberof proto.NoiseCertificate + * @classdesc Represents a Details. + * @implements IDetails + * @constructor + * @param {proto.NoiseCertificate.IDetails=} [properties] Properties to set + */ + function Details(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Details serial. + * @member {number} serial + * @memberof proto.NoiseCertificate.Details + * @instance + */ + Details.prototype.serial = 0; + + /** + * Details issuer. + * @member {string} issuer + * @memberof proto.NoiseCertificate.Details + * @instance + */ + Details.prototype.issuer = ""; + + /** + * Details expires. + * @member {number|Long} expires + * @memberof proto.NoiseCertificate.Details + * @instance + */ + Details.prototype.expires = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Details subject. + * @member {string} subject + * @memberof proto.NoiseCertificate.Details + * @instance + */ + Details.prototype.subject = ""; + + /** + * Details key. + * @member {Uint8Array} key + * @memberof proto.NoiseCertificate.Details + * @instance + */ + Details.prototype.key = $util.newBuffer([]); + + /** + * Creates a new Details instance using the specified properties. + * @function create + * @memberof proto.NoiseCertificate.Details + * @static + * @param {proto.NoiseCertificate.IDetails=} [properties] Properties to set + * @returns {proto.NoiseCertificate.Details} Details instance + */ + Details.create = function create(properties) { + return new Details(properties); + }; + + /** + * Encodes the specified Details message. Does not implicitly {@link proto.NoiseCertificate.Details.verify|verify} messages. + * @function encode + * @memberof proto.NoiseCertificate.Details + * @static + * @param {proto.NoiseCertificate.IDetails} message Details message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Details.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serial != null && Object.hasOwnProperty.call(message, "serial")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.serial); + if (message.issuer != null && Object.hasOwnProperty.call(message, "issuer")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.issuer); + if (message.expires != null && Object.hasOwnProperty.call(message, "expires")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.expires); + if (message.subject != null && Object.hasOwnProperty.call(message, "subject")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.subject); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.key); + return writer; + }; + + /** + * Encodes the specified Details message, length delimited. Does not implicitly {@link proto.NoiseCertificate.Details.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.NoiseCertificate.Details + * @static + * @param {proto.NoiseCertificate.IDetails} message Details message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Details.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Details message from the specified reader or buffer. + * @function decode + * @memberof proto.NoiseCertificate.Details + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.NoiseCertificate.Details} Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Details.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.NoiseCertificate.Details(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.serial = reader.uint32(); + break; + case 2: + message.issuer = reader.string(); + break; + case 3: + message.expires = reader.uint64(); + break; + case 4: + message.subject = reader.string(); + break; + case 5: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Details message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.NoiseCertificate.Details + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.NoiseCertificate.Details} Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Details.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Details message. + * @function verify + * @memberof proto.NoiseCertificate.Details + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Details.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serial != null && message.hasOwnProperty("serial")) + if (!$util.isInteger(message.serial)) + return "serial: integer expected"; + if (message.issuer != null && message.hasOwnProperty("issuer")) + if (!$util.isString(message.issuer)) + return "issuer: string expected"; + if (message.expires != null && message.hasOwnProperty("expires")) + if (!$util.isInteger(message.expires) && !(message.expires && $util.isInteger(message.expires.low) && $util.isInteger(message.expires.high))) + return "expires: integer|Long expected"; + if (message.subject != null && message.hasOwnProperty("subject")) + if (!$util.isString(message.subject)) + return "subject: string expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + return null; + }; + + /** + * Creates a Details message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.NoiseCertificate.Details + * @static + * @param {Object.} object Plain object + * @returns {proto.NoiseCertificate.Details} Details + */ + Details.fromObject = function fromObject(object) { + if (object instanceof $root.proto.NoiseCertificate.Details) + return object; + var message = new $root.proto.NoiseCertificate.Details(); + if (object.serial != null) + message.serial = object.serial >>> 0; + if (object.issuer != null) + message.issuer = String(object.issuer); + if (object.expires != null) + if ($util.Long) + (message.expires = $util.Long.fromValue(object.expires)).unsigned = true; + else if (typeof object.expires === "string") + message.expires = parseInt(object.expires, 10); + else if (typeof object.expires === "number") + message.expires = object.expires; + else if (typeof object.expires === "object") + message.expires = new $util.LongBits(object.expires.low >>> 0, object.expires.high >>> 0).toNumber(true); + if (object.subject != null) + message.subject = String(object.subject); + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + return message; + }; + + /** + * Creates a plain object from a Details message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.NoiseCertificate.Details + * @static + * @param {proto.NoiseCertificate.Details} message Details + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Details.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.serial = 0; + object.issuer = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.expires = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expires = options.longs === String ? "0" : 0; + object.subject = ""; + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + } + if (message.serial != null && message.hasOwnProperty("serial")) + object.serial = message.serial; + if (message.issuer != null && message.hasOwnProperty("issuer")) + object.issuer = message.issuer; + if (message.expires != null && message.hasOwnProperty("expires")) + if (typeof message.expires === "number") + object.expires = options.longs === String ? String(message.expires) : message.expires; + else + object.expires = options.longs === String ? $util.Long.prototype.toString.call(message.expires) : options.longs === Number ? new $util.LongBits(message.expires.low >>> 0, message.expires.high >>> 0).toNumber(true) : message.expires; + if (message.subject != null && message.hasOwnProperty("subject")) + object.subject = message.subject; + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + return object; + }; + + /** + * Converts this Details to JSON. + * @function toJSON + * @memberof proto.NoiseCertificate.Details + * @instance + * @returns {Object.} JSON object + */ + Details.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Details; + })(); + + return NoiseCertificate; + })(); + + proto.NotificationMessageInfo = (function() { + + /** + * Properties of a NotificationMessageInfo. + * @memberof proto + * @interface INotificationMessageInfo + * @property {proto.IMessageKey|null} [key] NotificationMessageInfo key + * @property {proto.IMessage|null} [message] NotificationMessageInfo message + * @property {number|Long|null} [messageTimestamp] NotificationMessageInfo messageTimestamp + * @property {string|null} [participant] NotificationMessageInfo participant + */ + + /** + * Constructs a new NotificationMessageInfo. + * @memberof proto + * @classdesc Represents a NotificationMessageInfo. + * @implements INotificationMessageInfo + * @constructor + * @param {proto.INotificationMessageInfo=} [properties] Properties to set + */ + function NotificationMessageInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NotificationMessageInfo key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.NotificationMessageInfo + * @instance + */ + NotificationMessageInfo.prototype.key = null; + + /** + * NotificationMessageInfo message. + * @member {proto.IMessage|null|undefined} message + * @memberof proto.NotificationMessageInfo + * @instance + */ + NotificationMessageInfo.prototype.message = null; + + /** + * NotificationMessageInfo messageTimestamp. + * @member {number|Long} messageTimestamp + * @memberof proto.NotificationMessageInfo + * @instance + */ + NotificationMessageInfo.prototype.messageTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * NotificationMessageInfo participant. + * @member {string} participant + * @memberof proto.NotificationMessageInfo + * @instance + */ + NotificationMessageInfo.prototype.participant = ""; + + /** + * Creates a new NotificationMessageInfo instance using the specified properties. + * @function create + * @memberof proto.NotificationMessageInfo + * @static + * @param {proto.INotificationMessageInfo=} [properties] Properties to set + * @returns {proto.NotificationMessageInfo} NotificationMessageInfo instance + */ + NotificationMessageInfo.create = function create(properties) { + return new NotificationMessageInfo(properties); + }; + + /** + * Encodes the specified NotificationMessageInfo message. Does not implicitly {@link proto.NotificationMessageInfo.verify|verify} messages. + * @function encode + * @memberof proto.NotificationMessageInfo + * @static + * @param {proto.INotificationMessageInfo} message NotificationMessageInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationMessageInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.proto.Message.encode(message.message, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.messageTimestamp != null && Object.hasOwnProperty.call(message, "messageTimestamp")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.messageTimestamp); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.participant); + return writer; + }; + + /** + * Encodes the specified NotificationMessageInfo message, length delimited. Does not implicitly {@link proto.NotificationMessageInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.NotificationMessageInfo + * @static + * @param {proto.INotificationMessageInfo} message NotificationMessageInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationMessageInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NotificationMessageInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.NotificationMessageInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.NotificationMessageInfo} NotificationMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationMessageInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.NotificationMessageInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.message = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 3: + message.messageTimestamp = reader.uint64(); + break; + case 4: + message.participant = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NotificationMessageInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.NotificationMessageInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.NotificationMessageInfo} NotificationMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationMessageInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NotificationMessageInfo message. + * @function verify + * @memberof proto.NotificationMessageInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NotificationMessageInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.proto.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.messageTimestamp != null && message.hasOwnProperty("messageTimestamp")) + if (!$util.isInteger(message.messageTimestamp) && !(message.messageTimestamp && $util.isInteger(message.messageTimestamp.low) && $util.isInteger(message.messageTimestamp.high))) + return "messageTimestamp: integer|Long expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + return null; + }; + + /** + * Creates a NotificationMessageInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.NotificationMessageInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.NotificationMessageInfo} NotificationMessageInfo + */ + NotificationMessageInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.NotificationMessageInfo) + return object; + var message = new $root.proto.NotificationMessageInfo(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.NotificationMessageInfo.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".proto.NotificationMessageInfo.message: object expected"); + message.message = $root.proto.Message.fromObject(object.message); + } + if (object.messageTimestamp != null) + if ($util.Long) + (message.messageTimestamp = $util.Long.fromValue(object.messageTimestamp)).unsigned = true; + else if (typeof object.messageTimestamp === "string") + message.messageTimestamp = parseInt(object.messageTimestamp, 10); + else if (typeof object.messageTimestamp === "number") + message.messageTimestamp = object.messageTimestamp; + else if (typeof object.messageTimestamp === "object") + message.messageTimestamp = new $util.LongBits(object.messageTimestamp.low >>> 0, object.messageTimestamp.high >>> 0).toNumber(true); + if (object.participant != null) + message.participant = String(object.participant); + return message; + }; + + /** + * Creates a plain object from a NotificationMessageInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.NotificationMessageInfo + * @static + * @param {proto.NotificationMessageInfo} message NotificationMessageInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NotificationMessageInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.message = null; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.messageTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.messageTimestamp = options.longs === String ? "0" : 0; + object.participant = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.proto.Message.toObject(message.message, options); + if (message.messageTimestamp != null && message.hasOwnProperty("messageTimestamp")) + if (typeof message.messageTimestamp === "number") + object.messageTimestamp = options.longs === String ? String(message.messageTimestamp) : message.messageTimestamp; + else + object.messageTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.messageTimestamp) : options.longs === Number ? new $util.LongBits(message.messageTimestamp.low >>> 0, message.messageTimestamp.high >>> 0).toNumber(true) : message.messageTimestamp; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + return object; + }; + + /** + * Converts this NotificationMessageInfo to JSON. + * @function toJSON + * @memberof proto.NotificationMessageInfo + * @instance + * @returns {Object.} JSON object + */ + NotificationMessageInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NotificationMessageInfo; + })(); + + proto.PastParticipant = (function() { + + /** + * Properties of a PastParticipant. + * @memberof proto + * @interface IPastParticipant + * @property {string|null} [userJid] PastParticipant userJid + * @property {proto.PastParticipant.LeaveReason|null} [leaveReason] PastParticipant leaveReason + * @property {number|Long|null} [leaveTs] PastParticipant leaveTs + */ + + /** + * Constructs a new PastParticipant. + * @memberof proto + * @classdesc Represents a PastParticipant. + * @implements IPastParticipant + * @constructor + * @param {proto.IPastParticipant=} [properties] Properties to set + */ + function PastParticipant(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PastParticipant userJid. + * @member {string} userJid + * @memberof proto.PastParticipant + * @instance + */ + PastParticipant.prototype.userJid = ""; + + /** + * PastParticipant leaveReason. + * @member {proto.PastParticipant.LeaveReason} leaveReason + * @memberof proto.PastParticipant + * @instance + */ + PastParticipant.prototype.leaveReason = 0; + + /** + * PastParticipant leaveTs. + * @member {number|Long} leaveTs + * @memberof proto.PastParticipant + * @instance + */ + PastParticipant.prototype.leaveTs = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new PastParticipant instance using the specified properties. + * @function create + * @memberof proto.PastParticipant + * @static + * @param {proto.IPastParticipant=} [properties] Properties to set + * @returns {proto.PastParticipant} PastParticipant instance + */ + PastParticipant.create = function create(properties) { + return new PastParticipant(properties); + }; + + /** + * Encodes the specified PastParticipant message. Does not implicitly {@link proto.PastParticipant.verify|verify} messages. + * @function encode + * @memberof proto.PastParticipant + * @static + * @param {proto.IPastParticipant} message PastParticipant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PastParticipant.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.userJid != null && Object.hasOwnProperty.call(message, "userJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userJid); + if (message.leaveReason != null && Object.hasOwnProperty.call(message, "leaveReason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.leaveReason); + if (message.leaveTs != null && Object.hasOwnProperty.call(message, "leaveTs")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.leaveTs); + return writer; + }; + + /** + * Encodes the specified PastParticipant message, length delimited. Does not implicitly {@link proto.PastParticipant.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PastParticipant + * @static + * @param {proto.IPastParticipant} message PastParticipant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PastParticipant.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PastParticipant message from the specified reader or buffer. + * @function decode + * @memberof proto.PastParticipant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PastParticipant} PastParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PastParticipant.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PastParticipant(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userJid = reader.string(); + break; + case 2: + message.leaveReason = reader.int32(); + break; + case 3: + message.leaveTs = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PastParticipant message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PastParticipant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PastParticipant} PastParticipant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PastParticipant.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PastParticipant message. + * @function verify + * @memberof proto.PastParticipant + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PastParticipant.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.userJid != null && message.hasOwnProperty("userJid")) + if (!$util.isString(message.userJid)) + return "userJid: string expected"; + if (message.leaveReason != null && message.hasOwnProperty("leaveReason")) + switch (message.leaveReason) { + default: + return "leaveReason: enum value expected"; + case 0: + case 1: + break; + } + if (message.leaveTs != null && message.hasOwnProperty("leaveTs")) + if (!$util.isInteger(message.leaveTs) && !(message.leaveTs && $util.isInteger(message.leaveTs.low) && $util.isInteger(message.leaveTs.high))) + return "leaveTs: integer|Long expected"; + return null; + }; + + /** + * Creates a PastParticipant message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PastParticipant + * @static + * @param {Object.} object Plain object + * @returns {proto.PastParticipant} PastParticipant + */ + PastParticipant.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PastParticipant) + return object; + var message = new $root.proto.PastParticipant(); + if (object.userJid != null) + message.userJid = String(object.userJid); + switch (object.leaveReason) { + case "LEFT": + case 0: + message.leaveReason = 0; + break; + case "REMOVED": + case 1: + message.leaveReason = 1; + break; + } + if (object.leaveTs != null) + if ($util.Long) + (message.leaveTs = $util.Long.fromValue(object.leaveTs)).unsigned = true; + else if (typeof object.leaveTs === "string") + message.leaveTs = parseInt(object.leaveTs, 10); + else if (typeof object.leaveTs === "number") + message.leaveTs = object.leaveTs; + else if (typeof object.leaveTs === "object") + message.leaveTs = new $util.LongBits(object.leaveTs.low >>> 0, object.leaveTs.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a PastParticipant message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PastParticipant + * @static + * @param {proto.PastParticipant} message PastParticipant + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PastParticipant.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.userJid = ""; + object.leaveReason = options.enums === String ? "LEFT" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.leaveTs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.leaveTs = options.longs === String ? "0" : 0; + } + if (message.userJid != null && message.hasOwnProperty("userJid")) + object.userJid = message.userJid; + if (message.leaveReason != null && message.hasOwnProperty("leaveReason")) + object.leaveReason = options.enums === String ? $root.proto.PastParticipant.LeaveReason[message.leaveReason] : message.leaveReason; + if (message.leaveTs != null && message.hasOwnProperty("leaveTs")) + if (typeof message.leaveTs === "number") + object.leaveTs = options.longs === String ? String(message.leaveTs) : message.leaveTs; + else + object.leaveTs = options.longs === String ? $util.Long.prototype.toString.call(message.leaveTs) : options.longs === Number ? new $util.LongBits(message.leaveTs.low >>> 0, message.leaveTs.high >>> 0).toNumber(true) : message.leaveTs; + return object; + }; + + /** + * Converts this PastParticipant to JSON. + * @function toJSON + * @memberof proto.PastParticipant + * @instance + * @returns {Object.} JSON object + */ + PastParticipant.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * LeaveReason enum. + * @name proto.PastParticipant.LeaveReason + * @enum {number} + * @property {number} LEFT=0 LEFT value + * @property {number} REMOVED=1 REMOVED value + */ + PastParticipant.LeaveReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LEFT"] = 0; + values[valuesById[1] = "REMOVED"] = 1; + return values; + })(); + + return PastParticipant; + })(); + + proto.PastParticipants = (function() { + + /** + * Properties of a PastParticipants. + * @memberof proto + * @interface IPastParticipants + * @property {string|null} [groupJid] PastParticipants groupJid + * @property {Array.|null} [pastParticipants] PastParticipants pastParticipants + */ + + /** + * Constructs a new PastParticipants. + * @memberof proto + * @classdesc Represents a PastParticipants. + * @implements IPastParticipants + * @constructor + * @param {proto.IPastParticipants=} [properties] Properties to set + */ + function PastParticipants(properties) { + this.pastParticipants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PastParticipants groupJid. + * @member {string} groupJid + * @memberof proto.PastParticipants + * @instance + */ + PastParticipants.prototype.groupJid = ""; + + /** + * PastParticipants pastParticipants. + * @member {Array.} pastParticipants + * @memberof proto.PastParticipants + * @instance + */ + PastParticipants.prototype.pastParticipants = $util.emptyArray; + + /** + * Creates a new PastParticipants instance using the specified properties. + * @function create + * @memberof proto.PastParticipants + * @static + * @param {proto.IPastParticipants=} [properties] Properties to set + * @returns {proto.PastParticipants} PastParticipants instance + */ + PastParticipants.create = function create(properties) { + return new PastParticipants(properties); + }; + + /** + * Encodes the specified PastParticipants message. Does not implicitly {@link proto.PastParticipants.verify|verify} messages. + * @function encode + * @memberof proto.PastParticipants + * @static + * @param {proto.IPastParticipants} message PastParticipants message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PastParticipants.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.groupJid != null && Object.hasOwnProperty.call(message, "groupJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.groupJid); + if (message.pastParticipants != null && message.pastParticipants.length) + for (var i = 0; i < message.pastParticipants.length; ++i) + $root.proto.PastParticipant.encode(message.pastParticipants[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PastParticipants message, length delimited. Does not implicitly {@link proto.PastParticipants.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PastParticipants + * @static + * @param {proto.IPastParticipants} message PastParticipants message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PastParticipants.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PastParticipants message from the specified reader or buffer. + * @function decode + * @memberof proto.PastParticipants + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PastParticipants} PastParticipants + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PastParticipants.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PastParticipants(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupJid = reader.string(); + break; + case 2: + if (!(message.pastParticipants && message.pastParticipants.length)) + message.pastParticipants = []; + message.pastParticipants.push($root.proto.PastParticipant.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PastParticipants message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PastParticipants + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PastParticipants} PastParticipants + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PastParticipants.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PastParticipants message. + * @function verify + * @memberof proto.PastParticipants + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PastParticipants.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.groupJid != null && message.hasOwnProperty("groupJid")) + if (!$util.isString(message.groupJid)) + return "groupJid: string expected"; + if (message.pastParticipants != null && message.hasOwnProperty("pastParticipants")) { + if (!Array.isArray(message.pastParticipants)) + return "pastParticipants: array expected"; + for (var i = 0; i < message.pastParticipants.length; ++i) { + var error = $root.proto.PastParticipant.verify(message.pastParticipants[i]); + if (error) + return "pastParticipants." + error; + } + } + return null; + }; + + /** + * Creates a PastParticipants message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PastParticipants + * @static + * @param {Object.} object Plain object + * @returns {proto.PastParticipants} PastParticipants + */ + PastParticipants.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PastParticipants) + return object; + var message = new $root.proto.PastParticipants(); + if (object.groupJid != null) + message.groupJid = String(object.groupJid); + if (object.pastParticipants) { + if (!Array.isArray(object.pastParticipants)) + throw TypeError(".proto.PastParticipants.pastParticipants: array expected"); + message.pastParticipants = []; + for (var i = 0; i < object.pastParticipants.length; ++i) { + if (typeof object.pastParticipants[i] !== "object") + throw TypeError(".proto.PastParticipants.pastParticipants: object expected"); + message.pastParticipants[i] = $root.proto.PastParticipant.fromObject(object.pastParticipants[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PastParticipants message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PastParticipants + * @static + * @param {proto.PastParticipants} message PastParticipants + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PastParticipants.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pastParticipants = []; + if (options.defaults) + object.groupJid = ""; + if (message.groupJid != null && message.hasOwnProperty("groupJid")) + object.groupJid = message.groupJid; + if (message.pastParticipants && message.pastParticipants.length) { + object.pastParticipants = []; + for (var j = 0; j < message.pastParticipants.length; ++j) + object.pastParticipants[j] = $root.proto.PastParticipant.toObject(message.pastParticipants[j], options); + } + return object; + }; + + /** + * Converts this PastParticipants to JSON. + * @function toJSON + * @memberof proto.PastParticipants + * @instance + * @returns {Object.} JSON object + */ + PastParticipants.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PastParticipants; + })(); + + proto.PaymentBackground = (function() { + + /** + * Properties of a PaymentBackground. + * @memberof proto + * @interface IPaymentBackground + * @property {string|null} [id] PaymentBackground id + * @property {number|Long|null} [fileLength] PaymentBackground fileLength + * @property {number|null} [width] PaymentBackground width + * @property {number|null} [height] PaymentBackground height + * @property {string|null} [mimetype] PaymentBackground mimetype + * @property {number|null} [placeholderArgb] PaymentBackground placeholderArgb + * @property {number|null} [textArgb] PaymentBackground textArgb + * @property {number|null} [subtextArgb] PaymentBackground subtextArgb + * @property {proto.PaymentBackground.IMediaData|null} [mediaData] PaymentBackground mediaData + * @property {proto.PaymentBackground.Type|null} [type] PaymentBackground type + */ + + /** + * Constructs a new PaymentBackground. + * @memberof proto + * @classdesc Represents a PaymentBackground. + * @implements IPaymentBackground + * @constructor + * @param {proto.IPaymentBackground=} [properties] Properties to set + */ + function PaymentBackground(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PaymentBackground id. + * @member {string} id + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.id = ""; + + /** + * PaymentBackground fileLength. + * @member {number|Long} fileLength + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PaymentBackground width. + * @member {number} width + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.width = 0; + + /** + * PaymentBackground height. + * @member {number} height + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.height = 0; + + /** + * PaymentBackground mimetype. + * @member {string} mimetype + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.mimetype = ""; + + /** + * PaymentBackground placeholderArgb. + * @member {number} placeholderArgb + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.placeholderArgb = 0; + + /** + * PaymentBackground textArgb. + * @member {number} textArgb + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.textArgb = 0; + + /** + * PaymentBackground subtextArgb. + * @member {number} subtextArgb + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.subtextArgb = 0; + + /** + * PaymentBackground mediaData. + * @member {proto.PaymentBackground.IMediaData|null|undefined} mediaData + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.mediaData = null; + + /** + * PaymentBackground type. + * @member {proto.PaymentBackground.Type} type + * @memberof proto.PaymentBackground + * @instance + */ + PaymentBackground.prototype.type = 0; + + /** + * Creates a new PaymentBackground instance using the specified properties. + * @function create + * @memberof proto.PaymentBackground + * @static + * @param {proto.IPaymentBackground=} [properties] Properties to set + * @returns {proto.PaymentBackground} PaymentBackground instance + */ + PaymentBackground.create = function create(properties) { + return new PaymentBackground(properties); + }; + + /** + * Encodes the specified PaymentBackground message. Does not implicitly {@link proto.PaymentBackground.verify|verify} messages. + * @function encode + * @memberof proto.PaymentBackground + * @static + * @param {proto.IPaymentBackground} message PaymentBackground message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PaymentBackground.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.fileLength); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.width); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.height); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.mimetype); + if (message.placeholderArgb != null && Object.hasOwnProperty.call(message, "placeholderArgb")) + writer.uint32(/* id 6, wireType 5 =*/53).fixed32(message.placeholderArgb); + if (message.textArgb != null && Object.hasOwnProperty.call(message, "textArgb")) + writer.uint32(/* id 7, wireType 5 =*/61).fixed32(message.textArgb); + if (message.subtextArgb != null && Object.hasOwnProperty.call(message, "subtextArgb")) + writer.uint32(/* id 8, wireType 5 =*/69).fixed32(message.subtextArgb); + if (message.mediaData != null && Object.hasOwnProperty.call(message, "mediaData")) + $root.proto.PaymentBackground.MediaData.encode(message.mediaData, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.type); + return writer; + }; + + /** + * Encodes the specified PaymentBackground message, length delimited. Does not implicitly {@link proto.PaymentBackground.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PaymentBackground + * @static + * @param {proto.IPaymentBackground} message PaymentBackground message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PaymentBackground.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PaymentBackground message from the specified reader or buffer. + * @function decode + * @memberof proto.PaymentBackground + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PaymentBackground} PaymentBackground + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PaymentBackground.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PaymentBackground(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.fileLength = reader.uint64(); + break; + case 3: + message.width = reader.uint32(); + break; + case 4: + message.height = reader.uint32(); + break; + case 5: + message.mimetype = reader.string(); + break; + case 6: + message.placeholderArgb = reader.fixed32(); + break; + case 7: + message.textArgb = reader.fixed32(); + break; + case 8: + message.subtextArgb = reader.fixed32(); + break; + case 9: + message.mediaData = $root.proto.PaymentBackground.MediaData.decode(reader, reader.uint32()); + break; + case 10: + message.type = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PaymentBackground message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PaymentBackground + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PaymentBackground} PaymentBackground + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PaymentBackground.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PaymentBackground message. + * @function verify + * @memberof proto.PaymentBackground + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PaymentBackground.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.placeholderArgb != null && message.hasOwnProperty("placeholderArgb")) + if (!$util.isInteger(message.placeholderArgb)) + return "placeholderArgb: integer expected"; + if (message.textArgb != null && message.hasOwnProperty("textArgb")) + if (!$util.isInteger(message.textArgb)) + return "textArgb: integer expected"; + if (message.subtextArgb != null && message.hasOwnProperty("subtextArgb")) + if (!$util.isInteger(message.subtextArgb)) + return "subtextArgb: integer expected"; + if (message.mediaData != null && message.hasOwnProperty("mediaData")) { + var error = $root.proto.PaymentBackground.MediaData.verify(message.mediaData); + if (error) + return "mediaData." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a PaymentBackground message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PaymentBackground + * @static + * @param {Object.} object Plain object + * @returns {proto.PaymentBackground} PaymentBackground + */ + PaymentBackground.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PaymentBackground) + return object; + var message = new $root.proto.PaymentBackground(); + if (object.id != null) + message.id = String(object.id); + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.width != null) + message.width = object.width >>> 0; + if (object.height != null) + message.height = object.height >>> 0; + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.placeholderArgb != null) + message.placeholderArgb = object.placeholderArgb >>> 0; + if (object.textArgb != null) + message.textArgb = object.textArgb >>> 0; + if (object.subtextArgb != null) + message.subtextArgb = object.subtextArgb >>> 0; + if (object.mediaData != null) { + if (typeof object.mediaData !== "object") + throw TypeError(".proto.PaymentBackground.mediaData: object expected"); + message.mediaData = $root.proto.PaymentBackground.MediaData.fromObject(object.mediaData); + } + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "DEFAULT": + case 1: + message.type = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a PaymentBackground message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PaymentBackground + * @static + * @param {proto.PaymentBackground} message PaymentBackground + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PaymentBackground.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.width = 0; + object.height = 0; + object.mimetype = ""; + object.placeholderArgb = 0; + object.textArgb = 0; + object.subtextArgb = 0; + object.mediaData = null; + object.type = options.enums === String ? "UNKNOWN" : 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.placeholderArgb != null && message.hasOwnProperty("placeholderArgb")) + object.placeholderArgb = message.placeholderArgb; + if (message.textArgb != null && message.hasOwnProperty("textArgb")) + object.textArgb = message.textArgb; + if (message.subtextArgb != null && message.hasOwnProperty("subtextArgb")) + object.subtextArgb = message.subtextArgb; + if (message.mediaData != null && message.hasOwnProperty("mediaData")) + object.mediaData = $root.proto.PaymentBackground.MediaData.toObject(message.mediaData, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.proto.PaymentBackground.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this PaymentBackground to JSON. + * @function toJSON + * @memberof proto.PaymentBackground + * @instance + * @returns {Object.} JSON object + */ + PaymentBackground.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PaymentBackground.MediaData = (function() { + + /** + * Properties of a MediaData. + * @memberof proto.PaymentBackground + * @interface IMediaData + * @property {Uint8Array|null} [mediaKey] MediaData mediaKey + * @property {number|Long|null} [mediaKeyTimestamp] MediaData mediaKeyTimestamp + * @property {Uint8Array|null} [fileSha256] MediaData fileSha256 + * @property {Uint8Array|null} [fileEncSha256] MediaData fileEncSha256 + * @property {string|null} [directPath] MediaData directPath + */ + + /** + * Constructs a new MediaData. + * @memberof proto.PaymentBackground + * @classdesc Represents a MediaData. + * @implements IMediaData + * @constructor + * @param {proto.PaymentBackground.IMediaData=} [properties] Properties to set + */ + function MediaData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MediaData mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.PaymentBackground.MediaData + * @instance + */ + MediaData.prototype.mediaKey = $util.newBuffer([]); + + /** + * MediaData mediaKeyTimestamp. + * @member {number|Long} mediaKeyTimestamp + * @memberof proto.PaymentBackground.MediaData + * @instance + */ + MediaData.prototype.mediaKeyTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * MediaData fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.PaymentBackground.MediaData + * @instance + */ + MediaData.prototype.fileSha256 = $util.newBuffer([]); + + /** + * MediaData fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.PaymentBackground.MediaData + * @instance + */ + MediaData.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * MediaData directPath. + * @member {string} directPath + * @memberof proto.PaymentBackground.MediaData + * @instance + */ + MediaData.prototype.directPath = ""; + + /** + * Creates a new MediaData instance using the specified properties. + * @function create + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {proto.PaymentBackground.IMediaData=} [properties] Properties to set + * @returns {proto.PaymentBackground.MediaData} MediaData instance + */ + MediaData.create = function create(properties) { + return new MediaData(properties); + }; + + /** + * Encodes the specified MediaData message. Does not implicitly {@link proto.PaymentBackground.MediaData.verify|verify} messages. + * @function encode + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {proto.PaymentBackground.IMediaData} message MediaData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.mediaKey); + if (message.mediaKeyTimestamp != null && Object.hasOwnProperty.call(message, "mediaKeyTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.mediaKeyTimestamp); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.fileSha256); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.fileEncSha256); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.directPath); + return writer; + }; + + /** + * Encodes the specified MediaData message, length delimited. Does not implicitly {@link proto.PaymentBackground.MediaData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {proto.PaymentBackground.IMediaData} message MediaData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MediaData message from the specified reader or buffer. + * @function decode + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PaymentBackground.MediaData} MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PaymentBackground.MediaData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mediaKey = reader.bytes(); + break; + case 2: + message.mediaKeyTimestamp = reader.int64(); + break; + case 3: + message.fileSha256 = reader.bytes(); + break; + case 4: + message.fileEncSha256 = reader.bytes(); + break; + case 5: + message.directPath = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MediaData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PaymentBackground.MediaData} MediaData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MediaData message. + * @function verify + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MediaData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (!$util.isInteger(message.mediaKeyTimestamp) && !(message.mediaKeyTimestamp && $util.isInteger(message.mediaKeyTimestamp.low) && $util.isInteger(message.mediaKeyTimestamp.high))) + return "mediaKeyTimestamp: integer|Long expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + return null; + }; + + /** + * Creates a MediaData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {Object.} object Plain object + * @returns {proto.PaymentBackground.MediaData} MediaData + */ + MediaData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PaymentBackground.MediaData) + return object; + var message = new $root.proto.PaymentBackground.MediaData(); + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.mediaKeyTimestamp != null) + if ($util.Long) + (message.mediaKeyTimestamp = $util.Long.fromValue(object.mediaKeyTimestamp)).unsigned = false; + else if (typeof object.mediaKeyTimestamp === "string") + message.mediaKeyTimestamp = parseInt(object.mediaKeyTimestamp, 10); + else if (typeof object.mediaKeyTimestamp === "number") + message.mediaKeyTimestamp = object.mediaKeyTimestamp; + else if (typeof object.mediaKeyTimestamp === "object") + message.mediaKeyTimestamp = new $util.LongBits(object.mediaKeyTimestamp.low >>> 0, object.mediaKeyTimestamp.high >>> 0).toNumber(); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.directPath != null) + message.directPath = String(object.directPath); + return message; + }; + + /** + * Creates a plain object from a MediaData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PaymentBackground.MediaData + * @static + * @param {proto.PaymentBackground.MediaData} message MediaData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MediaData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.mediaKeyTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.mediaKeyTimestamp = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + object.directPath = ""; + } + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.mediaKeyTimestamp != null && message.hasOwnProperty("mediaKeyTimestamp")) + if (typeof message.mediaKeyTimestamp === "number") + object.mediaKeyTimestamp = options.longs === String ? String(message.mediaKeyTimestamp) : message.mediaKeyTimestamp; + else + object.mediaKeyTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.mediaKeyTimestamp) : options.longs === Number ? new $util.LongBits(message.mediaKeyTimestamp.low >>> 0, message.mediaKeyTimestamp.high >>> 0).toNumber() : message.mediaKeyTimestamp; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + return object; + }; + + /** + * Converts this MediaData to JSON. + * @function toJSON + * @memberof proto.PaymentBackground.MediaData + * @instance + * @returns {Object.} JSON object + */ + MediaData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MediaData; + })(); + + /** + * Type enum. + * @name proto.PaymentBackground.Type + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} DEFAULT=1 DEFAULT value + */ + PaymentBackground.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "DEFAULT"] = 1; + return values; + })(); + + return PaymentBackground; + })(); + + proto.PaymentInfo = (function() { + + /** + * Properties of a PaymentInfo. + * @memberof proto + * @interface IPaymentInfo + * @property {proto.PaymentInfo.Currency|null} [currencyDeprecated] PaymentInfo currencyDeprecated + * @property {number|Long|null} [amount1000] PaymentInfo amount1000 + * @property {string|null} [receiverJid] PaymentInfo receiverJid + * @property {proto.PaymentInfo.Status|null} [status] PaymentInfo status + * @property {number|Long|null} [transactionTimestamp] PaymentInfo transactionTimestamp + * @property {proto.IMessageKey|null} [requestMessageKey] PaymentInfo requestMessageKey + * @property {number|Long|null} [expiryTimestamp] PaymentInfo expiryTimestamp + * @property {boolean|null} [futureproofed] PaymentInfo futureproofed + * @property {string|null} [currency] PaymentInfo currency + * @property {proto.PaymentInfo.TxnStatus|null} [txnStatus] PaymentInfo txnStatus + * @property {boolean|null} [useNoviFiatFormat] PaymentInfo useNoviFiatFormat + * @property {proto.IMoney|null} [primaryAmount] PaymentInfo primaryAmount + * @property {proto.IMoney|null} [exchangeAmount] PaymentInfo exchangeAmount + */ + + /** + * Constructs a new PaymentInfo. + * @memberof proto + * @classdesc Represents a PaymentInfo. + * @implements IPaymentInfo + * @constructor + * @param {proto.IPaymentInfo=} [properties] Properties to set + */ + function PaymentInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PaymentInfo currencyDeprecated. + * @member {proto.PaymentInfo.Currency} currencyDeprecated + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.currencyDeprecated = 0; + + /** + * PaymentInfo amount1000. + * @member {number|Long} amount1000 + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.amount1000 = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PaymentInfo receiverJid. + * @member {string} receiverJid + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.receiverJid = ""; + + /** + * PaymentInfo status. + * @member {proto.PaymentInfo.Status} status + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.status = 0; + + /** + * PaymentInfo transactionTimestamp. + * @member {number|Long} transactionTimestamp + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.transactionTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PaymentInfo requestMessageKey. + * @member {proto.IMessageKey|null|undefined} requestMessageKey + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.requestMessageKey = null; + + /** + * PaymentInfo expiryTimestamp. + * @member {number|Long} expiryTimestamp + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.expiryTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * PaymentInfo futureproofed. + * @member {boolean} futureproofed + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.futureproofed = false; + + /** + * PaymentInfo currency. + * @member {string} currency + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.currency = ""; + + /** + * PaymentInfo txnStatus. + * @member {proto.PaymentInfo.TxnStatus} txnStatus + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.txnStatus = 0; + + /** + * PaymentInfo useNoviFiatFormat. + * @member {boolean} useNoviFiatFormat + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.useNoviFiatFormat = false; + + /** + * PaymentInfo primaryAmount. + * @member {proto.IMoney|null|undefined} primaryAmount + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.primaryAmount = null; + + /** + * PaymentInfo exchangeAmount. + * @member {proto.IMoney|null|undefined} exchangeAmount + * @memberof proto.PaymentInfo + * @instance + */ + PaymentInfo.prototype.exchangeAmount = null; + + /** + * Creates a new PaymentInfo instance using the specified properties. + * @function create + * @memberof proto.PaymentInfo + * @static + * @param {proto.IPaymentInfo=} [properties] Properties to set + * @returns {proto.PaymentInfo} PaymentInfo instance + */ + PaymentInfo.create = function create(properties) { + return new PaymentInfo(properties); + }; + + /** + * Encodes the specified PaymentInfo message. Does not implicitly {@link proto.PaymentInfo.verify|verify} messages. + * @function encode + * @memberof proto.PaymentInfo + * @static + * @param {proto.IPaymentInfo} message PaymentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PaymentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyDeprecated != null && Object.hasOwnProperty.call(message, "currencyDeprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.currencyDeprecated); + if (message.amount1000 != null && Object.hasOwnProperty.call(message, "amount1000")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.amount1000); + if (message.receiverJid != null && Object.hasOwnProperty.call(message, "receiverJid")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.receiverJid); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.status); + if (message.transactionTimestamp != null && Object.hasOwnProperty.call(message, "transactionTimestamp")) + writer.uint32(/* id 5, wireType 0 =*/40).uint64(message.transactionTimestamp); + if (message.requestMessageKey != null && Object.hasOwnProperty.call(message, "requestMessageKey")) + $root.proto.MessageKey.encode(message.requestMessageKey, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.expiryTimestamp != null && Object.hasOwnProperty.call(message, "expiryTimestamp")) + writer.uint32(/* id 7, wireType 0 =*/56).uint64(message.expiryTimestamp); + if (message.futureproofed != null && Object.hasOwnProperty.call(message, "futureproofed")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.futureproofed); + if (message.currency != null && Object.hasOwnProperty.call(message, "currency")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.currency); + if (message.txnStatus != null && Object.hasOwnProperty.call(message, "txnStatus")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.txnStatus); + if (message.useNoviFiatFormat != null && Object.hasOwnProperty.call(message, "useNoviFiatFormat")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.useNoviFiatFormat); + if (message.primaryAmount != null && Object.hasOwnProperty.call(message, "primaryAmount")) + $root.proto.Money.encode(message.primaryAmount, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.exchangeAmount != null && Object.hasOwnProperty.call(message, "exchangeAmount")) + $root.proto.Money.encode(message.exchangeAmount, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PaymentInfo message, length delimited. Does not implicitly {@link proto.PaymentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PaymentInfo + * @static + * @param {proto.IPaymentInfo} message PaymentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PaymentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PaymentInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.PaymentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PaymentInfo} PaymentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PaymentInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PaymentInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyDeprecated = reader.int32(); + break; + case 2: + message.amount1000 = reader.uint64(); + break; + case 3: + message.receiverJid = reader.string(); + break; + case 4: + message.status = reader.int32(); + break; + case 5: + message.transactionTimestamp = reader.uint64(); + break; + case 6: + message.requestMessageKey = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 7: + message.expiryTimestamp = reader.uint64(); + break; + case 8: + message.futureproofed = reader.bool(); + break; + case 9: + message.currency = reader.string(); + break; + case 10: + message.txnStatus = reader.int32(); + break; + case 11: + message.useNoviFiatFormat = reader.bool(); + break; + case 12: + message.primaryAmount = $root.proto.Money.decode(reader, reader.uint32()); + break; + case 13: + message.exchangeAmount = $root.proto.Money.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PaymentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PaymentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PaymentInfo} PaymentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PaymentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PaymentInfo message. + * @function verify + * @memberof proto.PaymentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PaymentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyDeprecated != null && message.hasOwnProperty("currencyDeprecated")) + switch (message.currencyDeprecated) { + default: + return "currencyDeprecated: enum value expected"; + case 0: + case 1: + break; + } + if (message.amount1000 != null && message.hasOwnProperty("amount1000")) + if (!$util.isInteger(message.amount1000) && !(message.amount1000 && $util.isInteger(message.amount1000.low) && $util.isInteger(message.amount1000.high))) + return "amount1000: integer|Long expected"; + if (message.receiverJid != null && message.hasOwnProperty("receiverJid")) + if (!$util.isString(message.receiverJid)) + return "receiverJid: string expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + break; + } + if (message.transactionTimestamp != null && message.hasOwnProperty("transactionTimestamp")) + if (!$util.isInteger(message.transactionTimestamp) && !(message.transactionTimestamp && $util.isInteger(message.transactionTimestamp.low) && $util.isInteger(message.transactionTimestamp.high))) + return "transactionTimestamp: integer|Long expected"; + if (message.requestMessageKey != null && message.hasOwnProperty("requestMessageKey")) { + var error = $root.proto.MessageKey.verify(message.requestMessageKey); + if (error) + return "requestMessageKey." + error; + } + if (message.expiryTimestamp != null && message.hasOwnProperty("expiryTimestamp")) + if (!$util.isInteger(message.expiryTimestamp) && !(message.expiryTimestamp && $util.isInteger(message.expiryTimestamp.low) && $util.isInteger(message.expiryTimestamp.high))) + return "expiryTimestamp: integer|Long expected"; + if (message.futureproofed != null && message.hasOwnProperty("futureproofed")) + if (typeof message.futureproofed !== "boolean") + return "futureproofed: boolean expected"; + if (message.currency != null && message.hasOwnProperty("currency")) + if (!$util.isString(message.currency)) + return "currency: string expected"; + if (message.txnStatus != null && message.hasOwnProperty("txnStatus")) + switch (message.txnStatus) { + default: + return "txnStatus: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + break; + } + if (message.useNoviFiatFormat != null && message.hasOwnProperty("useNoviFiatFormat")) + if (typeof message.useNoviFiatFormat !== "boolean") + return "useNoviFiatFormat: boolean expected"; + if (message.primaryAmount != null && message.hasOwnProperty("primaryAmount")) { + var error = $root.proto.Money.verify(message.primaryAmount); + if (error) + return "primaryAmount." + error; + } + if (message.exchangeAmount != null && message.hasOwnProperty("exchangeAmount")) { + var error = $root.proto.Money.verify(message.exchangeAmount); + if (error) + return "exchangeAmount." + error; + } + return null; + }; + + /** + * Creates a PaymentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PaymentInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.PaymentInfo} PaymentInfo + */ + PaymentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PaymentInfo) + return object; + var message = new $root.proto.PaymentInfo(); + switch (object.currencyDeprecated) { + case "UNKNOWN_CURRENCY": + case 0: + message.currencyDeprecated = 0; + break; + case "INR": + case 1: + message.currencyDeprecated = 1; + break; + } + if (object.amount1000 != null) + if ($util.Long) + (message.amount1000 = $util.Long.fromValue(object.amount1000)).unsigned = true; + else if (typeof object.amount1000 === "string") + message.amount1000 = parseInt(object.amount1000, 10); + else if (typeof object.amount1000 === "number") + message.amount1000 = object.amount1000; + else if (typeof object.amount1000 === "object") + message.amount1000 = new $util.LongBits(object.amount1000.low >>> 0, object.amount1000.high >>> 0).toNumber(true); + if (object.receiverJid != null) + message.receiverJid = String(object.receiverJid); + switch (object.status) { + case "UNKNOWN_STATUS": + case 0: + message.status = 0; + break; + case "PROCESSING": + case 1: + message.status = 1; + break; + case "SENT": + case 2: + message.status = 2; + break; + case "NEED_TO_ACCEPT": + case 3: + message.status = 3; + break; + case "COMPLETE": + case 4: + message.status = 4; + break; + case "COULD_NOT_COMPLETE": + case 5: + message.status = 5; + break; + case "REFUNDED": + case 6: + message.status = 6; + break; + case "EXPIRED": + case 7: + message.status = 7; + break; + case "REJECTED": + case 8: + message.status = 8; + break; + case "CANCELLED": + case 9: + message.status = 9; + break; + case "WAITING_FOR_PAYER": + case 10: + message.status = 10; + break; + case "WAITING": + case 11: + message.status = 11; + break; + } + if (object.transactionTimestamp != null) + if ($util.Long) + (message.transactionTimestamp = $util.Long.fromValue(object.transactionTimestamp)).unsigned = true; + else if (typeof object.transactionTimestamp === "string") + message.transactionTimestamp = parseInt(object.transactionTimestamp, 10); + else if (typeof object.transactionTimestamp === "number") + message.transactionTimestamp = object.transactionTimestamp; + else if (typeof object.transactionTimestamp === "object") + message.transactionTimestamp = new $util.LongBits(object.transactionTimestamp.low >>> 0, object.transactionTimestamp.high >>> 0).toNumber(true); + if (object.requestMessageKey != null) { + if (typeof object.requestMessageKey !== "object") + throw TypeError(".proto.PaymentInfo.requestMessageKey: object expected"); + message.requestMessageKey = $root.proto.MessageKey.fromObject(object.requestMessageKey); + } + if (object.expiryTimestamp != null) + if ($util.Long) + (message.expiryTimestamp = $util.Long.fromValue(object.expiryTimestamp)).unsigned = true; + else if (typeof object.expiryTimestamp === "string") + message.expiryTimestamp = parseInt(object.expiryTimestamp, 10); + else if (typeof object.expiryTimestamp === "number") + message.expiryTimestamp = object.expiryTimestamp; + else if (typeof object.expiryTimestamp === "object") + message.expiryTimestamp = new $util.LongBits(object.expiryTimestamp.low >>> 0, object.expiryTimestamp.high >>> 0).toNumber(true); + if (object.futureproofed != null) + message.futureproofed = Boolean(object.futureproofed); + if (object.currency != null) + message.currency = String(object.currency); + switch (object.txnStatus) { + case "UNKNOWN": + case 0: + message.txnStatus = 0; + break; + case "PENDING_SETUP": + case 1: + message.txnStatus = 1; + break; + case "PENDING_RECEIVER_SETUP": + case 2: + message.txnStatus = 2; + break; + case "INIT": + case 3: + message.txnStatus = 3; + break; + case "SUCCESS": + case 4: + message.txnStatus = 4; + break; + case "COMPLETED": + case 5: + message.txnStatus = 5; + break; + case "FAILED": + case 6: + message.txnStatus = 6; + break; + case "FAILED_RISK": + case 7: + message.txnStatus = 7; + break; + case "FAILED_PROCESSING": + case 8: + message.txnStatus = 8; + break; + case "FAILED_RECEIVER_PROCESSING": + case 9: + message.txnStatus = 9; + break; + case "FAILED_DA": + case 10: + message.txnStatus = 10; + break; + case "FAILED_DA_FINAL": + case 11: + message.txnStatus = 11; + break; + case "REFUNDED_TXN": + case 12: + message.txnStatus = 12; + break; + case "REFUND_FAILED": + case 13: + message.txnStatus = 13; + break; + case "REFUND_FAILED_PROCESSING": + case 14: + message.txnStatus = 14; + break; + case "REFUND_FAILED_DA": + case 15: + message.txnStatus = 15; + break; + case "EXPIRED_TXN": + case 16: + message.txnStatus = 16; + break; + case "AUTH_CANCELED": + case 17: + message.txnStatus = 17; + break; + case "AUTH_CANCEL_FAILED_PROCESSING": + case 18: + message.txnStatus = 18; + break; + case "AUTH_CANCEL_FAILED": + case 19: + message.txnStatus = 19; + break; + case "COLLECT_INIT": + case 20: + message.txnStatus = 20; + break; + case "COLLECT_SUCCESS": + case 21: + message.txnStatus = 21; + break; + case "COLLECT_FAILED": + case 22: + message.txnStatus = 22; + break; + case "COLLECT_FAILED_RISK": + case 23: + message.txnStatus = 23; + break; + case "COLLECT_REJECTED": + case 24: + message.txnStatus = 24; + break; + case "COLLECT_EXPIRED": + case 25: + message.txnStatus = 25; + break; + case "COLLECT_CANCELED": + case 26: + message.txnStatus = 26; + break; + case "COLLECT_CANCELLING": + case 27: + message.txnStatus = 27; + break; + case "IN_REVIEW": + case 28: + message.txnStatus = 28; + break; + case "REVERSAL_SUCCESS": + case 29: + message.txnStatus = 29; + break; + case "REVERSAL_PENDING": + case 30: + message.txnStatus = 30; + break; + case "REFUND_PENDING": + case 31: + message.txnStatus = 31; + break; + } + if (object.useNoviFiatFormat != null) + message.useNoviFiatFormat = Boolean(object.useNoviFiatFormat); + if (object.primaryAmount != null) { + if (typeof object.primaryAmount !== "object") + throw TypeError(".proto.PaymentInfo.primaryAmount: object expected"); + message.primaryAmount = $root.proto.Money.fromObject(object.primaryAmount); + } + if (object.exchangeAmount != null) { + if (typeof object.exchangeAmount !== "object") + throw TypeError(".proto.PaymentInfo.exchangeAmount: object expected"); + message.exchangeAmount = $root.proto.Money.fromObject(object.exchangeAmount); + } + return message; + }; + + /** + * Creates a plain object from a PaymentInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PaymentInfo + * @static + * @param {proto.PaymentInfo} message PaymentInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PaymentInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyDeprecated = options.enums === String ? "UNKNOWN_CURRENCY" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.amount1000 = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.amount1000 = options.longs === String ? "0" : 0; + object.receiverJid = ""; + object.status = options.enums === String ? "UNKNOWN_STATUS" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.transactionTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.transactionTimestamp = options.longs === String ? "0" : 0; + object.requestMessageKey = null; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.expiryTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expiryTimestamp = options.longs === String ? "0" : 0; + object.futureproofed = false; + object.currency = ""; + object.txnStatus = options.enums === String ? "UNKNOWN" : 0; + object.useNoviFiatFormat = false; + object.primaryAmount = null; + object.exchangeAmount = null; + } + if (message.currencyDeprecated != null && message.hasOwnProperty("currencyDeprecated")) + object.currencyDeprecated = options.enums === String ? $root.proto.PaymentInfo.Currency[message.currencyDeprecated] : message.currencyDeprecated; + if (message.amount1000 != null && message.hasOwnProperty("amount1000")) + if (typeof message.amount1000 === "number") + object.amount1000 = options.longs === String ? String(message.amount1000) : message.amount1000; + else + object.amount1000 = options.longs === String ? $util.Long.prototype.toString.call(message.amount1000) : options.longs === Number ? new $util.LongBits(message.amount1000.low >>> 0, message.amount1000.high >>> 0).toNumber(true) : message.amount1000; + if (message.receiverJid != null && message.hasOwnProperty("receiverJid")) + object.receiverJid = message.receiverJid; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.proto.PaymentInfo.Status[message.status] : message.status; + if (message.transactionTimestamp != null && message.hasOwnProperty("transactionTimestamp")) + if (typeof message.transactionTimestamp === "number") + object.transactionTimestamp = options.longs === String ? String(message.transactionTimestamp) : message.transactionTimestamp; + else + object.transactionTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.transactionTimestamp) : options.longs === Number ? new $util.LongBits(message.transactionTimestamp.low >>> 0, message.transactionTimestamp.high >>> 0).toNumber(true) : message.transactionTimestamp; + if (message.requestMessageKey != null && message.hasOwnProperty("requestMessageKey")) + object.requestMessageKey = $root.proto.MessageKey.toObject(message.requestMessageKey, options); + if (message.expiryTimestamp != null && message.hasOwnProperty("expiryTimestamp")) + if (typeof message.expiryTimestamp === "number") + object.expiryTimestamp = options.longs === String ? String(message.expiryTimestamp) : message.expiryTimestamp; + else + object.expiryTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.expiryTimestamp) : options.longs === Number ? new $util.LongBits(message.expiryTimestamp.low >>> 0, message.expiryTimestamp.high >>> 0).toNumber(true) : message.expiryTimestamp; + if (message.futureproofed != null && message.hasOwnProperty("futureproofed")) + object.futureproofed = message.futureproofed; + if (message.currency != null && message.hasOwnProperty("currency")) + object.currency = message.currency; + if (message.txnStatus != null && message.hasOwnProperty("txnStatus")) + object.txnStatus = options.enums === String ? $root.proto.PaymentInfo.TxnStatus[message.txnStatus] : message.txnStatus; + if (message.useNoviFiatFormat != null && message.hasOwnProperty("useNoviFiatFormat")) + object.useNoviFiatFormat = message.useNoviFiatFormat; + if (message.primaryAmount != null && message.hasOwnProperty("primaryAmount")) + object.primaryAmount = $root.proto.Money.toObject(message.primaryAmount, options); + if (message.exchangeAmount != null && message.hasOwnProperty("exchangeAmount")) + object.exchangeAmount = $root.proto.Money.toObject(message.exchangeAmount, options); + return object; + }; + + /** + * Converts this PaymentInfo to JSON. + * @function toJSON + * @memberof proto.PaymentInfo + * @instance + * @returns {Object.} JSON object + */ + PaymentInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Currency enum. + * @name proto.PaymentInfo.Currency + * @enum {number} + * @property {number} UNKNOWN_CURRENCY=0 UNKNOWN_CURRENCY value + * @property {number} INR=1 INR value + */ + PaymentInfo.Currency = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_CURRENCY"] = 0; + values[valuesById[1] = "INR"] = 1; + return values; + })(); + + /** + * Status enum. + * @name proto.PaymentInfo.Status + * @enum {number} + * @property {number} UNKNOWN_STATUS=0 UNKNOWN_STATUS value + * @property {number} PROCESSING=1 PROCESSING value + * @property {number} SENT=2 SENT value + * @property {number} NEED_TO_ACCEPT=3 NEED_TO_ACCEPT value + * @property {number} COMPLETE=4 COMPLETE value + * @property {number} COULD_NOT_COMPLETE=5 COULD_NOT_COMPLETE value + * @property {number} REFUNDED=6 REFUNDED value + * @property {number} EXPIRED=7 EXPIRED value + * @property {number} REJECTED=8 REJECTED value + * @property {number} CANCELLED=9 CANCELLED value + * @property {number} WAITING_FOR_PAYER=10 WAITING_FOR_PAYER value + * @property {number} WAITING=11 WAITING value + */ + PaymentInfo.Status = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_STATUS"] = 0; + values[valuesById[1] = "PROCESSING"] = 1; + values[valuesById[2] = "SENT"] = 2; + values[valuesById[3] = "NEED_TO_ACCEPT"] = 3; + values[valuesById[4] = "COMPLETE"] = 4; + values[valuesById[5] = "COULD_NOT_COMPLETE"] = 5; + values[valuesById[6] = "REFUNDED"] = 6; + values[valuesById[7] = "EXPIRED"] = 7; + values[valuesById[8] = "REJECTED"] = 8; + values[valuesById[9] = "CANCELLED"] = 9; + values[valuesById[10] = "WAITING_FOR_PAYER"] = 10; + values[valuesById[11] = "WAITING"] = 11; + return values; + })(); + + /** + * TxnStatus enum. + * @name proto.PaymentInfo.TxnStatus + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} PENDING_SETUP=1 PENDING_SETUP value + * @property {number} PENDING_RECEIVER_SETUP=2 PENDING_RECEIVER_SETUP value + * @property {number} INIT=3 INIT value + * @property {number} SUCCESS=4 SUCCESS value + * @property {number} COMPLETED=5 COMPLETED value + * @property {number} FAILED=6 FAILED value + * @property {number} FAILED_RISK=7 FAILED_RISK value + * @property {number} FAILED_PROCESSING=8 FAILED_PROCESSING value + * @property {number} FAILED_RECEIVER_PROCESSING=9 FAILED_RECEIVER_PROCESSING value + * @property {number} FAILED_DA=10 FAILED_DA value + * @property {number} FAILED_DA_FINAL=11 FAILED_DA_FINAL value + * @property {number} REFUNDED_TXN=12 REFUNDED_TXN value + * @property {number} REFUND_FAILED=13 REFUND_FAILED value + * @property {number} REFUND_FAILED_PROCESSING=14 REFUND_FAILED_PROCESSING value + * @property {number} REFUND_FAILED_DA=15 REFUND_FAILED_DA value + * @property {number} EXPIRED_TXN=16 EXPIRED_TXN value + * @property {number} AUTH_CANCELED=17 AUTH_CANCELED value + * @property {number} AUTH_CANCEL_FAILED_PROCESSING=18 AUTH_CANCEL_FAILED_PROCESSING value + * @property {number} AUTH_CANCEL_FAILED=19 AUTH_CANCEL_FAILED value + * @property {number} COLLECT_INIT=20 COLLECT_INIT value + * @property {number} COLLECT_SUCCESS=21 COLLECT_SUCCESS value + * @property {number} COLLECT_FAILED=22 COLLECT_FAILED value + * @property {number} COLLECT_FAILED_RISK=23 COLLECT_FAILED_RISK value + * @property {number} COLLECT_REJECTED=24 COLLECT_REJECTED value + * @property {number} COLLECT_EXPIRED=25 COLLECT_EXPIRED value + * @property {number} COLLECT_CANCELED=26 COLLECT_CANCELED value + * @property {number} COLLECT_CANCELLING=27 COLLECT_CANCELLING value + * @property {number} IN_REVIEW=28 IN_REVIEW value + * @property {number} REVERSAL_SUCCESS=29 REVERSAL_SUCCESS value + * @property {number} REVERSAL_PENDING=30 REVERSAL_PENDING value + * @property {number} REFUND_PENDING=31 REFUND_PENDING value + */ + PaymentInfo.TxnStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "PENDING_SETUP"] = 1; + values[valuesById[2] = "PENDING_RECEIVER_SETUP"] = 2; + values[valuesById[3] = "INIT"] = 3; + values[valuesById[4] = "SUCCESS"] = 4; + values[valuesById[5] = "COMPLETED"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "FAILED_RISK"] = 7; + values[valuesById[8] = "FAILED_PROCESSING"] = 8; + values[valuesById[9] = "FAILED_RECEIVER_PROCESSING"] = 9; + values[valuesById[10] = "FAILED_DA"] = 10; + values[valuesById[11] = "FAILED_DA_FINAL"] = 11; + values[valuesById[12] = "REFUNDED_TXN"] = 12; + values[valuesById[13] = "REFUND_FAILED"] = 13; + values[valuesById[14] = "REFUND_FAILED_PROCESSING"] = 14; + values[valuesById[15] = "REFUND_FAILED_DA"] = 15; + values[valuesById[16] = "EXPIRED_TXN"] = 16; + values[valuesById[17] = "AUTH_CANCELED"] = 17; + values[valuesById[18] = "AUTH_CANCEL_FAILED_PROCESSING"] = 18; + values[valuesById[19] = "AUTH_CANCEL_FAILED"] = 19; + values[valuesById[20] = "COLLECT_INIT"] = 20; + values[valuesById[21] = "COLLECT_SUCCESS"] = 21; + values[valuesById[22] = "COLLECT_FAILED"] = 22; + values[valuesById[23] = "COLLECT_FAILED_RISK"] = 23; + values[valuesById[24] = "COLLECT_REJECTED"] = 24; + values[valuesById[25] = "COLLECT_EXPIRED"] = 25; + values[valuesById[26] = "COLLECT_CANCELED"] = 26; + values[valuesById[27] = "COLLECT_CANCELLING"] = 27; + values[valuesById[28] = "IN_REVIEW"] = 28; + values[valuesById[29] = "REVERSAL_SUCCESS"] = 29; + values[valuesById[30] = "REVERSAL_PENDING"] = 30; + values[valuesById[31] = "REFUND_PENDING"] = 31; + return values; + })(); + + return PaymentInfo; + })(); + + proto.PhotoChange = (function() { + + /** + * Properties of a PhotoChange. + * @memberof proto + * @interface IPhotoChange + * @property {Uint8Array|null} [oldPhoto] PhotoChange oldPhoto + * @property {Uint8Array|null} [newPhoto] PhotoChange newPhoto + * @property {number|null} [newPhotoId] PhotoChange newPhotoId + */ + + /** + * Constructs a new PhotoChange. + * @memberof proto + * @classdesc Represents a PhotoChange. + * @implements IPhotoChange + * @constructor + * @param {proto.IPhotoChange=} [properties] Properties to set + */ + function PhotoChange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PhotoChange oldPhoto. + * @member {Uint8Array} oldPhoto + * @memberof proto.PhotoChange + * @instance + */ + PhotoChange.prototype.oldPhoto = $util.newBuffer([]); + + /** + * PhotoChange newPhoto. + * @member {Uint8Array} newPhoto + * @memberof proto.PhotoChange + * @instance + */ + PhotoChange.prototype.newPhoto = $util.newBuffer([]); + + /** + * PhotoChange newPhotoId. + * @member {number} newPhotoId + * @memberof proto.PhotoChange + * @instance + */ + PhotoChange.prototype.newPhotoId = 0; + + /** + * Creates a new PhotoChange instance using the specified properties. + * @function create + * @memberof proto.PhotoChange + * @static + * @param {proto.IPhotoChange=} [properties] Properties to set + * @returns {proto.PhotoChange} PhotoChange instance + */ + PhotoChange.create = function create(properties) { + return new PhotoChange(properties); + }; + + /** + * Encodes the specified PhotoChange message. Does not implicitly {@link proto.PhotoChange.verify|verify} messages. + * @function encode + * @memberof proto.PhotoChange + * @static + * @param {proto.IPhotoChange} message PhotoChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhotoChange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.oldPhoto != null && Object.hasOwnProperty.call(message, "oldPhoto")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.oldPhoto); + if (message.newPhoto != null && Object.hasOwnProperty.call(message, "newPhoto")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.newPhoto); + if (message.newPhotoId != null && Object.hasOwnProperty.call(message, "newPhotoId")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.newPhotoId); + return writer; + }; + + /** + * Encodes the specified PhotoChange message, length delimited. Does not implicitly {@link proto.PhotoChange.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PhotoChange + * @static + * @param {proto.IPhotoChange} message PhotoChange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhotoChange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PhotoChange message from the specified reader or buffer. + * @function decode + * @memberof proto.PhotoChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PhotoChange} PhotoChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhotoChange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PhotoChange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.oldPhoto = reader.bytes(); + break; + case 2: + message.newPhoto = reader.bytes(); + break; + case 3: + message.newPhotoId = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PhotoChange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PhotoChange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PhotoChange} PhotoChange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhotoChange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PhotoChange message. + * @function verify + * @memberof proto.PhotoChange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PhotoChange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.oldPhoto != null && message.hasOwnProperty("oldPhoto")) + if (!(message.oldPhoto && typeof message.oldPhoto.length === "number" || $util.isString(message.oldPhoto))) + return "oldPhoto: buffer expected"; + if (message.newPhoto != null && message.hasOwnProperty("newPhoto")) + if (!(message.newPhoto && typeof message.newPhoto.length === "number" || $util.isString(message.newPhoto))) + return "newPhoto: buffer expected"; + if (message.newPhotoId != null && message.hasOwnProperty("newPhotoId")) + if (!$util.isInteger(message.newPhotoId)) + return "newPhotoId: integer expected"; + return null; + }; + + /** + * Creates a PhotoChange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PhotoChange + * @static + * @param {Object.} object Plain object + * @returns {proto.PhotoChange} PhotoChange + */ + PhotoChange.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PhotoChange) + return object; + var message = new $root.proto.PhotoChange(); + if (object.oldPhoto != null) + if (typeof object.oldPhoto === "string") + $util.base64.decode(object.oldPhoto, message.oldPhoto = $util.newBuffer($util.base64.length(object.oldPhoto)), 0); + else if (object.oldPhoto.length) + message.oldPhoto = object.oldPhoto; + if (object.newPhoto != null) + if (typeof object.newPhoto === "string") + $util.base64.decode(object.newPhoto, message.newPhoto = $util.newBuffer($util.base64.length(object.newPhoto)), 0); + else if (object.newPhoto.length) + message.newPhoto = object.newPhoto; + if (object.newPhotoId != null) + message.newPhotoId = object.newPhotoId >>> 0; + return message; + }; + + /** + * Creates a plain object from a PhotoChange message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PhotoChange + * @static + * @param {proto.PhotoChange} message PhotoChange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PhotoChange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.oldPhoto = ""; + else { + object.oldPhoto = []; + if (options.bytes !== Array) + object.oldPhoto = $util.newBuffer(object.oldPhoto); + } + if (options.bytes === String) + object.newPhoto = ""; + else { + object.newPhoto = []; + if (options.bytes !== Array) + object.newPhoto = $util.newBuffer(object.newPhoto); + } + object.newPhotoId = 0; + } + if (message.oldPhoto != null && message.hasOwnProperty("oldPhoto")) + object.oldPhoto = options.bytes === String ? $util.base64.encode(message.oldPhoto, 0, message.oldPhoto.length) : options.bytes === Array ? Array.prototype.slice.call(message.oldPhoto) : message.oldPhoto; + if (message.newPhoto != null && message.hasOwnProperty("newPhoto")) + object.newPhoto = options.bytes === String ? $util.base64.encode(message.newPhoto, 0, message.newPhoto.length) : options.bytes === Array ? Array.prototype.slice.call(message.newPhoto) : message.newPhoto; + if (message.newPhotoId != null && message.hasOwnProperty("newPhotoId")) + object.newPhotoId = message.newPhotoId; + return object; + }; + + /** + * Converts this PhotoChange to JSON. + * @function toJSON + * @memberof proto.PhotoChange + * @instance + * @returns {Object.} JSON object + */ + PhotoChange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PhotoChange; + })(); + + proto.Point = (function() { + + /** + * Properties of a Point. + * @memberof proto + * @interface IPoint + * @property {number|null} [xDeprecated] Point xDeprecated + * @property {number|null} [yDeprecated] Point yDeprecated + * @property {number|null} [x] Point x + * @property {number|null} [y] Point y + */ + + /** + * Constructs a new Point. + * @memberof proto + * @classdesc Represents a Point. + * @implements IPoint + * @constructor + * @param {proto.IPoint=} [properties] Properties to set + */ + function Point(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Point xDeprecated. + * @member {number} xDeprecated + * @memberof proto.Point + * @instance + */ + Point.prototype.xDeprecated = 0; + + /** + * Point yDeprecated. + * @member {number} yDeprecated + * @memberof proto.Point + * @instance + */ + Point.prototype.yDeprecated = 0; + + /** + * Point x. + * @member {number} x + * @memberof proto.Point + * @instance + */ + Point.prototype.x = 0; + + /** + * Point y. + * @member {number} y + * @memberof proto.Point + * @instance + */ + Point.prototype.y = 0; + + /** + * Creates a new Point instance using the specified properties. + * @function create + * @memberof proto.Point + * @static + * @param {proto.IPoint=} [properties] Properties to set + * @returns {proto.Point} Point instance + */ + Point.create = function create(properties) { + return new Point(properties); + }; + + /** + * Encodes the specified Point message. Does not implicitly {@link proto.Point.verify|verify} messages. + * @function encode + * @memberof proto.Point + * @static + * @param {proto.IPoint} message Point message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Point.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.xDeprecated != null && Object.hasOwnProperty.call(message, "xDeprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.xDeprecated); + if (message.yDeprecated != null && Object.hasOwnProperty.call(message, "yDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.yDeprecated); + if (message.x != null && Object.hasOwnProperty.call(message, "x")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.x); + if (message.y != null && Object.hasOwnProperty.call(message, "y")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.y); + return writer; + }; + + /** + * Encodes the specified Point message, length delimited. Does not implicitly {@link proto.Point.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Point + * @static + * @param {proto.IPoint} message Point message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Point.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Point message from the specified reader or buffer. + * @function decode + * @memberof proto.Point + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Point} Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Point.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Point(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.xDeprecated = reader.int32(); + break; + case 2: + message.yDeprecated = reader.int32(); + break; + case 3: + message.x = reader.double(); + break; + case 4: + message.y = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Point message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Point + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Point} Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Point.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Point message. + * @function verify + * @memberof proto.Point + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Point.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.xDeprecated != null && message.hasOwnProperty("xDeprecated")) + if (!$util.isInteger(message.xDeprecated)) + return "xDeprecated: integer expected"; + if (message.yDeprecated != null && message.hasOwnProperty("yDeprecated")) + if (!$util.isInteger(message.yDeprecated)) + return "yDeprecated: integer expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + return null; + }; + + /** + * Creates a Point message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Point + * @static + * @param {Object.} object Plain object + * @returns {proto.Point} Point + */ + Point.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Point) + return object; + var message = new $root.proto.Point(); + if (object.xDeprecated != null) + message.xDeprecated = object.xDeprecated | 0; + if (object.yDeprecated != null) + message.yDeprecated = object.yDeprecated | 0; + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + return message; + }; + + /** + * Creates a plain object from a Point message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Point + * @static + * @param {proto.Point} message Point + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Point.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.xDeprecated = 0; + object.yDeprecated = 0; + object.x = 0; + object.y = 0; + } + if (message.xDeprecated != null && message.hasOwnProperty("xDeprecated")) + object.xDeprecated = message.xDeprecated; + if (message.yDeprecated != null && message.hasOwnProperty("yDeprecated")) + object.yDeprecated = message.yDeprecated; + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + return object; + }; + + /** + * Converts this Point to JSON. + * @function toJSON + * @memberof proto.Point + * @instance + * @returns {Object.} JSON object + */ + Point.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Point; + })(); + + proto.PollAdditionalMetadata = (function() { + + /** + * Properties of a PollAdditionalMetadata. + * @memberof proto + * @interface IPollAdditionalMetadata + * @property {boolean|null} [pollInvalidated] PollAdditionalMetadata pollInvalidated + */ + + /** + * Constructs a new PollAdditionalMetadata. + * @memberof proto + * @classdesc Represents a PollAdditionalMetadata. + * @implements IPollAdditionalMetadata + * @constructor + * @param {proto.IPollAdditionalMetadata=} [properties] Properties to set + */ + function PollAdditionalMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollAdditionalMetadata pollInvalidated. + * @member {boolean} pollInvalidated + * @memberof proto.PollAdditionalMetadata + * @instance + */ + PollAdditionalMetadata.prototype.pollInvalidated = false; + + /** + * Creates a new PollAdditionalMetadata instance using the specified properties. + * @function create + * @memberof proto.PollAdditionalMetadata + * @static + * @param {proto.IPollAdditionalMetadata=} [properties] Properties to set + * @returns {proto.PollAdditionalMetadata} PollAdditionalMetadata instance + */ + PollAdditionalMetadata.create = function create(properties) { + return new PollAdditionalMetadata(properties); + }; + + /** + * Encodes the specified PollAdditionalMetadata message. Does not implicitly {@link proto.PollAdditionalMetadata.verify|verify} messages. + * @function encode + * @memberof proto.PollAdditionalMetadata + * @static + * @param {proto.IPollAdditionalMetadata} message PollAdditionalMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollAdditionalMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pollInvalidated != null && Object.hasOwnProperty.call(message, "pollInvalidated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.pollInvalidated); + return writer; + }; + + /** + * Encodes the specified PollAdditionalMetadata message, length delimited. Does not implicitly {@link proto.PollAdditionalMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PollAdditionalMetadata + * @static + * @param {proto.IPollAdditionalMetadata} message PollAdditionalMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollAdditionalMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollAdditionalMetadata message from the specified reader or buffer. + * @function decode + * @memberof proto.PollAdditionalMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PollAdditionalMetadata} PollAdditionalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollAdditionalMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PollAdditionalMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pollInvalidated = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollAdditionalMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PollAdditionalMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PollAdditionalMetadata} PollAdditionalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollAdditionalMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollAdditionalMetadata message. + * @function verify + * @memberof proto.PollAdditionalMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollAdditionalMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pollInvalidated != null && message.hasOwnProperty("pollInvalidated")) + if (typeof message.pollInvalidated !== "boolean") + return "pollInvalidated: boolean expected"; + return null; + }; + + /** + * Creates a PollAdditionalMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PollAdditionalMetadata + * @static + * @param {Object.} object Plain object + * @returns {proto.PollAdditionalMetadata} PollAdditionalMetadata + */ + PollAdditionalMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PollAdditionalMetadata) + return object; + var message = new $root.proto.PollAdditionalMetadata(); + if (object.pollInvalidated != null) + message.pollInvalidated = Boolean(object.pollInvalidated); + return message; + }; + + /** + * Creates a plain object from a PollAdditionalMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PollAdditionalMetadata + * @static + * @param {proto.PollAdditionalMetadata} message PollAdditionalMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollAdditionalMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pollInvalidated = false; + if (message.pollInvalidated != null && message.hasOwnProperty("pollInvalidated")) + object.pollInvalidated = message.pollInvalidated; + return object; + }; + + /** + * Converts this PollAdditionalMetadata to JSON. + * @function toJSON + * @memberof proto.PollAdditionalMetadata + * @instance + * @returns {Object.} JSON object + */ + PollAdditionalMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollAdditionalMetadata; + })(); + + proto.PollEncValue = (function() { + + /** + * Properties of a PollEncValue. + * @memberof proto + * @interface IPollEncValue + * @property {Uint8Array|null} [encPayload] PollEncValue encPayload + * @property {Uint8Array|null} [encIv] PollEncValue encIv + */ + + /** + * Constructs a new PollEncValue. + * @memberof proto + * @classdesc Represents a PollEncValue. + * @implements IPollEncValue + * @constructor + * @param {proto.IPollEncValue=} [properties] Properties to set + */ + function PollEncValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollEncValue encPayload. + * @member {Uint8Array} encPayload + * @memberof proto.PollEncValue + * @instance + */ + PollEncValue.prototype.encPayload = $util.newBuffer([]); + + /** + * PollEncValue encIv. + * @member {Uint8Array} encIv + * @memberof proto.PollEncValue + * @instance + */ + PollEncValue.prototype.encIv = $util.newBuffer([]); + + /** + * Creates a new PollEncValue instance using the specified properties. + * @function create + * @memberof proto.PollEncValue + * @static + * @param {proto.IPollEncValue=} [properties] Properties to set + * @returns {proto.PollEncValue} PollEncValue instance + */ + PollEncValue.create = function create(properties) { + return new PollEncValue(properties); + }; + + /** + * Encodes the specified PollEncValue message. Does not implicitly {@link proto.PollEncValue.verify|verify} messages. + * @function encode + * @memberof proto.PollEncValue + * @static + * @param {proto.IPollEncValue} message PollEncValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollEncValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.encPayload != null && Object.hasOwnProperty.call(message, "encPayload")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.encPayload); + if (message.encIv != null && Object.hasOwnProperty.call(message, "encIv")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.encIv); + return writer; + }; + + /** + * Encodes the specified PollEncValue message, length delimited. Does not implicitly {@link proto.PollEncValue.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PollEncValue + * @static + * @param {proto.IPollEncValue} message PollEncValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollEncValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollEncValue message from the specified reader or buffer. + * @function decode + * @memberof proto.PollEncValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PollEncValue} PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollEncValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PollEncValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.encPayload = reader.bytes(); + break; + case 2: + message.encIv = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollEncValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PollEncValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PollEncValue} PollEncValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollEncValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollEncValue message. + * @function verify + * @memberof proto.PollEncValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollEncValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.encPayload != null && message.hasOwnProperty("encPayload")) + if (!(message.encPayload && typeof message.encPayload.length === "number" || $util.isString(message.encPayload))) + return "encPayload: buffer expected"; + if (message.encIv != null && message.hasOwnProperty("encIv")) + if (!(message.encIv && typeof message.encIv.length === "number" || $util.isString(message.encIv))) + return "encIv: buffer expected"; + return null; + }; + + /** + * Creates a PollEncValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PollEncValue + * @static + * @param {Object.} object Plain object + * @returns {proto.PollEncValue} PollEncValue + */ + PollEncValue.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PollEncValue) + return object; + var message = new $root.proto.PollEncValue(); + if (object.encPayload != null) + if (typeof object.encPayload === "string") + $util.base64.decode(object.encPayload, message.encPayload = $util.newBuffer($util.base64.length(object.encPayload)), 0); + else if (object.encPayload.length) + message.encPayload = object.encPayload; + if (object.encIv != null) + if (typeof object.encIv === "string") + $util.base64.decode(object.encIv, message.encIv = $util.newBuffer($util.base64.length(object.encIv)), 0); + else if (object.encIv.length) + message.encIv = object.encIv; + return message; + }; + + /** + * Creates a plain object from a PollEncValue message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PollEncValue + * @static + * @param {proto.PollEncValue} message PollEncValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollEncValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.encPayload = ""; + else { + object.encPayload = []; + if (options.bytes !== Array) + object.encPayload = $util.newBuffer(object.encPayload); + } + if (options.bytes === String) + object.encIv = ""; + else { + object.encIv = []; + if (options.bytes !== Array) + object.encIv = $util.newBuffer(object.encIv); + } + } + if (message.encPayload != null && message.hasOwnProperty("encPayload")) + object.encPayload = options.bytes === String ? $util.base64.encode(message.encPayload, 0, message.encPayload.length) : options.bytes === Array ? Array.prototype.slice.call(message.encPayload) : message.encPayload; + if (message.encIv != null && message.hasOwnProperty("encIv")) + object.encIv = options.bytes === String ? $util.base64.encode(message.encIv, 0, message.encIv.length) : options.bytes === Array ? Array.prototype.slice.call(message.encIv) : message.encIv; + return object; + }; + + /** + * Converts this PollEncValue to JSON. + * @function toJSON + * @memberof proto.PollEncValue + * @instance + * @returns {Object.} JSON object + */ + PollEncValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollEncValue; + })(); + + proto.PollUpdate = (function() { + + /** + * Properties of a PollUpdate. + * @memberof proto + * @interface IPollUpdate + * @property {proto.IMessageKey|null} [pollUpdateMessageKey] PollUpdate pollUpdateMessageKey + * @property {proto.Message.IPollVoteMessage|null} [vote] PollUpdate vote + * @property {number|Long|null} [senderTimestampMs] PollUpdate senderTimestampMs + * @property {number|Long|null} [serverTimestampMs] PollUpdate serverTimestampMs + * @property {boolean|null} [unread] PollUpdate unread + */ + + /** + * Constructs a new PollUpdate. + * @memberof proto + * @classdesc Represents a PollUpdate. + * @implements IPollUpdate + * @constructor + * @param {proto.IPollUpdate=} [properties] Properties to set + */ + function PollUpdate(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PollUpdate pollUpdateMessageKey. + * @member {proto.IMessageKey|null|undefined} pollUpdateMessageKey + * @memberof proto.PollUpdate + * @instance + */ + PollUpdate.prototype.pollUpdateMessageKey = null; + + /** + * PollUpdate vote. + * @member {proto.Message.IPollVoteMessage|null|undefined} vote + * @memberof proto.PollUpdate + * @instance + */ + PollUpdate.prototype.vote = null; + + /** + * PollUpdate senderTimestampMs. + * @member {number|Long} senderTimestampMs + * @memberof proto.PollUpdate + * @instance + */ + PollUpdate.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PollUpdate serverTimestampMs. + * @member {number|Long} serverTimestampMs + * @memberof proto.PollUpdate + * @instance + */ + PollUpdate.prototype.serverTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * PollUpdate unread. + * @member {boolean} unread + * @memberof proto.PollUpdate + * @instance + */ + PollUpdate.prototype.unread = false; + + /** + * Creates a new PollUpdate instance using the specified properties. + * @function create + * @memberof proto.PollUpdate + * @static + * @param {proto.IPollUpdate=} [properties] Properties to set + * @returns {proto.PollUpdate} PollUpdate instance + */ + PollUpdate.create = function create(properties) { + return new PollUpdate(properties); + }; + + /** + * Encodes the specified PollUpdate message. Does not implicitly {@link proto.PollUpdate.verify|verify} messages. + * @function encode + * @memberof proto.PollUpdate + * @static + * @param {proto.IPollUpdate} message PollUpdate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollUpdate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pollUpdateMessageKey != null && Object.hasOwnProperty.call(message, "pollUpdateMessageKey")) + $root.proto.MessageKey.encode(message.pollUpdateMessageKey, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.vote != null && Object.hasOwnProperty.call(message, "vote")) + $root.proto.Message.PollVoteMessage.encode(message.vote, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.senderTimestampMs); + if (message.serverTimestampMs != null && Object.hasOwnProperty.call(message, "serverTimestampMs")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.serverTimestampMs); + if (message.unread != null && Object.hasOwnProperty.call(message, "unread")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.unread); + return writer; + }; + + /** + * Encodes the specified PollUpdate message, length delimited. Does not implicitly {@link proto.PollUpdate.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PollUpdate + * @static + * @param {proto.IPollUpdate} message PollUpdate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PollUpdate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PollUpdate message from the specified reader or buffer. + * @function decode + * @memberof proto.PollUpdate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PollUpdate} PollUpdate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollUpdate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PollUpdate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pollUpdateMessageKey = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.vote = $root.proto.Message.PollVoteMessage.decode(reader, reader.uint32()); + break; + case 3: + message.senderTimestampMs = reader.int64(); + break; + case 4: + message.serverTimestampMs = reader.int64(); + break; + case 5: + message.unread = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PollUpdate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PollUpdate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PollUpdate} PollUpdate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PollUpdate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PollUpdate message. + * @function verify + * @memberof proto.PollUpdate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PollUpdate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pollUpdateMessageKey != null && message.hasOwnProperty("pollUpdateMessageKey")) { + var error = $root.proto.MessageKey.verify(message.pollUpdateMessageKey); + if (error) + return "pollUpdateMessageKey." + error; + } + if (message.vote != null && message.hasOwnProperty("vote")) { + var error = $root.proto.Message.PollVoteMessage.verify(message.vote); + if (error) + return "vote." + error; + } + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high))) + return "senderTimestampMs: integer|Long expected"; + if (message.serverTimestampMs != null && message.hasOwnProperty("serverTimestampMs")) + if (!$util.isInteger(message.serverTimestampMs) && !(message.serverTimestampMs && $util.isInteger(message.serverTimestampMs.low) && $util.isInteger(message.serverTimestampMs.high))) + return "serverTimestampMs: integer|Long expected"; + if (message.unread != null && message.hasOwnProperty("unread")) + if (typeof message.unread !== "boolean") + return "unread: boolean expected"; + return null; + }; + + /** + * Creates a PollUpdate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PollUpdate + * @static + * @param {Object.} object Plain object + * @returns {proto.PollUpdate} PollUpdate + */ + PollUpdate.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PollUpdate) + return object; + var message = new $root.proto.PollUpdate(); + if (object.pollUpdateMessageKey != null) { + if (typeof object.pollUpdateMessageKey !== "object") + throw TypeError(".proto.PollUpdate.pollUpdateMessageKey: object expected"); + message.pollUpdateMessageKey = $root.proto.MessageKey.fromObject(object.pollUpdateMessageKey); + } + if (object.vote != null) { + if (typeof object.vote !== "object") + throw TypeError(".proto.PollUpdate.vote: object expected"); + message.vote = $root.proto.Message.PollVoteMessage.fromObject(object.vote); + } + if (object.senderTimestampMs != null) + if ($util.Long) + (message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false; + else if (typeof object.senderTimestampMs === "string") + message.senderTimestampMs = parseInt(object.senderTimestampMs, 10); + else if (typeof object.senderTimestampMs === "number") + message.senderTimestampMs = object.senderTimestampMs; + else if (typeof object.senderTimestampMs === "object") + message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber(); + if (object.serverTimestampMs != null) + if ($util.Long) + (message.serverTimestampMs = $util.Long.fromValue(object.serverTimestampMs)).unsigned = false; + else if (typeof object.serverTimestampMs === "string") + message.serverTimestampMs = parseInt(object.serverTimestampMs, 10); + else if (typeof object.serverTimestampMs === "number") + message.serverTimestampMs = object.serverTimestampMs; + else if (typeof object.serverTimestampMs === "object") + message.serverTimestampMs = new $util.LongBits(object.serverTimestampMs.low >>> 0, object.serverTimestampMs.high >>> 0).toNumber(); + if (object.unread != null) + message.unread = Boolean(object.unread); + return message; + }; + + /** + * Creates a plain object from a PollUpdate message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PollUpdate + * @static + * @param {proto.PollUpdate} message PollUpdate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PollUpdate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pollUpdateMessageKey = null; + object.vote = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.senderTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestampMs = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.serverTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.serverTimestampMs = options.longs === String ? "0" : 0; + object.unread = false; + } + if (message.pollUpdateMessageKey != null && message.hasOwnProperty("pollUpdateMessageKey")) + object.pollUpdateMessageKey = $root.proto.MessageKey.toObject(message.pollUpdateMessageKey, options); + if (message.vote != null && message.hasOwnProperty("vote")) + object.vote = $root.proto.Message.PollVoteMessage.toObject(message.vote, options); + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (typeof message.senderTimestampMs === "number") + object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs; + else + object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs; + if (message.serverTimestampMs != null && message.hasOwnProperty("serverTimestampMs")) + if (typeof message.serverTimestampMs === "number") + object.serverTimestampMs = options.longs === String ? String(message.serverTimestampMs) : message.serverTimestampMs; + else + object.serverTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.serverTimestampMs) : options.longs === Number ? new $util.LongBits(message.serverTimestampMs.low >>> 0, message.serverTimestampMs.high >>> 0).toNumber() : message.serverTimestampMs; + if (message.unread != null && message.hasOwnProperty("unread")) + object.unread = message.unread; + return object; + }; + + /** + * Converts this PollUpdate to JSON. + * @function toJSON + * @memberof proto.PollUpdate + * @instance + * @returns {Object.} JSON object + */ + PollUpdate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PollUpdate; + })(); + + proto.PreKeyRecordStructure = (function() { + + /** + * Properties of a PreKeyRecordStructure. + * @memberof proto + * @interface IPreKeyRecordStructure + * @property {number|null} [id] PreKeyRecordStructure id + * @property {Uint8Array|null} [publicKey] PreKeyRecordStructure publicKey + * @property {Uint8Array|null} [privateKey] PreKeyRecordStructure privateKey + */ + + /** + * Constructs a new PreKeyRecordStructure. + * @memberof proto + * @classdesc Represents a PreKeyRecordStructure. + * @implements IPreKeyRecordStructure + * @constructor + * @param {proto.IPreKeyRecordStructure=} [properties] Properties to set + */ + function PreKeyRecordStructure(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PreKeyRecordStructure id. + * @member {number} id + * @memberof proto.PreKeyRecordStructure + * @instance + */ + PreKeyRecordStructure.prototype.id = 0; + + /** + * PreKeyRecordStructure publicKey. + * @member {Uint8Array} publicKey + * @memberof proto.PreKeyRecordStructure + * @instance + */ + PreKeyRecordStructure.prototype.publicKey = $util.newBuffer([]); + + /** + * PreKeyRecordStructure privateKey. + * @member {Uint8Array} privateKey + * @memberof proto.PreKeyRecordStructure + * @instance + */ + PreKeyRecordStructure.prototype.privateKey = $util.newBuffer([]); + + /** + * Creates a new PreKeyRecordStructure instance using the specified properties. + * @function create + * @memberof proto.PreKeyRecordStructure + * @static + * @param {proto.IPreKeyRecordStructure=} [properties] Properties to set + * @returns {proto.PreKeyRecordStructure} PreKeyRecordStructure instance + */ + PreKeyRecordStructure.create = function create(properties) { + return new PreKeyRecordStructure(properties); + }; + + /** + * Encodes the specified PreKeyRecordStructure message. Does not implicitly {@link proto.PreKeyRecordStructure.verify|verify} messages. + * @function encode + * @memberof proto.PreKeyRecordStructure + * @static + * @param {proto.IPreKeyRecordStructure} message PreKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreKeyRecordStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.id); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.publicKey); + if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.privateKey); + return writer; + }; + + /** + * Encodes the specified PreKeyRecordStructure message, length delimited. Does not implicitly {@link proto.PreKeyRecordStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.PreKeyRecordStructure + * @static + * @param {proto.IPreKeyRecordStructure} message PreKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PreKeyRecordStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.PreKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.PreKeyRecordStructure} PreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreKeyRecordStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.PreKeyRecordStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.publicKey = reader.bytes(); + break; + case 3: + message.privateKey = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PreKeyRecordStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.PreKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.PreKeyRecordStructure} PreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PreKeyRecordStructure message. + * @function verify + * @memberof proto.PreKeyRecordStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PreKeyRecordStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!(message.publicKey && typeof message.publicKey.length === "number" || $util.isString(message.publicKey))) + return "publicKey: buffer expected"; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey))) + return "privateKey: buffer expected"; + return null; + }; + + /** + * Creates a PreKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.PreKeyRecordStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.PreKeyRecordStructure} PreKeyRecordStructure + */ + PreKeyRecordStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.PreKeyRecordStructure) + return object; + var message = new $root.proto.PreKeyRecordStructure(); + if (object.id != null) + message.id = object.id >>> 0; + if (object.publicKey != null) + if (typeof object.publicKey === "string") + $util.base64.decode(object.publicKey, message.publicKey = $util.newBuffer($util.base64.length(object.publicKey)), 0); + else if (object.publicKey.length) + message.publicKey = object.publicKey; + if (object.privateKey != null) + if (typeof object.privateKey === "string") + $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0); + else if (object.privateKey.length) + message.privateKey = object.privateKey; + return message; + }; + + /** + * Creates a plain object from a PreKeyRecordStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.PreKeyRecordStructure + * @static + * @param {proto.PreKeyRecordStructure} message PreKeyRecordStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PreKeyRecordStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = 0; + if (options.bytes === String) + object.publicKey = ""; + else { + object.publicKey = []; + if (options.bytes !== Array) + object.publicKey = $util.newBuffer(object.publicKey); + } + if (options.bytes === String) + object.privateKey = ""; + else { + object.privateKey = []; + if (options.bytes !== Array) + object.privateKey = $util.newBuffer(object.privateKey); + } + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = options.bytes === String ? $util.base64.encode(message.publicKey, 0, message.publicKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKey) : message.publicKey; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey; + return object; + }; + + /** + * Converts this PreKeyRecordStructure to JSON. + * @function toJSON + * @memberof proto.PreKeyRecordStructure + * @instance + * @returns {Object.} JSON object + */ + PreKeyRecordStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PreKeyRecordStructure; + })(); + + proto.Pushname = (function() { + + /** + * Properties of a Pushname. + * @memberof proto + * @interface IPushname + * @property {string|null} [id] Pushname id + * @property {string|null} [pushname] Pushname pushname + */ + + /** + * Constructs a new Pushname. + * @memberof proto + * @classdesc Represents a Pushname. + * @implements IPushname + * @constructor + * @param {proto.IPushname=} [properties] Properties to set + */ + function Pushname(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Pushname id. + * @member {string} id + * @memberof proto.Pushname + * @instance + */ + Pushname.prototype.id = ""; + + /** + * Pushname pushname. + * @member {string} pushname + * @memberof proto.Pushname + * @instance + */ + Pushname.prototype.pushname = ""; + + /** + * Creates a new Pushname instance using the specified properties. + * @function create + * @memberof proto.Pushname + * @static + * @param {proto.IPushname=} [properties] Properties to set + * @returns {proto.Pushname} Pushname instance + */ + Pushname.create = function create(properties) { + return new Pushname(properties); + }; + + /** + * Encodes the specified Pushname message. Does not implicitly {@link proto.Pushname.verify|verify} messages. + * @function encode + * @memberof proto.Pushname + * @static + * @param {proto.IPushname} message Pushname message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pushname.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.pushname != null && Object.hasOwnProperty.call(message, "pushname")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pushname); + return writer; + }; + + /** + * Encodes the specified Pushname message, length delimited. Does not implicitly {@link proto.Pushname.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Pushname + * @static + * @param {proto.IPushname} message Pushname message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pushname.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Pushname message from the specified reader or buffer. + * @function decode + * @memberof proto.Pushname + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Pushname} Pushname + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pushname.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Pushname(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.pushname = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Pushname message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Pushname + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Pushname} Pushname + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pushname.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Pushname message. + * @function verify + * @memberof proto.Pushname + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Pushname.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.pushname != null && message.hasOwnProperty("pushname")) + if (!$util.isString(message.pushname)) + return "pushname: string expected"; + return null; + }; + + /** + * Creates a Pushname message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Pushname + * @static + * @param {Object.} object Plain object + * @returns {proto.Pushname} Pushname + */ + Pushname.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Pushname) + return object; + var message = new $root.proto.Pushname(); + if (object.id != null) + message.id = String(object.id); + if (object.pushname != null) + message.pushname = String(object.pushname); + return message; + }; + + /** + * Creates a plain object from a Pushname message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Pushname + * @static + * @param {proto.Pushname} message Pushname + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Pushname.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.pushname = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.pushname != null && message.hasOwnProperty("pushname")) + object.pushname = message.pushname; + return object; + }; + + /** + * Converts this Pushname to JSON. + * @function toJSON + * @memberof proto.Pushname + * @instance + * @returns {Object.} JSON object + */ + Pushname.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Pushname; + })(); + + proto.Reaction = (function() { + + /** + * Properties of a Reaction. + * @memberof proto + * @interface IReaction + * @property {proto.IMessageKey|null} [key] Reaction key + * @property {string|null} [text] Reaction text + * @property {string|null} [groupingKey] Reaction groupingKey + * @property {number|Long|null} [senderTimestampMs] Reaction senderTimestampMs + * @property {boolean|null} [unread] Reaction unread + */ + + /** + * Constructs a new Reaction. + * @memberof proto + * @classdesc Represents a Reaction. + * @implements IReaction + * @constructor + * @param {proto.IReaction=} [properties] Properties to set + */ + function Reaction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Reaction key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.Reaction + * @instance + */ + Reaction.prototype.key = null; + + /** + * Reaction text. + * @member {string} text + * @memberof proto.Reaction + * @instance + */ + Reaction.prototype.text = ""; + + /** + * Reaction groupingKey. + * @member {string} groupingKey + * @memberof proto.Reaction + * @instance + */ + Reaction.prototype.groupingKey = ""; + + /** + * Reaction senderTimestampMs. + * @member {number|Long} senderTimestampMs + * @memberof proto.Reaction + * @instance + */ + Reaction.prototype.senderTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Reaction unread. + * @member {boolean} unread + * @memberof proto.Reaction + * @instance + */ + Reaction.prototype.unread = false; + + /** + * Creates a new Reaction instance using the specified properties. + * @function create + * @memberof proto.Reaction + * @static + * @param {proto.IReaction=} [properties] Properties to set + * @returns {proto.Reaction} Reaction instance + */ + Reaction.create = function create(properties) { + return new Reaction(properties); + }; + + /** + * Encodes the specified Reaction message. Does not implicitly {@link proto.Reaction.verify|verify} messages. + * @function encode + * @memberof proto.Reaction + * @static + * @param {proto.IReaction} message Reaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reaction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); + if (message.groupingKey != null && Object.hasOwnProperty.call(message, "groupingKey")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.groupingKey); + if (message.senderTimestampMs != null && Object.hasOwnProperty.call(message, "senderTimestampMs")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.senderTimestampMs); + if (message.unread != null && Object.hasOwnProperty.call(message, "unread")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.unread); + return writer; + }; + + /** + * Encodes the specified Reaction message, length delimited. Does not implicitly {@link proto.Reaction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.Reaction + * @static + * @param {proto.IReaction} message Reaction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reaction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Reaction message from the specified reader or buffer. + * @function decode + * @memberof proto.Reaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.Reaction} Reaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reaction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Reaction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.text = reader.string(); + break; + case 3: + message.groupingKey = reader.string(); + break; + case 4: + message.senderTimestampMs = reader.int64(); + break; + case 5: + message.unread = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Reaction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.Reaction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.Reaction} Reaction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reaction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Reaction message. + * @function verify + * @memberof proto.Reaction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Reaction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.groupingKey != null && message.hasOwnProperty("groupingKey")) + if (!$util.isString(message.groupingKey)) + return "groupingKey: string expected"; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (!$util.isInteger(message.senderTimestampMs) && !(message.senderTimestampMs && $util.isInteger(message.senderTimestampMs.low) && $util.isInteger(message.senderTimestampMs.high))) + return "senderTimestampMs: integer|Long expected"; + if (message.unread != null && message.hasOwnProperty("unread")) + if (typeof message.unread !== "boolean") + return "unread: boolean expected"; + return null; + }; + + /** + * Creates a Reaction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.Reaction + * @static + * @param {Object.} object Plain object + * @returns {proto.Reaction} Reaction + */ + Reaction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.Reaction) + return object; + var message = new $root.proto.Reaction(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.Reaction.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + if (object.text != null) + message.text = String(object.text); + if (object.groupingKey != null) + message.groupingKey = String(object.groupingKey); + if (object.senderTimestampMs != null) + if ($util.Long) + (message.senderTimestampMs = $util.Long.fromValue(object.senderTimestampMs)).unsigned = false; + else if (typeof object.senderTimestampMs === "string") + message.senderTimestampMs = parseInt(object.senderTimestampMs, 10); + else if (typeof object.senderTimestampMs === "number") + message.senderTimestampMs = object.senderTimestampMs; + else if (typeof object.senderTimestampMs === "object") + message.senderTimestampMs = new $util.LongBits(object.senderTimestampMs.low >>> 0, object.senderTimestampMs.high >>> 0).toNumber(); + if (object.unread != null) + message.unread = Boolean(object.unread); + return message; + }; + + /** + * Creates a plain object from a Reaction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.Reaction + * @static + * @param {proto.Reaction} message Reaction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Reaction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + object.text = ""; + object.groupingKey = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.senderTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.senderTimestampMs = options.longs === String ? "0" : 0; + object.unread = false; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.groupingKey != null && message.hasOwnProperty("groupingKey")) + object.groupingKey = message.groupingKey; + if (message.senderTimestampMs != null && message.hasOwnProperty("senderTimestampMs")) + if (typeof message.senderTimestampMs === "number") + object.senderTimestampMs = options.longs === String ? String(message.senderTimestampMs) : message.senderTimestampMs; + else + object.senderTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.senderTimestampMs) : options.longs === Number ? new $util.LongBits(message.senderTimestampMs.low >>> 0, message.senderTimestampMs.high >>> 0).toNumber() : message.senderTimestampMs; + if (message.unread != null && message.hasOwnProperty("unread")) + object.unread = message.unread; + return object; + }; + + /** + * Converts this Reaction to JSON. + * @function toJSON + * @memberof proto.Reaction + * @instance + * @returns {Object.} JSON object + */ + Reaction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Reaction; + })(); + + proto.RecentEmojiWeight = (function() { + + /** + * Properties of a RecentEmojiWeight. + * @memberof proto + * @interface IRecentEmojiWeight + * @property {string|null} [emoji] RecentEmojiWeight emoji + * @property {number|null} [weight] RecentEmojiWeight weight + */ + + /** + * Constructs a new RecentEmojiWeight. + * @memberof proto + * @classdesc Represents a RecentEmojiWeight. + * @implements IRecentEmojiWeight + * @constructor + * @param {proto.IRecentEmojiWeight=} [properties] Properties to set + */ + function RecentEmojiWeight(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentEmojiWeight emoji. + * @member {string} emoji + * @memberof proto.RecentEmojiWeight + * @instance + */ + RecentEmojiWeight.prototype.emoji = ""; + + /** + * RecentEmojiWeight weight. + * @member {number} weight + * @memberof proto.RecentEmojiWeight + * @instance + */ + RecentEmojiWeight.prototype.weight = 0; + + /** + * Creates a new RecentEmojiWeight instance using the specified properties. + * @function create + * @memberof proto.RecentEmojiWeight + * @static + * @param {proto.IRecentEmojiWeight=} [properties] Properties to set + * @returns {proto.RecentEmojiWeight} RecentEmojiWeight instance + */ + RecentEmojiWeight.create = function create(properties) { + return new RecentEmojiWeight(properties); + }; + + /** + * Encodes the specified RecentEmojiWeight message. Does not implicitly {@link proto.RecentEmojiWeight.verify|verify} messages. + * @function encode + * @memberof proto.RecentEmojiWeight + * @static + * @param {proto.IRecentEmojiWeight} message RecentEmojiWeight message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentEmojiWeight.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.emoji != null && Object.hasOwnProperty.call(message, "emoji")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.emoji); + if (message.weight != null && Object.hasOwnProperty.call(message, "weight")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.weight); + return writer; + }; + + /** + * Encodes the specified RecentEmojiWeight message, length delimited. Does not implicitly {@link proto.RecentEmojiWeight.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.RecentEmojiWeight + * @static + * @param {proto.IRecentEmojiWeight} message RecentEmojiWeight message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentEmojiWeight.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentEmojiWeight message from the specified reader or buffer. + * @function decode + * @memberof proto.RecentEmojiWeight + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.RecentEmojiWeight} RecentEmojiWeight + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentEmojiWeight.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.RecentEmojiWeight(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.emoji = reader.string(); + break; + case 2: + message.weight = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentEmojiWeight message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.RecentEmojiWeight + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.RecentEmojiWeight} RecentEmojiWeight + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentEmojiWeight.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentEmojiWeight message. + * @function verify + * @memberof proto.RecentEmojiWeight + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentEmojiWeight.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.emoji != null && message.hasOwnProperty("emoji")) + if (!$util.isString(message.emoji)) + return "emoji: string expected"; + if (message.weight != null && message.hasOwnProperty("weight")) + if (typeof message.weight !== "number") + return "weight: number expected"; + return null; + }; + + /** + * Creates a RecentEmojiWeight message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.RecentEmojiWeight + * @static + * @param {Object.} object Plain object + * @returns {proto.RecentEmojiWeight} RecentEmojiWeight + */ + RecentEmojiWeight.fromObject = function fromObject(object) { + if (object instanceof $root.proto.RecentEmojiWeight) + return object; + var message = new $root.proto.RecentEmojiWeight(); + if (object.emoji != null) + message.emoji = String(object.emoji); + if (object.weight != null) + message.weight = Number(object.weight); + return message; + }; + + /** + * Creates a plain object from a RecentEmojiWeight message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.RecentEmojiWeight + * @static + * @param {proto.RecentEmojiWeight} message RecentEmojiWeight + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentEmojiWeight.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.emoji = ""; + object.weight = 0; + } + if (message.emoji != null && message.hasOwnProperty("emoji")) + object.emoji = message.emoji; + if (message.weight != null && message.hasOwnProperty("weight")) + object.weight = options.json && !isFinite(message.weight) ? String(message.weight) : message.weight; + return object; + }; + + /** + * Converts this RecentEmojiWeight to JSON. + * @function toJSON + * @memberof proto.RecentEmojiWeight + * @instance + * @returns {Object.} JSON object + */ + RecentEmojiWeight.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentEmojiWeight; + })(); + + proto.RecordStructure = (function() { + + /** + * Properties of a RecordStructure. + * @memberof proto + * @interface IRecordStructure + * @property {proto.ISessionStructure|null} [currentSession] RecordStructure currentSession + * @property {Array.|null} [previousSessions] RecordStructure previousSessions + */ + + /** + * Constructs a new RecordStructure. + * @memberof proto + * @classdesc Represents a RecordStructure. + * @implements IRecordStructure + * @constructor + * @param {proto.IRecordStructure=} [properties] Properties to set + */ + function RecordStructure(properties) { + this.previousSessions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecordStructure currentSession. + * @member {proto.ISessionStructure|null|undefined} currentSession + * @memberof proto.RecordStructure + * @instance + */ + RecordStructure.prototype.currentSession = null; + + /** + * RecordStructure previousSessions. + * @member {Array.} previousSessions + * @memberof proto.RecordStructure + * @instance + */ + RecordStructure.prototype.previousSessions = $util.emptyArray; + + /** + * Creates a new RecordStructure instance using the specified properties. + * @function create + * @memberof proto.RecordStructure + * @static + * @param {proto.IRecordStructure=} [properties] Properties to set + * @returns {proto.RecordStructure} RecordStructure instance + */ + RecordStructure.create = function create(properties) { + return new RecordStructure(properties); + }; + + /** + * Encodes the specified RecordStructure message. Does not implicitly {@link proto.RecordStructure.verify|verify} messages. + * @function encode + * @memberof proto.RecordStructure + * @static + * @param {proto.IRecordStructure} message RecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecordStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currentSession != null && Object.hasOwnProperty.call(message, "currentSession")) + $root.proto.SessionStructure.encode(message.currentSession, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.previousSessions != null && message.previousSessions.length) + for (var i = 0; i < message.previousSessions.length; ++i) + $root.proto.SessionStructure.encode(message.previousSessions[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RecordStructure message, length delimited. Does not implicitly {@link proto.RecordStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.RecordStructure + * @static + * @param {proto.IRecordStructure} message RecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecordStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecordStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.RecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.RecordStructure} RecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecordStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.RecordStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currentSession = $root.proto.SessionStructure.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.previousSessions && message.previousSessions.length)) + message.previousSessions = []; + message.previousSessions.push($root.proto.SessionStructure.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecordStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.RecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.RecordStructure} RecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecordStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecordStructure message. + * @function verify + * @memberof proto.RecordStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecordStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currentSession != null && message.hasOwnProperty("currentSession")) { + var error = $root.proto.SessionStructure.verify(message.currentSession); + if (error) + return "currentSession." + error; + } + if (message.previousSessions != null && message.hasOwnProperty("previousSessions")) { + if (!Array.isArray(message.previousSessions)) + return "previousSessions: array expected"; + for (var i = 0; i < message.previousSessions.length; ++i) { + var error = $root.proto.SessionStructure.verify(message.previousSessions[i]); + if (error) + return "previousSessions." + error; + } + } + return null; + }; + + /** + * Creates a RecordStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.RecordStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.RecordStructure} RecordStructure + */ + RecordStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.RecordStructure) + return object; + var message = new $root.proto.RecordStructure(); + if (object.currentSession != null) { + if (typeof object.currentSession !== "object") + throw TypeError(".proto.RecordStructure.currentSession: object expected"); + message.currentSession = $root.proto.SessionStructure.fromObject(object.currentSession); + } + if (object.previousSessions) { + if (!Array.isArray(object.previousSessions)) + throw TypeError(".proto.RecordStructure.previousSessions: array expected"); + message.previousSessions = []; + for (var i = 0; i < object.previousSessions.length; ++i) { + if (typeof object.previousSessions[i] !== "object") + throw TypeError(".proto.RecordStructure.previousSessions: object expected"); + message.previousSessions[i] = $root.proto.SessionStructure.fromObject(object.previousSessions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RecordStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.RecordStructure + * @static + * @param {proto.RecordStructure} message RecordStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecordStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.previousSessions = []; + if (options.defaults) + object.currentSession = null; + if (message.currentSession != null && message.hasOwnProperty("currentSession")) + object.currentSession = $root.proto.SessionStructure.toObject(message.currentSession, options); + if (message.previousSessions && message.previousSessions.length) { + object.previousSessions = []; + for (var j = 0; j < message.previousSessions.length; ++j) + object.previousSessions[j] = $root.proto.SessionStructure.toObject(message.previousSessions[j], options); + } + return object; + }; + + /** + * Converts this RecordStructure to JSON. + * @function toJSON + * @memberof proto.RecordStructure + * @instance + * @returns {Object.} JSON object + */ + RecordStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecordStructure; + })(); + + proto.SenderKeyRecordStructure = (function() { + + /** + * Properties of a SenderKeyRecordStructure. + * @memberof proto + * @interface ISenderKeyRecordStructure + * @property {Array.|null} [senderKeyStates] SenderKeyRecordStructure senderKeyStates + */ + + /** + * Constructs a new SenderKeyRecordStructure. + * @memberof proto + * @classdesc Represents a SenderKeyRecordStructure. + * @implements ISenderKeyRecordStructure + * @constructor + * @param {proto.ISenderKeyRecordStructure=} [properties] Properties to set + */ + function SenderKeyRecordStructure(properties) { + this.senderKeyStates = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyRecordStructure senderKeyStates. + * @member {Array.} senderKeyStates + * @memberof proto.SenderKeyRecordStructure + * @instance + */ + SenderKeyRecordStructure.prototype.senderKeyStates = $util.emptyArray; + + /** + * Creates a new SenderKeyRecordStructure instance using the specified properties. + * @function create + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {proto.ISenderKeyRecordStructure=} [properties] Properties to set + * @returns {proto.SenderKeyRecordStructure} SenderKeyRecordStructure instance + */ + SenderKeyRecordStructure.create = function create(properties) { + return new SenderKeyRecordStructure(properties); + }; + + /** + * Encodes the specified SenderKeyRecordStructure message. Does not implicitly {@link proto.SenderKeyRecordStructure.verify|verify} messages. + * @function encode + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {proto.ISenderKeyRecordStructure} message SenderKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyRecordStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.senderKeyStates != null && message.senderKeyStates.length) + for (var i = 0; i < message.senderKeyStates.length; ++i) + $root.proto.SenderKeyStateStructure.encode(message.senderKeyStates[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SenderKeyRecordStructure message, length delimited. Does not implicitly {@link proto.SenderKeyRecordStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {proto.ISenderKeyRecordStructure} message SenderKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyRecordStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SenderKeyRecordStructure} SenderKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyRecordStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SenderKeyRecordStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.senderKeyStates && message.senderKeyStates.length)) + message.senderKeyStates = []; + message.senderKeyStates.push($root.proto.SenderKeyStateStructure.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyRecordStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SenderKeyRecordStructure} SenderKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyRecordStructure message. + * @function verify + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyRecordStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.senderKeyStates != null && message.hasOwnProperty("senderKeyStates")) { + if (!Array.isArray(message.senderKeyStates)) + return "senderKeyStates: array expected"; + for (var i = 0; i < message.senderKeyStates.length; ++i) { + var error = $root.proto.SenderKeyStateStructure.verify(message.senderKeyStates[i]); + if (error) + return "senderKeyStates." + error; + } + } + return null; + }; + + /** + * Creates a SenderKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.SenderKeyRecordStructure} SenderKeyRecordStructure + */ + SenderKeyRecordStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SenderKeyRecordStructure) + return object; + var message = new $root.proto.SenderKeyRecordStructure(); + if (object.senderKeyStates) { + if (!Array.isArray(object.senderKeyStates)) + throw TypeError(".proto.SenderKeyRecordStructure.senderKeyStates: array expected"); + message.senderKeyStates = []; + for (var i = 0; i < object.senderKeyStates.length; ++i) { + if (typeof object.senderKeyStates[i] !== "object") + throw TypeError(".proto.SenderKeyRecordStructure.senderKeyStates: object expected"); + message.senderKeyStates[i] = $root.proto.SenderKeyStateStructure.fromObject(object.senderKeyStates[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SenderKeyRecordStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SenderKeyRecordStructure + * @static + * @param {proto.SenderKeyRecordStructure} message SenderKeyRecordStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyRecordStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.senderKeyStates = []; + if (message.senderKeyStates && message.senderKeyStates.length) { + object.senderKeyStates = []; + for (var j = 0; j < message.senderKeyStates.length; ++j) + object.senderKeyStates[j] = $root.proto.SenderKeyStateStructure.toObject(message.senderKeyStates[j], options); + } + return object; + }; + + /** + * Converts this SenderKeyRecordStructure to JSON. + * @function toJSON + * @memberof proto.SenderKeyRecordStructure + * @instance + * @returns {Object.} JSON object + */ + SenderKeyRecordStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderKeyRecordStructure; + })(); + + proto.SenderKeyStateStructure = (function() { + + /** + * Properties of a SenderKeyStateStructure. + * @memberof proto + * @interface ISenderKeyStateStructure + * @property {number|null} [senderKeyId] SenderKeyStateStructure senderKeyId + * @property {proto.SenderKeyStateStructure.ISenderChainKey|null} [senderChainKey] SenderKeyStateStructure senderChainKey + * @property {proto.SenderKeyStateStructure.ISenderSigningKey|null} [senderSigningKey] SenderKeyStateStructure senderSigningKey + * @property {Array.|null} [senderMessageKeys] SenderKeyStateStructure senderMessageKeys + */ + + /** + * Constructs a new SenderKeyStateStructure. + * @memberof proto + * @classdesc Represents a SenderKeyStateStructure. + * @implements ISenderKeyStateStructure + * @constructor + * @param {proto.ISenderKeyStateStructure=} [properties] Properties to set + */ + function SenderKeyStateStructure(properties) { + this.senderMessageKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyStateStructure senderKeyId. + * @member {number} senderKeyId + * @memberof proto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderKeyId = 0; + + /** + * SenderKeyStateStructure senderChainKey. + * @member {proto.SenderKeyStateStructure.ISenderChainKey|null|undefined} senderChainKey + * @memberof proto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderChainKey = null; + + /** + * SenderKeyStateStructure senderSigningKey. + * @member {proto.SenderKeyStateStructure.ISenderSigningKey|null|undefined} senderSigningKey + * @memberof proto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderSigningKey = null; + + /** + * SenderKeyStateStructure senderMessageKeys. + * @member {Array.} senderMessageKeys + * @memberof proto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderMessageKeys = $util.emptyArray; + + /** + * Creates a new SenderKeyStateStructure instance using the specified properties. + * @function create + * @memberof proto.SenderKeyStateStructure + * @static + * @param {proto.ISenderKeyStateStructure=} [properties] Properties to set + * @returns {proto.SenderKeyStateStructure} SenderKeyStateStructure instance + */ + SenderKeyStateStructure.create = function create(properties) { + return new SenderKeyStateStructure(properties); + }; + + /** + * Encodes the specified SenderKeyStateStructure message. Does not implicitly {@link proto.SenderKeyStateStructure.verify|verify} messages. + * @function encode + * @memberof proto.SenderKeyStateStructure + * @static + * @param {proto.ISenderKeyStateStructure} message SenderKeyStateStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyStateStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.senderKeyId != null && Object.hasOwnProperty.call(message, "senderKeyId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.senderKeyId); + if (message.senderChainKey != null && Object.hasOwnProperty.call(message, "senderChainKey")) + $root.proto.SenderKeyStateStructure.SenderChainKey.encode(message.senderChainKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.senderSigningKey != null && Object.hasOwnProperty.call(message, "senderSigningKey")) + $root.proto.SenderKeyStateStructure.SenderSigningKey.encode(message.senderSigningKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.senderMessageKeys != null && message.senderMessageKeys.length) + for (var i = 0; i < message.senderMessageKeys.length; ++i) + $root.proto.SenderKeyStateStructure.SenderMessageKey.encode(message.senderMessageKeys[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SenderKeyStateStructure message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SenderKeyStateStructure + * @static + * @param {proto.ISenderKeyStateStructure} message SenderKeyStateStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyStateStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyStateStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.SenderKeyStateStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SenderKeyStateStructure} SenderKeyStateStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyStateStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SenderKeyStateStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.senderKeyId = reader.uint32(); + break; + case 2: + message.senderChainKey = $root.proto.SenderKeyStateStructure.SenderChainKey.decode(reader, reader.uint32()); + break; + case 3: + message.senderSigningKey = $root.proto.SenderKeyStateStructure.SenderSigningKey.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.senderMessageKeys && message.senderMessageKeys.length)) + message.senderMessageKeys = []; + message.senderMessageKeys.push($root.proto.SenderKeyStateStructure.SenderMessageKey.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyStateStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SenderKeyStateStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SenderKeyStateStructure} SenderKeyStateStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyStateStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyStateStructure message. + * @function verify + * @memberof proto.SenderKeyStateStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyStateStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.senderKeyId != null && message.hasOwnProperty("senderKeyId")) + if (!$util.isInteger(message.senderKeyId)) + return "senderKeyId: integer expected"; + if (message.senderChainKey != null && message.hasOwnProperty("senderChainKey")) { + var error = $root.proto.SenderKeyStateStructure.SenderChainKey.verify(message.senderChainKey); + if (error) + return "senderChainKey." + error; + } + if (message.senderSigningKey != null && message.hasOwnProperty("senderSigningKey")) { + var error = $root.proto.SenderKeyStateStructure.SenderSigningKey.verify(message.senderSigningKey); + if (error) + return "senderSigningKey." + error; + } + if (message.senderMessageKeys != null && message.hasOwnProperty("senderMessageKeys")) { + if (!Array.isArray(message.senderMessageKeys)) + return "senderMessageKeys: array expected"; + for (var i = 0; i < message.senderMessageKeys.length; ++i) { + var error = $root.proto.SenderKeyStateStructure.SenderMessageKey.verify(message.senderMessageKeys[i]); + if (error) + return "senderMessageKeys." + error; + } + } + return null; + }; + + /** + * Creates a SenderKeyStateStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SenderKeyStateStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.SenderKeyStateStructure} SenderKeyStateStructure + */ + SenderKeyStateStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SenderKeyStateStructure) + return object; + var message = new $root.proto.SenderKeyStateStructure(); + if (object.senderKeyId != null) + message.senderKeyId = object.senderKeyId >>> 0; + if (object.senderChainKey != null) { + if (typeof object.senderChainKey !== "object") + throw TypeError(".proto.SenderKeyStateStructure.senderChainKey: object expected"); + message.senderChainKey = $root.proto.SenderKeyStateStructure.SenderChainKey.fromObject(object.senderChainKey); + } + if (object.senderSigningKey != null) { + if (typeof object.senderSigningKey !== "object") + throw TypeError(".proto.SenderKeyStateStructure.senderSigningKey: object expected"); + message.senderSigningKey = $root.proto.SenderKeyStateStructure.SenderSigningKey.fromObject(object.senderSigningKey); + } + if (object.senderMessageKeys) { + if (!Array.isArray(object.senderMessageKeys)) + throw TypeError(".proto.SenderKeyStateStructure.senderMessageKeys: array expected"); + message.senderMessageKeys = []; + for (var i = 0; i < object.senderMessageKeys.length; ++i) { + if (typeof object.senderMessageKeys[i] !== "object") + throw TypeError(".proto.SenderKeyStateStructure.senderMessageKeys: object expected"); + message.senderMessageKeys[i] = $root.proto.SenderKeyStateStructure.SenderMessageKey.fromObject(object.senderMessageKeys[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SenderKeyStateStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SenderKeyStateStructure + * @static + * @param {proto.SenderKeyStateStructure} message SenderKeyStateStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyStateStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.senderMessageKeys = []; + if (options.defaults) { + object.senderKeyId = 0; + object.senderChainKey = null; + object.senderSigningKey = null; + } + if (message.senderKeyId != null && message.hasOwnProperty("senderKeyId")) + object.senderKeyId = message.senderKeyId; + if (message.senderChainKey != null && message.hasOwnProperty("senderChainKey")) + object.senderChainKey = $root.proto.SenderKeyStateStructure.SenderChainKey.toObject(message.senderChainKey, options); + if (message.senderSigningKey != null && message.hasOwnProperty("senderSigningKey")) + object.senderSigningKey = $root.proto.SenderKeyStateStructure.SenderSigningKey.toObject(message.senderSigningKey, options); + if (message.senderMessageKeys && message.senderMessageKeys.length) { + object.senderMessageKeys = []; + for (var j = 0; j < message.senderMessageKeys.length; ++j) + object.senderMessageKeys[j] = $root.proto.SenderKeyStateStructure.SenderMessageKey.toObject(message.senderMessageKeys[j], options); + } + return object; + }; + + /** + * Converts this SenderKeyStateStructure to JSON. + * @function toJSON + * @memberof proto.SenderKeyStateStructure + * @instance + * @returns {Object.} JSON object + */ + SenderKeyStateStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SenderKeyStateStructure.SenderChainKey = (function() { + + /** + * Properties of a SenderChainKey. + * @memberof proto.SenderKeyStateStructure + * @interface ISenderChainKey + * @property {number|null} [iteration] SenderChainKey iteration + * @property {Uint8Array|null} [seed] SenderChainKey seed + */ + + /** + * Constructs a new SenderChainKey. + * @memberof proto.SenderKeyStateStructure + * @classdesc Represents a SenderChainKey. + * @implements ISenderChainKey + * @constructor + * @param {proto.SenderKeyStateStructure.ISenderChainKey=} [properties] Properties to set + */ + function SenderChainKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderChainKey iteration. + * @member {number} iteration + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @instance + */ + SenderChainKey.prototype.iteration = 0; + + /** + * SenderChainKey seed. + * @member {Uint8Array} seed + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @instance + */ + SenderChainKey.prototype.seed = $util.newBuffer([]); + + /** + * Creates a new SenderChainKey instance using the specified properties. + * @function create + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderChainKey=} [properties] Properties to set + * @returns {proto.SenderKeyStateStructure.SenderChainKey} SenderChainKey instance + */ + SenderChainKey.create = function create(properties) { + return new SenderChainKey(properties); + }; + + /** + * Encodes the specified SenderChainKey message. Does not implicitly {@link proto.SenderKeyStateStructure.SenderChainKey.verify|verify} messages. + * @function encode + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderChainKey} message SenderChainKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderChainKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.iteration); + if (message.seed != null && Object.hasOwnProperty.call(message, "seed")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.seed); + return writer; + }; + + /** + * Encodes the specified SenderChainKey message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.SenderChainKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderChainKey} message SenderChainKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderChainKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderChainKey message from the specified reader or buffer. + * @function decode + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SenderKeyStateStructure.SenderChainKey} SenderChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderChainKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SenderKeyStateStructure.SenderChainKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.iteration = reader.uint32(); + break; + case 2: + message.seed = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderChainKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SenderKeyStateStructure.SenderChainKey} SenderChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderChainKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderChainKey message. + * @function verify + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderChainKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.iteration != null && message.hasOwnProperty("iteration")) + if (!$util.isInteger(message.iteration)) + return "iteration: integer expected"; + if (message.seed != null && message.hasOwnProperty("seed")) + if (!(message.seed && typeof message.seed.length === "number" || $util.isString(message.seed))) + return "seed: buffer expected"; + return null; + }; + + /** + * Creates a SenderChainKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {Object.} object Plain object + * @returns {proto.SenderKeyStateStructure.SenderChainKey} SenderChainKey + */ + SenderChainKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SenderKeyStateStructure.SenderChainKey) + return object; + var message = new $root.proto.SenderKeyStateStructure.SenderChainKey(); + if (object.iteration != null) + message.iteration = object.iteration >>> 0; + if (object.seed != null) + if (typeof object.seed === "string") + $util.base64.decode(object.seed, message.seed = $util.newBuffer($util.base64.length(object.seed)), 0); + else if (object.seed.length) + message.seed = object.seed; + return message; + }; + + /** + * Creates a plain object from a SenderChainKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @static + * @param {proto.SenderKeyStateStructure.SenderChainKey} message SenderChainKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderChainKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.iteration = 0; + if (options.bytes === String) + object.seed = ""; + else { + object.seed = []; + if (options.bytes !== Array) + object.seed = $util.newBuffer(object.seed); + } + } + if (message.iteration != null && message.hasOwnProperty("iteration")) + object.iteration = message.iteration; + if (message.seed != null && message.hasOwnProperty("seed")) + object.seed = options.bytes === String ? $util.base64.encode(message.seed, 0, message.seed.length) : options.bytes === Array ? Array.prototype.slice.call(message.seed) : message.seed; + return object; + }; + + /** + * Converts this SenderChainKey to JSON. + * @function toJSON + * @memberof proto.SenderKeyStateStructure.SenderChainKey + * @instance + * @returns {Object.} JSON object + */ + SenderChainKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderChainKey; + })(); + + SenderKeyStateStructure.SenderMessageKey = (function() { + + /** + * Properties of a SenderMessageKey. + * @memberof proto.SenderKeyStateStructure + * @interface ISenderMessageKey + * @property {number|null} [iteration] SenderMessageKey iteration + * @property {Uint8Array|null} [seed] SenderMessageKey seed + */ + + /** + * Constructs a new SenderMessageKey. + * @memberof proto.SenderKeyStateStructure + * @classdesc Represents a SenderMessageKey. + * @implements ISenderMessageKey + * @constructor + * @param {proto.SenderKeyStateStructure.ISenderMessageKey=} [properties] Properties to set + */ + function SenderMessageKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderMessageKey iteration. + * @member {number} iteration + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @instance + */ + SenderMessageKey.prototype.iteration = 0; + + /** + * SenderMessageKey seed. + * @member {Uint8Array} seed + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @instance + */ + SenderMessageKey.prototype.seed = $util.newBuffer([]); + + /** + * Creates a new SenderMessageKey instance using the specified properties. + * @function create + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderMessageKey=} [properties] Properties to set + * @returns {proto.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey instance + */ + SenderMessageKey.create = function create(properties) { + return new SenderMessageKey(properties); + }; + + /** + * Encodes the specified SenderMessageKey message. Does not implicitly {@link proto.SenderKeyStateStructure.SenderMessageKey.verify|verify} messages. + * @function encode + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderMessageKey} message SenderMessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderMessageKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.iteration); + if (message.seed != null && Object.hasOwnProperty.call(message, "seed")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.seed); + return writer; + }; + + /** + * Encodes the specified SenderMessageKey message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.SenderMessageKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderMessageKey} message SenderMessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderMessageKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderMessageKey message from the specified reader or buffer. + * @function decode + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderMessageKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SenderKeyStateStructure.SenderMessageKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.iteration = reader.uint32(); + break; + case 2: + message.seed = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderMessageKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderMessageKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderMessageKey message. + * @function verify + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderMessageKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.iteration != null && message.hasOwnProperty("iteration")) + if (!$util.isInteger(message.iteration)) + return "iteration: integer expected"; + if (message.seed != null && message.hasOwnProperty("seed")) + if (!(message.seed && typeof message.seed.length === "number" || $util.isString(message.seed))) + return "seed: buffer expected"; + return null; + }; + + /** + * Creates a SenderMessageKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {Object.} object Plain object + * @returns {proto.SenderKeyStateStructure.SenderMessageKey} SenderMessageKey + */ + SenderMessageKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SenderKeyStateStructure.SenderMessageKey) + return object; + var message = new $root.proto.SenderKeyStateStructure.SenderMessageKey(); + if (object.iteration != null) + message.iteration = object.iteration >>> 0; + if (object.seed != null) + if (typeof object.seed === "string") + $util.base64.decode(object.seed, message.seed = $util.newBuffer($util.base64.length(object.seed)), 0); + else if (object.seed.length) + message.seed = object.seed; + return message; + }; + + /** + * Creates a plain object from a SenderMessageKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @static + * @param {proto.SenderKeyStateStructure.SenderMessageKey} message SenderMessageKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderMessageKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.iteration = 0; + if (options.bytes === String) + object.seed = ""; + else { + object.seed = []; + if (options.bytes !== Array) + object.seed = $util.newBuffer(object.seed); + } + } + if (message.iteration != null && message.hasOwnProperty("iteration")) + object.iteration = message.iteration; + if (message.seed != null && message.hasOwnProperty("seed")) + object.seed = options.bytes === String ? $util.base64.encode(message.seed, 0, message.seed.length) : options.bytes === Array ? Array.prototype.slice.call(message.seed) : message.seed; + return object; + }; + + /** + * Converts this SenderMessageKey to JSON. + * @function toJSON + * @memberof proto.SenderKeyStateStructure.SenderMessageKey + * @instance + * @returns {Object.} JSON object + */ + SenderMessageKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderMessageKey; + })(); + + SenderKeyStateStructure.SenderSigningKey = (function() { + + /** + * Properties of a SenderSigningKey. + * @memberof proto.SenderKeyStateStructure + * @interface ISenderSigningKey + * @property {Uint8Array|null} ["public"] SenderSigningKey public + * @property {Uint8Array|null} ["private"] SenderSigningKey private + */ + + /** + * Constructs a new SenderSigningKey. + * @memberof proto.SenderKeyStateStructure + * @classdesc Represents a SenderSigningKey. + * @implements ISenderSigningKey + * @constructor + * @param {proto.SenderKeyStateStructure.ISenderSigningKey=} [properties] Properties to set + */ + function SenderSigningKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderSigningKey public. + * @member {Uint8Array} public + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @instance + */ + SenderSigningKey.prototype["public"] = $util.newBuffer([]); + + /** + * SenderSigningKey private. + * @member {Uint8Array} private + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @instance + */ + SenderSigningKey.prototype["private"] = $util.newBuffer([]); + + /** + * Creates a new SenderSigningKey instance using the specified properties. + * @function create + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderSigningKey=} [properties] Properties to set + * @returns {proto.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey instance + */ + SenderSigningKey.create = function create(properties) { + return new SenderSigningKey(properties); + }; + + /** + * Encodes the specified SenderSigningKey message. Does not implicitly {@link proto.SenderKeyStateStructure.SenderSigningKey.verify|verify} messages. + * @function encode + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderSigningKey} message SenderSigningKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderSigningKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["public"] != null && Object.hasOwnProperty.call(message, "public")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message["public"]); + if (message["private"] != null && Object.hasOwnProperty.call(message, "private")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message["private"]); + return writer; + }; + + /** + * Encodes the specified SenderSigningKey message, length delimited. Does not implicitly {@link proto.SenderKeyStateStructure.SenderSigningKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {proto.SenderKeyStateStructure.ISenderSigningKey} message SenderSigningKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderSigningKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderSigningKey message from the specified reader or buffer. + * @function decode + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderSigningKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SenderKeyStateStructure.SenderSigningKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["public"] = reader.bytes(); + break; + case 2: + message["private"] = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderSigningKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderSigningKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderSigningKey message. + * @function verify + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderSigningKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["public"] != null && message.hasOwnProperty("public")) + if (!(message["public"] && typeof message["public"].length === "number" || $util.isString(message["public"]))) + return "public: buffer expected"; + if (message["private"] != null && message.hasOwnProperty("private")) + if (!(message["private"] && typeof message["private"].length === "number" || $util.isString(message["private"]))) + return "private: buffer expected"; + return null; + }; + + /** + * Creates a SenderSigningKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {Object.} object Plain object + * @returns {proto.SenderKeyStateStructure.SenderSigningKey} SenderSigningKey + */ + SenderSigningKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SenderKeyStateStructure.SenderSigningKey) + return object; + var message = new $root.proto.SenderKeyStateStructure.SenderSigningKey(); + if (object["public"] != null) + if (typeof object["public"] === "string") + $util.base64.decode(object["public"], message["public"] = $util.newBuffer($util.base64.length(object["public"])), 0); + else if (object["public"].length) + message["public"] = object["public"]; + if (object["private"] != null) + if (typeof object["private"] === "string") + $util.base64.decode(object["private"], message["private"] = $util.newBuffer($util.base64.length(object["private"])), 0); + else if (object["private"].length) + message["private"] = object["private"]; + return message; + }; + + /** + * Creates a plain object from a SenderSigningKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @static + * @param {proto.SenderKeyStateStructure.SenderSigningKey} message SenderSigningKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderSigningKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object["public"] = ""; + else { + object["public"] = []; + if (options.bytes !== Array) + object["public"] = $util.newBuffer(object["public"]); + } + if (options.bytes === String) + object["private"] = ""; + else { + object["private"] = []; + if (options.bytes !== Array) + object["private"] = $util.newBuffer(object["private"]); + } + } + if (message["public"] != null && message.hasOwnProperty("public")) + object["public"] = options.bytes === String ? $util.base64.encode(message["public"], 0, message["public"].length) : options.bytes === Array ? Array.prototype.slice.call(message["public"]) : message["public"]; + if (message["private"] != null && message.hasOwnProperty("private")) + object["private"] = options.bytes === String ? $util.base64.encode(message["private"], 0, message["private"].length) : options.bytes === Array ? Array.prototype.slice.call(message["private"]) : message["private"]; + return object; + }; + + /** + * Converts this SenderSigningKey to JSON. + * @function toJSON + * @memberof proto.SenderKeyStateStructure.SenderSigningKey + * @instance + * @returns {Object.} JSON object + */ + SenderSigningKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderSigningKey; + })(); + + return SenderKeyStateStructure; + })(); + + proto.ServerErrorReceipt = (function() { + + /** + * Properties of a ServerErrorReceipt. + * @memberof proto + * @interface IServerErrorReceipt + * @property {string|null} [stanzaId] ServerErrorReceipt stanzaId + */ + + /** + * Constructs a new ServerErrorReceipt. + * @memberof proto + * @classdesc Represents a ServerErrorReceipt. + * @implements IServerErrorReceipt + * @constructor + * @param {proto.IServerErrorReceipt=} [properties] Properties to set + */ + function ServerErrorReceipt(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServerErrorReceipt stanzaId. + * @member {string} stanzaId + * @memberof proto.ServerErrorReceipt + * @instance + */ + ServerErrorReceipt.prototype.stanzaId = ""; + + /** + * Creates a new ServerErrorReceipt instance using the specified properties. + * @function create + * @memberof proto.ServerErrorReceipt + * @static + * @param {proto.IServerErrorReceipt=} [properties] Properties to set + * @returns {proto.ServerErrorReceipt} ServerErrorReceipt instance + */ + ServerErrorReceipt.create = function create(properties) { + return new ServerErrorReceipt(properties); + }; + + /** + * Encodes the specified ServerErrorReceipt message. Does not implicitly {@link proto.ServerErrorReceipt.verify|verify} messages. + * @function encode + * @memberof proto.ServerErrorReceipt + * @static + * @param {proto.IServerErrorReceipt} message ServerErrorReceipt message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServerErrorReceipt.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.stanzaId != null && Object.hasOwnProperty.call(message, "stanzaId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.stanzaId); + return writer; + }; + + /** + * Encodes the specified ServerErrorReceipt message, length delimited. Does not implicitly {@link proto.ServerErrorReceipt.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.ServerErrorReceipt + * @static + * @param {proto.IServerErrorReceipt} message ServerErrorReceipt message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServerErrorReceipt.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServerErrorReceipt message from the specified reader or buffer. + * @function decode + * @memberof proto.ServerErrorReceipt + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.ServerErrorReceipt} ServerErrorReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServerErrorReceipt.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.ServerErrorReceipt(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.stanzaId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServerErrorReceipt message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.ServerErrorReceipt + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.ServerErrorReceipt} ServerErrorReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServerErrorReceipt.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServerErrorReceipt message. + * @function verify + * @memberof proto.ServerErrorReceipt + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServerErrorReceipt.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + if (!$util.isString(message.stanzaId)) + return "stanzaId: string expected"; + return null; + }; + + /** + * Creates a ServerErrorReceipt message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.ServerErrorReceipt + * @static + * @param {Object.} object Plain object + * @returns {proto.ServerErrorReceipt} ServerErrorReceipt + */ + ServerErrorReceipt.fromObject = function fromObject(object) { + if (object instanceof $root.proto.ServerErrorReceipt) + return object; + var message = new $root.proto.ServerErrorReceipt(); + if (object.stanzaId != null) + message.stanzaId = String(object.stanzaId); + return message; + }; + + /** + * Creates a plain object from a ServerErrorReceipt message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.ServerErrorReceipt + * @static + * @param {proto.ServerErrorReceipt} message ServerErrorReceipt + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServerErrorReceipt.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.stanzaId = ""; + if (message.stanzaId != null && message.hasOwnProperty("stanzaId")) + object.stanzaId = message.stanzaId; + return object; + }; + + /** + * Converts this ServerErrorReceipt to JSON. + * @function toJSON + * @memberof proto.ServerErrorReceipt + * @instance + * @returns {Object.} JSON object + */ + ServerErrorReceipt.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServerErrorReceipt; + })(); + + proto.SessionStructure = (function() { + + /** + * Properties of a SessionStructure. + * @memberof proto + * @interface ISessionStructure + * @property {number|null} [sessionVersion] SessionStructure sessionVersion + * @property {Uint8Array|null} [localIdentityPublic] SessionStructure localIdentityPublic + * @property {Uint8Array|null} [remoteIdentityPublic] SessionStructure remoteIdentityPublic + * @property {Uint8Array|null} [rootKey] SessionStructure rootKey + * @property {number|null} [previousCounter] SessionStructure previousCounter + * @property {proto.SessionStructure.IChain|null} [senderChain] SessionStructure senderChain + * @property {Array.|null} [receiverChains] SessionStructure receiverChains + * @property {proto.SessionStructure.IPendingKeyExchange|null} [pendingKeyExchange] SessionStructure pendingKeyExchange + * @property {proto.SessionStructure.IPendingPreKey|null} [pendingPreKey] SessionStructure pendingPreKey + * @property {number|null} [remoteRegistrationId] SessionStructure remoteRegistrationId + * @property {number|null} [localRegistrationId] SessionStructure localRegistrationId + * @property {boolean|null} [needsRefresh] SessionStructure needsRefresh + * @property {Uint8Array|null} [aliceBaseKey] SessionStructure aliceBaseKey + */ + + /** + * Constructs a new SessionStructure. + * @memberof proto + * @classdesc Represents a SessionStructure. + * @implements ISessionStructure + * @constructor + * @param {proto.ISessionStructure=} [properties] Properties to set + */ + function SessionStructure(properties) { + this.receiverChains = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SessionStructure sessionVersion. + * @member {number} sessionVersion + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.sessionVersion = 0; + + /** + * SessionStructure localIdentityPublic. + * @member {Uint8Array} localIdentityPublic + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.localIdentityPublic = $util.newBuffer([]); + + /** + * SessionStructure remoteIdentityPublic. + * @member {Uint8Array} remoteIdentityPublic + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.remoteIdentityPublic = $util.newBuffer([]); + + /** + * SessionStructure rootKey. + * @member {Uint8Array} rootKey + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.rootKey = $util.newBuffer([]); + + /** + * SessionStructure previousCounter. + * @member {number} previousCounter + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.previousCounter = 0; + + /** + * SessionStructure senderChain. + * @member {proto.SessionStructure.IChain|null|undefined} senderChain + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.senderChain = null; + + /** + * SessionStructure receiverChains. + * @member {Array.} receiverChains + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.receiverChains = $util.emptyArray; + + /** + * SessionStructure pendingKeyExchange. + * @member {proto.SessionStructure.IPendingKeyExchange|null|undefined} pendingKeyExchange + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.pendingKeyExchange = null; + + /** + * SessionStructure pendingPreKey. + * @member {proto.SessionStructure.IPendingPreKey|null|undefined} pendingPreKey + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.pendingPreKey = null; + + /** + * SessionStructure remoteRegistrationId. + * @member {number} remoteRegistrationId + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.remoteRegistrationId = 0; + + /** + * SessionStructure localRegistrationId. + * @member {number} localRegistrationId + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.localRegistrationId = 0; + + /** + * SessionStructure needsRefresh. + * @member {boolean} needsRefresh + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.needsRefresh = false; + + /** + * SessionStructure aliceBaseKey. + * @member {Uint8Array} aliceBaseKey + * @memberof proto.SessionStructure + * @instance + */ + SessionStructure.prototype.aliceBaseKey = $util.newBuffer([]); + + /** + * Creates a new SessionStructure instance using the specified properties. + * @function create + * @memberof proto.SessionStructure + * @static + * @param {proto.ISessionStructure=} [properties] Properties to set + * @returns {proto.SessionStructure} SessionStructure instance + */ + SessionStructure.create = function create(properties) { + return new SessionStructure(properties); + }; + + /** + * Encodes the specified SessionStructure message. Does not implicitly {@link proto.SessionStructure.verify|verify} messages. + * @function encode + * @memberof proto.SessionStructure + * @static + * @param {proto.ISessionStructure} message SessionStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionVersion != null && Object.hasOwnProperty.call(message, "sessionVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.sessionVersion); + if (message.localIdentityPublic != null && Object.hasOwnProperty.call(message, "localIdentityPublic")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.localIdentityPublic); + if (message.remoteIdentityPublic != null && Object.hasOwnProperty.call(message, "remoteIdentityPublic")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.remoteIdentityPublic); + if (message.rootKey != null && Object.hasOwnProperty.call(message, "rootKey")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.rootKey); + if (message.previousCounter != null && Object.hasOwnProperty.call(message, "previousCounter")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.previousCounter); + if (message.senderChain != null && Object.hasOwnProperty.call(message, "senderChain")) + $root.proto.SessionStructure.Chain.encode(message.senderChain, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.receiverChains != null && message.receiverChains.length) + for (var i = 0; i < message.receiverChains.length; ++i) + $root.proto.SessionStructure.Chain.encode(message.receiverChains[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.pendingKeyExchange != null && Object.hasOwnProperty.call(message, "pendingKeyExchange")) + $root.proto.SessionStructure.PendingKeyExchange.encode(message.pendingKeyExchange, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.pendingPreKey != null && Object.hasOwnProperty.call(message, "pendingPreKey")) + $root.proto.SessionStructure.PendingPreKey.encode(message.pendingPreKey, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.remoteRegistrationId != null && Object.hasOwnProperty.call(message, "remoteRegistrationId")) + writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.remoteRegistrationId); + if (message.localRegistrationId != null && Object.hasOwnProperty.call(message, "localRegistrationId")) + writer.uint32(/* id 11, wireType 0 =*/88).uint32(message.localRegistrationId); + if (message.needsRefresh != null && Object.hasOwnProperty.call(message, "needsRefresh")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.needsRefresh); + if (message.aliceBaseKey != null && Object.hasOwnProperty.call(message, "aliceBaseKey")) + writer.uint32(/* id 13, wireType 2 =*/106).bytes(message.aliceBaseKey); + return writer; + }; + + /** + * Encodes the specified SessionStructure message, length delimited. Does not implicitly {@link proto.SessionStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SessionStructure + * @static + * @param {proto.ISessionStructure} message SessionStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SessionStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.SessionStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SessionStructure} SessionStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SessionStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sessionVersion = reader.uint32(); + break; + case 2: + message.localIdentityPublic = reader.bytes(); + break; + case 3: + message.remoteIdentityPublic = reader.bytes(); + break; + case 4: + message.rootKey = reader.bytes(); + break; + case 5: + message.previousCounter = reader.uint32(); + break; + case 6: + message.senderChain = $root.proto.SessionStructure.Chain.decode(reader, reader.uint32()); + break; + case 7: + if (!(message.receiverChains && message.receiverChains.length)) + message.receiverChains = []; + message.receiverChains.push($root.proto.SessionStructure.Chain.decode(reader, reader.uint32())); + break; + case 8: + message.pendingKeyExchange = $root.proto.SessionStructure.PendingKeyExchange.decode(reader, reader.uint32()); + break; + case 9: + message.pendingPreKey = $root.proto.SessionStructure.PendingPreKey.decode(reader, reader.uint32()); + break; + case 10: + message.remoteRegistrationId = reader.uint32(); + break; + case 11: + message.localRegistrationId = reader.uint32(); + break; + case 12: + message.needsRefresh = reader.bool(); + break; + case 13: + message.aliceBaseKey = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SessionStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SessionStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SessionStructure} SessionStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SessionStructure message. + * @function verify + * @memberof proto.SessionStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SessionStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionVersion != null && message.hasOwnProperty("sessionVersion")) + if (!$util.isInteger(message.sessionVersion)) + return "sessionVersion: integer expected"; + if (message.localIdentityPublic != null && message.hasOwnProperty("localIdentityPublic")) + if (!(message.localIdentityPublic && typeof message.localIdentityPublic.length === "number" || $util.isString(message.localIdentityPublic))) + return "localIdentityPublic: buffer expected"; + if (message.remoteIdentityPublic != null && message.hasOwnProperty("remoteIdentityPublic")) + if (!(message.remoteIdentityPublic && typeof message.remoteIdentityPublic.length === "number" || $util.isString(message.remoteIdentityPublic))) + return "remoteIdentityPublic: buffer expected"; + if (message.rootKey != null && message.hasOwnProperty("rootKey")) + if (!(message.rootKey && typeof message.rootKey.length === "number" || $util.isString(message.rootKey))) + return "rootKey: buffer expected"; + if (message.previousCounter != null && message.hasOwnProperty("previousCounter")) + if (!$util.isInteger(message.previousCounter)) + return "previousCounter: integer expected"; + if (message.senderChain != null && message.hasOwnProperty("senderChain")) { + var error = $root.proto.SessionStructure.Chain.verify(message.senderChain); + if (error) + return "senderChain." + error; + } + if (message.receiverChains != null && message.hasOwnProperty("receiverChains")) { + if (!Array.isArray(message.receiverChains)) + return "receiverChains: array expected"; + for (var i = 0; i < message.receiverChains.length; ++i) { + var error = $root.proto.SessionStructure.Chain.verify(message.receiverChains[i]); + if (error) + return "receiverChains." + error; + } + } + if (message.pendingKeyExchange != null && message.hasOwnProperty("pendingKeyExchange")) { + var error = $root.proto.SessionStructure.PendingKeyExchange.verify(message.pendingKeyExchange); + if (error) + return "pendingKeyExchange." + error; + } + if (message.pendingPreKey != null && message.hasOwnProperty("pendingPreKey")) { + var error = $root.proto.SessionStructure.PendingPreKey.verify(message.pendingPreKey); + if (error) + return "pendingPreKey." + error; + } + if (message.remoteRegistrationId != null && message.hasOwnProperty("remoteRegistrationId")) + if (!$util.isInteger(message.remoteRegistrationId)) + return "remoteRegistrationId: integer expected"; + if (message.localRegistrationId != null && message.hasOwnProperty("localRegistrationId")) + if (!$util.isInteger(message.localRegistrationId)) + return "localRegistrationId: integer expected"; + if (message.needsRefresh != null && message.hasOwnProperty("needsRefresh")) + if (typeof message.needsRefresh !== "boolean") + return "needsRefresh: boolean expected"; + if (message.aliceBaseKey != null && message.hasOwnProperty("aliceBaseKey")) + if (!(message.aliceBaseKey && typeof message.aliceBaseKey.length === "number" || $util.isString(message.aliceBaseKey))) + return "aliceBaseKey: buffer expected"; + return null; + }; + + /** + * Creates a SessionStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SessionStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.SessionStructure} SessionStructure + */ + SessionStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SessionStructure) + return object; + var message = new $root.proto.SessionStructure(); + if (object.sessionVersion != null) + message.sessionVersion = object.sessionVersion >>> 0; + if (object.localIdentityPublic != null) + if (typeof object.localIdentityPublic === "string") + $util.base64.decode(object.localIdentityPublic, message.localIdentityPublic = $util.newBuffer($util.base64.length(object.localIdentityPublic)), 0); + else if (object.localIdentityPublic.length) + message.localIdentityPublic = object.localIdentityPublic; + if (object.remoteIdentityPublic != null) + if (typeof object.remoteIdentityPublic === "string") + $util.base64.decode(object.remoteIdentityPublic, message.remoteIdentityPublic = $util.newBuffer($util.base64.length(object.remoteIdentityPublic)), 0); + else if (object.remoteIdentityPublic.length) + message.remoteIdentityPublic = object.remoteIdentityPublic; + if (object.rootKey != null) + if (typeof object.rootKey === "string") + $util.base64.decode(object.rootKey, message.rootKey = $util.newBuffer($util.base64.length(object.rootKey)), 0); + else if (object.rootKey.length) + message.rootKey = object.rootKey; + if (object.previousCounter != null) + message.previousCounter = object.previousCounter >>> 0; + if (object.senderChain != null) { + if (typeof object.senderChain !== "object") + throw TypeError(".proto.SessionStructure.senderChain: object expected"); + message.senderChain = $root.proto.SessionStructure.Chain.fromObject(object.senderChain); + } + if (object.receiverChains) { + if (!Array.isArray(object.receiverChains)) + throw TypeError(".proto.SessionStructure.receiverChains: array expected"); + message.receiverChains = []; + for (var i = 0; i < object.receiverChains.length; ++i) { + if (typeof object.receiverChains[i] !== "object") + throw TypeError(".proto.SessionStructure.receiverChains: object expected"); + message.receiverChains[i] = $root.proto.SessionStructure.Chain.fromObject(object.receiverChains[i]); + } + } + if (object.pendingKeyExchange != null) { + if (typeof object.pendingKeyExchange !== "object") + throw TypeError(".proto.SessionStructure.pendingKeyExchange: object expected"); + message.pendingKeyExchange = $root.proto.SessionStructure.PendingKeyExchange.fromObject(object.pendingKeyExchange); + } + if (object.pendingPreKey != null) { + if (typeof object.pendingPreKey !== "object") + throw TypeError(".proto.SessionStructure.pendingPreKey: object expected"); + message.pendingPreKey = $root.proto.SessionStructure.PendingPreKey.fromObject(object.pendingPreKey); + } + if (object.remoteRegistrationId != null) + message.remoteRegistrationId = object.remoteRegistrationId >>> 0; + if (object.localRegistrationId != null) + message.localRegistrationId = object.localRegistrationId >>> 0; + if (object.needsRefresh != null) + message.needsRefresh = Boolean(object.needsRefresh); + if (object.aliceBaseKey != null) + if (typeof object.aliceBaseKey === "string") + $util.base64.decode(object.aliceBaseKey, message.aliceBaseKey = $util.newBuffer($util.base64.length(object.aliceBaseKey)), 0); + else if (object.aliceBaseKey.length) + message.aliceBaseKey = object.aliceBaseKey; + return message; + }; + + /** + * Creates a plain object from a SessionStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SessionStructure + * @static + * @param {proto.SessionStructure} message SessionStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SessionStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.receiverChains = []; + if (options.defaults) { + object.sessionVersion = 0; + if (options.bytes === String) + object.localIdentityPublic = ""; + else { + object.localIdentityPublic = []; + if (options.bytes !== Array) + object.localIdentityPublic = $util.newBuffer(object.localIdentityPublic); + } + if (options.bytes === String) + object.remoteIdentityPublic = ""; + else { + object.remoteIdentityPublic = []; + if (options.bytes !== Array) + object.remoteIdentityPublic = $util.newBuffer(object.remoteIdentityPublic); + } + if (options.bytes === String) + object.rootKey = ""; + else { + object.rootKey = []; + if (options.bytes !== Array) + object.rootKey = $util.newBuffer(object.rootKey); + } + object.previousCounter = 0; + object.senderChain = null; + object.pendingKeyExchange = null; + object.pendingPreKey = null; + object.remoteRegistrationId = 0; + object.localRegistrationId = 0; + object.needsRefresh = false; + if (options.bytes === String) + object.aliceBaseKey = ""; + else { + object.aliceBaseKey = []; + if (options.bytes !== Array) + object.aliceBaseKey = $util.newBuffer(object.aliceBaseKey); + } + } + if (message.sessionVersion != null && message.hasOwnProperty("sessionVersion")) + object.sessionVersion = message.sessionVersion; + if (message.localIdentityPublic != null && message.hasOwnProperty("localIdentityPublic")) + object.localIdentityPublic = options.bytes === String ? $util.base64.encode(message.localIdentityPublic, 0, message.localIdentityPublic.length) : options.bytes === Array ? Array.prototype.slice.call(message.localIdentityPublic) : message.localIdentityPublic; + if (message.remoteIdentityPublic != null && message.hasOwnProperty("remoteIdentityPublic")) + object.remoteIdentityPublic = options.bytes === String ? $util.base64.encode(message.remoteIdentityPublic, 0, message.remoteIdentityPublic.length) : options.bytes === Array ? Array.prototype.slice.call(message.remoteIdentityPublic) : message.remoteIdentityPublic; + if (message.rootKey != null && message.hasOwnProperty("rootKey")) + object.rootKey = options.bytes === String ? $util.base64.encode(message.rootKey, 0, message.rootKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.rootKey) : message.rootKey; + if (message.previousCounter != null && message.hasOwnProperty("previousCounter")) + object.previousCounter = message.previousCounter; + if (message.senderChain != null && message.hasOwnProperty("senderChain")) + object.senderChain = $root.proto.SessionStructure.Chain.toObject(message.senderChain, options); + if (message.receiverChains && message.receiverChains.length) { + object.receiverChains = []; + for (var j = 0; j < message.receiverChains.length; ++j) + object.receiverChains[j] = $root.proto.SessionStructure.Chain.toObject(message.receiverChains[j], options); + } + if (message.pendingKeyExchange != null && message.hasOwnProperty("pendingKeyExchange")) + object.pendingKeyExchange = $root.proto.SessionStructure.PendingKeyExchange.toObject(message.pendingKeyExchange, options); + if (message.pendingPreKey != null && message.hasOwnProperty("pendingPreKey")) + object.pendingPreKey = $root.proto.SessionStructure.PendingPreKey.toObject(message.pendingPreKey, options); + if (message.remoteRegistrationId != null && message.hasOwnProperty("remoteRegistrationId")) + object.remoteRegistrationId = message.remoteRegistrationId; + if (message.localRegistrationId != null && message.hasOwnProperty("localRegistrationId")) + object.localRegistrationId = message.localRegistrationId; + if (message.needsRefresh != null && message.hasOwnProperty("needsRefresh")) + object.needsRefresh = message.needsRefresh; + if (message.aliceBaseKey != null && message.hasOwnProperty("aliceBaseKey")) + object.aliceBaseKey = options.bytes === String ? $util.base64.encode(message.aliceBaseKey, 0, message.aliceBaseKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.aliceBaseKey) : message.aliceBaseKey; + return object; + }; + + /** + * Converts this SessionStructure to JSON. + * @function toJSON + * @memberof proto.SessionStructure + * @instance + * @returns {Object.} JSON object + */ + SessionStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SessionStructure.Chain = (function() { + + /** + * Properties of a Chain. + * @memberof proto.SessionStructure + * @interface IChain + * @property {Uint8Array|null} [senderRatchetKey] Chain senderRatchetKey + * @property {Uint8Array|null} [senderRatchetKeyPrivate] Chain senderRatchetKeyPrivate + * @property {proto.SessionStructure.Chain.IChainKey|null} [chainKey] Chain chainKey + * @property {Array.|null} [messageKeys] Chain messageKeys + */ + + /** + * Constructs a new Chain. + * @memberof proto.SessionStructure + * @classdesc Represents a Chain. + * @implements IChain + * @constructor + * @param {proto.SessionStructure.IChain=} [properties] Properties to set + */ + function Chain(properties) { + this.messageKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Chain senderRatchetKey. + * @member {Uint8Array} senderRatchetKey + * @memberof proto.SessionStructure.Chain + * @instance + */ + Chain.prototype.senderRatchetKey = $util.newBuffer([]); + + /** + * Chain senderRatchetKeyPrivate. + * @member {Uint8Array} senderRatchetKeyPrivate + * @memberof proto.SessionStructure.Chain + * @instance + */ + Chain.prototype.senderRatchetKeyPrivate = $util.newBuffer([]); + + /** + * Chain chainKey. + * @member {proto.SessionStructure.Chain.IChainKey|null|undefined} chainKey + * @memberof proto.SessionStructure.Chain + * @instance + */ + Chain.prototype.chainKey = null; + + /** + * Chain messageKeys. + * @member {Array.} messageKeys + * @memberof proto.SessionStructure.Chain + * @instance + */ + Chain.prototype.messageKeys = $util.emptyArray; + + /** + * Creates a new Chain instance using the specified properties. + * @function create + * @memberof proto.SessionStructure.Chain + * @static + * @param {proto.SessionStructure.IChain=} [properties] Properties to set + * @returns {proto.SessionStructure.Chain} Chain instance + */ + Chain.create = function create(properties) { + return new Chain(properties); + }; + + /** + * Encodes the specified Chain message. Does not implicitly {@link proto.SessionStructure.Chain.verify|verify} messages. + * @function encode + * @memberof proto.SessionStructure.Chain + * @static + * @param {proto.SessionStructure.IChain} message Chain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Chain.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.senderRatchetKey != null && Object.hasOwnProperty.call(message, "senderRatchetKey")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.senderRatchetKey); + if (message.senderRatchetKeyPrivate != null && Object.hasOwnProperty.call(message, "senderRatchetKeyPrivate")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.senderRatchetKeyPrivate); + if (message.chainKey != null && Object.hasOwnProperty.call(message, "chainKey")) + $root.proto.SessionStructure.Chain.ChainKey.encode(message.chainKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.messageKeys != null && message.messageKeys.length) + for (var i = 0; i < message.messageKeys.length; ++i) + $root.proto.SessionStructure.Chain.MessageKey.encode(message.messageKeys[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Chain message, length delimited. Does not implicitly {@link proto.SessionStructure.Chain.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SessionStructure.Chain + * @static + * @param {proto.SessionStructure.IChain} message Chain message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Chain.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Chain message from the specified reader or buffer. + * @function decode + * @memberof proto.SessionStructure.Chain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SessionStructure.Chain} Chain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Chain.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SessionStructure.Chain(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.senderRatchetKey = reader.bytes(); + break; + case 2: + message.senderRatchetKeyPrivate = reader.bytes(); + break; + case 3: + message.chainKey = $root.proto.SessionStructure.Chain.ChainKey.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.messageKeys && message.messageKeys.length)) + message.messageKeys = []; + message.messageKeys.push($root.proto.SessionStructure.Chain.MessageKey.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Chain message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SessionStructure.Chain + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SessionStructure.Chain} Chain + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Chain.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Chain message. + * @function verify + * @memberof proto.SessionStructure.Chain + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Chain.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.senderRatchetKey != null && message.hasOwnProperty("senderRatchetKey")) + if (!(message.senderRatchetKey && typeof message.senderRatchetKey.length === "number" || $util.isString(message.senderRatchetKey))) + return "senderRatchetKey: buffer expected"; + if (message.senderRatchetKeyPrivate != null && message.hasOwnProperty("senderRatchetKeyPrivate")) + if (!(message.senderRatchetKeyPrivate && typeof message.senderRatchetKeyPrivate.length === "number" || $util.isString(message.senderRatchetKeyPrivate))) + return "senderRatchetKeyPrivate: buffer expected"; + if (message.chainKey != null && message.hasOwnProperty("chainKey")) { + var error = $root.proto.SessionStructure.Chain.ChainKey.verify(message.chainKey); + if (error) + return "chainKey." + error; + } + if (message.messageKeys != null && message.hasOwnProperty("messageKeys")) { + if (!Array.isArray(message.messageKeys)) + return "messageKeys: array expected"; + for (var i = 0; i < message.messageKeys.length; ++i) { + var error = $root.proto.SessionStructure.Chain.MessageKey.verify(message.messageKeys[i]); + if (error) + return "messageKeys." + error; + } + } + return null; + }; + + /** + * Creates a Chain message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SessionStructure.Chain + * @static + * @param {Object.} object Plain object + * @returns {proto.SessionStructure.Chain} Chain + */ + Chain.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SessionStructure.Chain) + return object; + var message = new $root.proto.SessionStructure.Chain(); + if (object.senderRatchetKey != null) + if (typeof object.senderRatchetKey === "string") + $util.base64.decode(object.senderRatchetKey, message.senderRatchetKey = $util.newBuffer($util.base64.length(object.senderRatchetKey)), 0); + else if (object.senderRatchetKey.length) + message.senderRatchetKey = object.senderRatchetKey; + if (object.senderRatchetKeyPrivate != null) + if (typeof object.senderRatchetKeyPrivate === "string") + $util.base64.decode(object.senderRatchetKeyPrivate, message.senderRatchetKeyPrivate = $util.newBuffer($util.base64.length(object.senderRatchetKeyPrivate)), 0); + else if (object.senderRatchetKeyPrivate.length) + message.senderRatchetKeyPrivate = object.senderRatchetKeyPrivate; + if (object.chainKey != null) { + if (typeof object.chainKey !== "object") + throw TypeError(".proto.SessionStructure.Chain.chainKey: object expected"); + message.chainKey = $root.proto.SessionStructure.Chain.ChainKey.fromObject(object.chainKey); + } + if (object.messageKeys) { + if (!Array.isArray(object.messageKeys)) + throw TypeError(".proto.SessionStructure.Chain.messageKeys: array expected"); + message.messageKeys = []; + for (var i = 0; i < object.messageKeys.length; ++i) { + if (typeof object.messageKeys[i] !== "object") + throw TypeError(".proto.SessionStructure.Chain.messageKeys: object expected"); + message.messageKeys[i] = $root.proto.SessionStructure.Chain.MessageKey.fromObject(object.messageKeys[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Chain message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SessionStructure.Chain + * @static + * @param {proto.SessionStructure.Chain} message Chain + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Chain.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messageKeys = []; + if (options.defaults) { + if (options.bytes === String) + object.senderRatchetKey = ""; + else { + object.senderRatchetKey = []; + if (options.bytes !== Array) + object.senderRatchetKey = $util.newBuffer(object.senderRatchetKey); + } + if (options.bytes === String) + object.senderRatchetKeyPrivate = ""; + else { + object.senderRatchetKeyPrivate = []; + if (options.bytes !== Array) + object.senderRatchetKeyPrivate = $util.newBuffer(object.senderRatchetKeyPrivate); + } + object.chainKey = null; + } + if (message.senderRatchetKey != null && message.hasOwnProperty("senderRatchetKey")) + object.senderRatchetKey = options.bytes === String ? $util.base64.encode(message.senderRatchetKey, 0, message.senderRatchetKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.senderRatchetKey) : message.senderRatchetKey; + if (message.senderRatchetKeyPrivate != null && message.hasOwnProperty("senderRatchetKeyPrivate")) + object.senderRatchetKeyPrivate = options.bytes === String ? $util.base64.encode(message.senderRatchetKeyPrivate, 0, message.senderRatchetKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.senderRatchetKeyPrivate) : message.senderRatchetKeyPrivate; + if (message.chainKey != null && message.hasOwnProperty("chainKey")) + object.chainKey = $root.proto.SessionStructure.Chain.ChainKey.toObject(message.chainKey, options); + if (message.messageKeys && message.messageKeys.length) { + object.messageKeys = []; + for (var j = 0; j < message.messageKeys.length; ++j) + object.messageKeys[j] = $root.proto.SessionStructure.Chain.MessageKey.toObject(message.messageKeys[j], options); + } + return object; + }; + + /** + * Converts this Chain to JSON. + * @function toJSON + * @memberof proto.SessionStructure.Chain + * @instance + * @returns {Object.} JSON object + */ + Chain.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + Chain.ChainKey = (function() { + + /** + * Properties of a ChainKey. + * @memberof proto.SessionStructure.Chain + * @interface IChainKey + * @property {number|null} [index] ChainKey index + * @property {Uint8Array|null} [key] ChainKey key + */ + + /** + * Constructs a new ChainKey. + * @memberof proto.SessionStructure.Chain + * @classdesc Represents a ChainKey. + * @implements IChainKey + * @constructor + * @param {proto.SessionStructure.Chain.IChainKey=} [properties] Properties to set + */ + function ChainKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChainKey index. + * @member {number} index + * @memberof proto.SessionStructure.Chain.ChainKey + * @instance + */ + ChainKey.prototype.index = 0; + + /** + * ChainKey key. + * @member {Uint8Array} key + * @memberof proto.SessionStructure.Chain.ChainKey + * @instance + */ + ChainKey.prototype.key = $util.newBuffer([]); + + /** + * Creates a new ChainKey instance using the specified properties. + * @function create + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {proto.SessionStructure.Chain.IChainKey=} [properties] Properties to set + * @returns {proto.SessionStructure.Chain.ChainKey} ChainKey instance + */ + ChainKey.create = function create(properties) { + return new ChainKey(properties); + }; + + /** + * Encodes the specified ChainKey message. Does not implicitly {@link proto.SessionStructure.Chain.ChainKey.verify|verify} messages. + * @function encode + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {proto.SessionStructure.Chain.IChainKey} message ChainKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChainKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.key); + return writer; + }; + + /** + * Encodes the specified ChainKey message, length delimited. Does not implicitly {@link proto.SessionStructure.Chain.ChainKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {proto.SessionStructure.Chain.IChainKey} message ChainKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChainKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChainKey message from the specified reader or buffer. + * @function decode + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SessionStructure.Chain.ChainKey} ChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChainKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SessionStructure.Chain.ChainKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChainKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SessionStructure.Chain.ChainKey} ChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChainKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChainKey message. + * @function verify + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChainKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!(message.key && typeof message.key.length === "number" || $util.isString(message.key))) + return "key: buffer expected"; + return null; + }; + + /** + * Creates a ChainKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {Object.} object Plain object + * @returns {proto.SessionStructure.Chain.ChainKey} ChainKey + */ + ChainKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SessionStructure.Chain.ChainKey) + return object; + var message = new $root.proto.SessionStructure.Chain.ChainKey(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.key != null) + if (typeof object.key === "string") + $util.base64.decode(object.key, message.key = $util.newBuffer($util.base64.length(object.key)), 0); + else if (object.key.length) + message.key = object.key; + return message; + }; + + /** + * Creates a plain object from a ChainKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SessionStructure.Chain.ChainKey + * @static + * @param {proto.SessionStructure.Chain.ChainKey} message ChainKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChainKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.index = 0; + if (options.bytes === String) + object.key = ""; + else { + object.key = []; + if (options.bytes !== Array) + object.key = $util.newBuffer(object.key); + } + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + if (message.key != null && message.hasOwnProperty("key")) + object.key = options.bytes === String ? $util.base64.encode(message.key, 0, message.key.length) : options.bytes === Array ? Array.prototype.slice.call(message.key) : message.key; + return object; + }; + + /** + * Converts this ChainKey to JSON. + * @function toJSON + * @memberof proto.SessionStructure.Chain.ChainKey + * @instance + * @returns {Object.} JSON object + */ + ChainKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ChainKey; + })(); + + Chain.MessageKey = (function() { + + /** + * Properties of a MessageKey. + * @memberof proto.SessionStructure.Chain + * @interface IMessageKey + * @property {number|null} [index] MessageKey index + * @property {Uint8Array|null} [cipherKey] MessageKey cipherKey + * @property {Uint8Array|null} [macKey] MessageKey macKey + * @property {Uint8Array|null} [iv] MessageKey iv + */ + + /** + * Constructs a new MessageKey. + * @memberof proto.SessionStructure.Chain + * @classdesc Represents a MessageKey. + * @implements IMessageKey + * @constructor + * @param {proto.SessionStructure.Chain.IMessageKey=} [properties] Properties to set + */ + function MessageKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageKey index. + * @member {number} index + * @memberof proto.SessionStructure.Chain.MessageKey + * @instance + */ + MessageKey.prototype.index = 0; + + /** + * MessageKey cipherKey. + * @member {Uint8Array} cipherKey + * @memberof proto.SessionStructure.Chain.MessageKey + * @instance + */ + MessageKey.prototype.cipherKey = $util.newBuffer([]); + + /** + * MessageKey macKey. + * @member {Uint8Array} macKey + * @memberof proto.SessionStructure.Chain.MessageKey + * @instance + */ + MessageKey.prototype.macKey = $util.newBuffer([]); + + /** + * MessageKey iv. + * @member {Uint8Array} iv + * @memberof proto.SessionStructure.Chain.MessageKey + * @instance + */ + MessageKey.prototype.iv = $util.newBuffer([]); + + /** + * Creates a new MessageKey instance using the specified properties. + * @function create + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {proto.SessionStructure.Chain.IMessageKey=} [properties] Properties to set + * @returns {proto.SessionStructure.Chain.MessageKey} MessageKey instance + */ + MessageKey.create = function create(properties) { + return new MessageKey(properties); + }; + + /** + * Encodes the specified MessageKey message. Does not implicitly {@link proto.SessionStructure.Chain.MessageKey.verify|verify} messages. + * @function encode + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {proto.SessionStructure.Chain.IMessageKey} message MessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.index); + if (message.cipherKey != null && Object.hasOwnProperty.call(message, "cipherKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.cipherKey); + if (message.macKey != null && Object.hasOwnProperty.call(message, "macKey")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.macKey); + if (message.iv != null && Object.hasOwnProperty.call(message, "iv")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.iv); + return writer; + }; + + /** + * Encodes the specified MessageKey message, length delimited. Does not implicitly {@link proto.SessionStructure.Chain.MessageKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {proto.SessionStructure.Chain.IMessageKey} message MessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageKey message from the specified reader or buffer. + * @function decode + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SessionStructure.Chain.MessageKey} MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SessionStructure.Chain.MessageKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.cipherKey = reader.bytes(); + break; + case 3: + message.macKey = reader.bytes(); + break; + case 4: + message.iv = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SessionStructure.Chain.MessageKey} MessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageKey message. + * @function verify + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.cipherKey != null && message.hasOwnProperty("cipherKey")) + if (!(message.cipherKey && typeof message.cipherKey.length === "number" || $util.isString(message.cipherKey))) + return "cipherKey: buffer expected"; + if (message.macKey != null && message.hasOwnProperty("macKey")) + if (!(message.macKey && typeof message.macKey.length === "number" || $util.isString(message.macKey))) + return "macKey: buffer expected"; + if (message.iv != null && message.hasOwnProperty("iv")) + if (!(message.iv && typeof message.iv.length === "number" || $util.isString(message.iv))) + return "iv: buffer expected"; + return null; + }; + + /** + * Creates a MessageKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {Object.} object Plain object + * @returns {proto.SessionStructure.Chain.MessageKey} MessageKey + */ + MessageKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SessionStructure.Chain.MessageKey) + return object; + var message = new $root.proto.SessionStructure.Chain.MessageKey(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.cipherKey != null) + if (typeof object.cipherKey === "string") + $util.base64.decode(object.cipherKey, message.cipherKey = $util.newBuffer($util.base64.length(object.cipherKey)), 0); + else if (object.cipherKey.length) + message.cipherKey = object.cipherKey; + if (object.macKey != null) + if (typeof object.macKey === "string") + $util.base64.decode(object.macKey, message.macKey = $util.newBuffer($util.base64.length(object.macKey)), 0); + else if (object.macKey.length) + message.macKey = object.macKey; + if (object.iv != null) + if (typeof object.iv === "string") + $util.base64.decode(object.iv, message.iv = $util.newBuffer($util.base64.length(object.iv)), 0); + else if (object.iv.length) + message.iv = object.iv; + return message; + }; + + /** + * Creates a plain object from a MessageKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SessionStructure.Chain.MessageKey + * @static + * @param {proto.SessionStructure.Chain.MessageKey} message MessageKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.index = 0; + if (options.bytes === String) + object.cipherKey = ""; + else { + object.cipherKey = []; + if (options.bytes !== Array) + object.cipherKey = $util.newBuffer(object.cipherKey); + } + if (options.bytes === String) + object.macKey = ""; + else { + object.macKey = []; + if (options.bytes !== Array) + object.macKey = $util.newBuffer(object.macKey); + } + if (options.bytes === String) + object.iv = ""; + else { + object.iv = []; + if (options.bytes !== Array) + object.iv = $util.newBuffer(object.iv); + } + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + if (message.cipherKey != null && message.hasOwnProperty("cipherKey")) + object.cipherKey = options.bytes === String ? $util.base64.encode(message.cipherKey, 0, message.cipherKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.cipherKey) : message.cipherKey; + if (message.macKey != null && message.hasOwnProperty("macKey")) + object.macKey = options.bytes === String ? $util.base64.encode(message.macKey, 0, message.macKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.macKey) : message.macKey; + if (message.iv != null && message.hasOwnProperty("iv")) + object.iv = options.bytes === String ? $util.base64.encode(message.iv, 0, message.iv.length) : options.bytes === Array ? Array.prototype.slice.call(message.iv) : message.iv; + return object; + }; + + /** + * Converts this MessageKey to JSON. + * @function toJSON + * @memberof proto.SessionStructure.Chain.MessageKey + * @instance + * @returns {Object.} JSON object + */ + MessageKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageKey; + })(); + + return Chain; + })(); + + SessionStructure.PendingKeyExchange = (function() { + + /** + * Properties of a PendingKeyExchange. + * @memberof proto.SessionStructure + * @interface IPendingKeyExchange + * @property {number|null} [sequence] PendingKeyExchange sequence + * @property {Uint8Array|null} [localBaseKey] PendingKeyExchange localBaseKey + * @property {Uint8Array|null} [localBaseKeyPrivate] PendingKeyExchange localBaseKeyPrivate + * @property {Uint8Array|null} [localRatchetKey] PendingKeyExchange localRatchetKey + * @property {Uint8Array|null} [localRatchetKeyPrivate] PendingKeyExchange localRatchetKeyPrivate + * @property {Uint8Array|null} [localIdentityKey] PendingKeyExchange localIdentityKey + * @property {Uint8Array|null} [localIdentityKeyPrivate] PendingKeyExchange localIdentityKeyPrivate + */ + + /** + * Constructs a new PendingKeyExchange. + * @memberof proto.SessionStructure + * @classdesc Represents a PendingKeyExchange. + * @implements IPendingKeyExchange + * @constructor + * @param {proto.SessionStructure.IPendingKeyExchange=} [properties] Properties to set + */ + function PendingKeyExchange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PendingKeyExchange sequence. + * @member {number} sequence + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.sequence = 0; + + /** + * PendingKeyExchange localBaseKey. + * @member {Uint8Array} localBaseKey + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.localBaseKey = $util.newBuffer([]); + + /** + * PendingKeyExchange localBaseKeyPrivate. + * @member {Uint8Array} localBaseKeyPrivate + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.localBaseKeyPrivate = $util.newBuffer([]); + + /** + * PendingKeyExchange localRatchetKey. + * @member {Uint8Array} localRatchetKey + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.localRatchetKey = $util.newBuffer([]); + + /** + * PendingKeyExchange localRatchetKeyPrivate. + * @member {Uint8Array} localRatchetKeyPrivate + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.localRatchetKeyPrivate = $util.newBuffer([]); + + /** + * PendingKeyExchange localIdentityKey. + * @member {Uint8Array} localIdentityKey + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.localIdentityKey = $util.newBuffer([]); + + /** + * PendingKeyExchange localIdentityKeyPrivate. + * @member {Uint8Array} localIdentityKeyPrivate + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + */ + PendingKeyExchange.prototype.localIdentityKeyPrivate = $util.newBuffer([]); + + /** + * Creates a new PendingKeyExchange instance using the specified properties. + * @function create + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {proto.SessionStructure.IPendingKeyExchange=} [properties] Properties to set + * @returns {proto.SessionStructure.PendingKeyExchange} PendingKeyExchange instance + */ + PendingKeyExchange.create = function create(properties) { + return new PendingKeyExchange(properties); + }; + + /** + * Encodes the specified PendingKeyExchange message. Does not implicitly {@link proto.SessionStructure.PendingKeyExchange.verify|verify} messages. + * @function encode + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {proto.SessionStructure.IPendingKeyExchange} message PendingKeyExchange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PendingKeyExchange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sequence != null && Object.hasOwnProperty.call(message, "sequence")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.sequence); + if (message.localBaseKey != null && Object.hasOwnProperty.call(message, "localBaseKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.localBaseKey); + if (message.localBaseKeyPrivate != null && Object.hasOwnProperty.call(message, "localBaseKeyPrivate")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.localBaseKeyPrivate); + if (message.localRatchetKey != null && Object.hasOwnProperty.call(message, "localRatchetKey")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.localRatchetKey); + if (message.localRatchetKeyPrivate != null && Object.hasOwnProperty.call(message, "localRatchetKeyPrivate")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.localRatchetKeyPrivate); + if (message.localIdentityKey != null && Object.hasOwnProperty.call(message, "localIdentityKey")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.localIdentityKey); + if (message.localIdentityKeyPrivate != null && Object.hasOwnProperty.call(message, "localIdentityKeyPrivate")) + writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.localIdentityKeyPrivate); + return writer; + }; + + /** + * Encodes the specified PendingKeyExchange message, length delimited. Does not implicitly {@link proto.SessionStructure.PendingKeyExchange.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {proto.SessionStructure.IPendingKeyExchange} message PendingKeyExchange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PendingKeyExchange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PendingKeyExchange message from the specified reader or buffer. + * @function decode + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SessionStructure.PendingKeyExchange} PendingKeyExchange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PendingKeyExchange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SessionStructure.PendingKeyExchange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint32(); + break; + case 2: + message.localBaseKey = reader.bytes(); + break; + case 3: + message.localBaseKeyPrivate = reader.bytes(); + break; + case 4: + message.localRatchetKey = reader.bytes(); + break; + case 5: + message.localRatchetKeyPrivate = reader.bytes(); + break; + case 7: + message.localIdentityKey = reader.bytes(); + break; + case 8: + message.localIdentityKeyPrivate = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PendingKeyExchange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SessionStructure.PendingKeyExchange} PendingKeyExchange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PendingKeyExchange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PendingKeyExchange message. + * @function verify + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PendingKeyExchange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sequence != null && message.hasOwnProperty("sequence")) + if (!$util.isInteger(message.sequence)) + return "sequence: integer expected"; + if (message.localBaseKey != null && message.hasOwnProperty("localBaseKey")) + if (!(message.localBaseKey && typeof message.localBaseKey.length === "number" || $util.isString(message.localBaseKey))) + return "localBaseKey: buffer expected"; + if (message.localBaseKeyPrivate != null && message.hasOwnProperty("localBaseKeyPrivate")) + if (!(message.localBaseKeyPrivate && typeof message.localBaseKeyPrivate.length === "number" || $util.isString(message.localBaseKeyPrivate))) + return "localBaseKeyPrivate: buffer expected"; + if (message.localRatchetKey != null && message.hasOwnProperty("localRatchetKey")) + if (!(message.localRatchetKey && typeof message.localRatchetKey.length === "number" || $util.isString(message.localRatchetKey))) + return "localRatchetKey: buffer expected"; + if (message.localRatchetKeyPrivate != null && message.hasOwnProperty("localRatchetKeyPrivate")) + if (!(message.localRatchetKeyPrivate && typeof message.localRatchetKeyPrivate.length === "number" || $util.isString(message.localRatchetKeyPrivate))) + return "localRatchetKeyPrivate: buffer expected"; + if (message.localIdentityKey != null && message.hasOwnProperty("localIdentityKey")) + if (!(message.localIdentityKey && typeof message.localIdentityKey.length === "number" || $util.isString(message.localIdentityKey))) + return "localIdentityKey: buffer expected"; + if (message.localIdentityKeyPrivate != null && message.hasOwnProperty("localIdentityKeyPrivate")) + if (!(message.localIdentityKeyPrivate && typeof message.localIdentityKeyPrivate.length === "number" || $util.isString(message.localIdentityKeyPrivate))) + return "localIdentityKeyPrivate: buffer expected"; + return null; + }; + + /** + * Creates a PendingKeyExchange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {Object.} object Plain object + * @returns {proto.SessionStructure.PendingKeyExchange} PendingKeyExchange + */ + PendingKeyExchange.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SessionStructure.PendingKeyExchange) + return object; + var message = new $root.proto.SessionStructure.PendingKeyExchange(); + if (object.sequence != null) + message.sequence = object.sequence >>> 0; + if (object.localBaseKey != null) + if (typeof object.localBaseKey === "string") + $util.base64.decode(object.localBaseKey, message.localBaseKey = $util.newBuffer($util.base64.length(object.localBaseKey)), 0); + else if (object.localBaseKey.length) + message.localBaseKey = object.localBaseKey; + if (object.localBaseKeyPrivate != null) + if (typeof object.localBaseKeyPrivate === "string") + $util.base64.decode(object.localBaseKeyPrivate, message.localBaseKeyPrivate = $util.newBuffer($util.base64.length(object.localBaseKeyPrivate)), 0); + else if (object.localBaseKeyPrivate.length) + message.localBaseKeyPrivate = object.localBaseKeyPrivate; + if (object.localRatchetKey != null) + if (typeof object.localRatchetKey === "string") + $util.base64.decode(object.localRatchetKey, message.localRatchetKey = $util.newBuffer($util.base64.length(object.localRatchetKey)), 0); + else if (object.localRatchetKey.length) + message.localRatchetKey = object.localRatchetKey; + if (object.localRatchetKeyPrivate != null) + if (typeof object.localRatchetKeyPrivate === "string") + $util.base64.decode(object.localRatchetKeyPrivate, message.localRatchetKeyPrivate = $util.newBuffer($util.base64.length(object.localRatchetKeyPrivate)), 0); + else if (object.localRatchetKeyPrivate.length) + message.localRatchetKeyPrivate = object.localRatchetKeyPrivate; + if (object.localIdentityKey != null) + if (typeof object.localIdentityKey === "string") + $util.base64.decode(object.localIdentityKey, message.localIdentityKey = $util.newBuffer($util.base64.length(object.localIdentityKey)), 0); + else if (object.localIdentityKey.length) + message.localIdentityKey = object.localIdentityKey; + if (object.localIdentityKeyPrivate != null) + if (typeof object.localIdentityKeyPrivate === "string") + $util.base64.decode(object.localIdentityKeyPrivate, message.localIdentityKeyPrivate = $util.newBuffer($util.base64.length(object.localIdentityKeyPrivate)), 0); + else if (object.localIdentityKeyPrivate.length) + message.localIdentityKeyPrivate = object.localIdentityKeyPrivate; + return message; + }; + + /** + * Creates a plain object from a PendingKeyExchange message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SessionStructure.PendingKeyExchange + * @static + * @param {proto.SessionStructure.PendingKeyExchange} message PendingKeyExchange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PendingKeyExchange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sequence = 0; + if (options.bytes === String) + object.localBaseKey = ""; + else { + object.localBaseKey = []; + if (options.bytes !== Array) + object.localBaseKey = $util.newBuffer(object.localBaseKey); + } + if (options.bytes === String) + object.localBaseKeyPrivate = ""; + else { + object.localBaseKeyPrivate = []; + if (options.bytes !== Array) + object.localBaseKeyPrivate = $util.newBuffer(object.localBaseKeyPrivate); + } + if (options.bytes === String) + object.localRatchetKey = ""; + else { + object.localRatchetKey = []; + if (options.bytes !== Array) + object.localRatchetKey = $util.newBuffer(object.localRatchetKey); + } + if (options.bytes === String) + object.localRatchetKeyPrivate = ""; + else { + object.localRatchetKeyPrivate = []; + if (options.bytes !== Array) + object.localRatchetKeyPrivate = $util.newBuffer(object.localRatchetKeyPrivate); + } + if (options.bytes === String) + object.localIdentityKey = ""; + else { + object.localIdentityKey = []; + if (options.bytes !== Array) + object.localIdentityKey = $util.newBuffer(object.localIdentityKey); + } + if (options.bytes === String) + object.localIdentityKeyPrivate = ""; + else { + object.localIdentityKeyPrivate = []; + if (options.bytes !== Array) + object.localIdentityKeyPrivate = $util.newBuffer(object.localIdentityKeyPrivate); + } + } + if (message.sequence != null && message.hasOwnProperty("sequence")) + object.sequence = message.sequence; + if (message.localBaseKey != null && message.hasOwnProperty("localBaseKey")) + object.localBaseKey = options.bytes === String ? $util.base64.encode(message.localBaseKey, 0, message.localBaseKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.localBaseKey) : message.localBaseKey; + if (message.localBaseKeyPrivate != null && message.hasOwnProperty("localBaseKeyPrivate")) + object.localBaseKeyPrivate = options.bytes === String ? $util.base64.encode(message.localBaseKeyPrivate, 0, message.localBaseKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.localBaseKeyPrivate) : message.localBaseKeyPrivate; + if (message.localRatchetKey != null && message.hasOwnProperty("localRatchetKey")) + object.localRatchetKey = options.bytes === String ? $util.base64.encode(message.localRatchetKey, 0, message.localRatchetKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.localRatchetKey) : message.localRatchetKey; + if (message.localRatchetKeyPrivate != null && message.hasOwnProperty("localRatchetKeyPrivate")) + object.localRatchetKeyPrivate = options.bytes === String ? $util.base64.encode(message.localRatchetKeyPrivate, 0, message.localRatchetKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.localRatchetKeyPrivate) : message.localRatchetKeyPrivate; + if (message.localIdentityKey != null && message.hasOwnProperty("localIdentityKey")) + object.localIdentityKey = options.bytes === String ? $util.base64.encode(message.localIdentityKey, 0, message.localIdentityKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.localIdentityKey) : message.localIdentityKey; + if (message.localIdentityKeyPrivate != null && message.hasOwnProperty("localIdentityKeyPrivate")) + object.localIdentityKeyPrivate = options.bytes === String ? $util.base64.encode(message.localIdentityKeyPrivate, 0, message.localIdentityKeyPrivate.length) : options.bytes === Array ? Array.prototype.slice.call(message.localIdentityKeyPrivate) : message.localIdentityKeyPrivate; + return object; + }; + + /** + * Converts this PendingKeyExchange to JSON. + * @function toJSON + * @memberof proto.SessionStructure.PendingKeyExchange + * @instance + * @returns {Object.} JSON object + */ + PendingKeyExchange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PendingKeyExchange; + })(); + + SessionStructure.PendingPreKey = (function() { + + /** + * Properties of a PendingPreKey. + * @memberof proto.SessionStructure + * @interface IPendingPreKey + * @property {number|null} [preKeyId] PendingPreKey preKeyId + * @property {number|null} [signedPreKeyId] PendingPreKey signedPreKeyId + * @property {Uint8Array|null} [baseKey] PendingPreKey baseKey + */ + + /** + * Constructs a new PendingPreKey. + * @memberof proto.SessionStructure + * @classdesc Represents a PendingPreKey. + * @implements IPendingPreKey + * @constructor + * @param {proto.SessionStructure.IPendingPreKey=} [properties] Properties to set + */ + function PendingPreKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PendingPreKey preKeyId. + * @member {number} preKeyId + * @memberof proto.SessionStructure.PendingPreKey + * @instance + */ + PendingPreKey.prototype.preKeyId = 0; + + /** + * PendingPreKey signedPreKeyId. + * @member {number} signedPreKeyId + * @memberof proto.SessionStructure.PendingPreKey + * @instance + */ + PendingPreKey.prototype.signedPreKeyId = 0; + + /** + * PendingPreKey baseKey. + * @member {Uint8Array} baseKey + * @memberof proto.SessionStructure.PendingPreKey + * @instance + */ + PendingPreKey.prototype.baseKey = $util.newBuffer([]); + + /** + * Creates a new PendingPreKey instance using the specified properties. + * @function create + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {proto.SessionStructure.IPendingPreKey=} [properties] Properties to set + * @returns {proto.SessionStructure.PendingPreKey} PendingPreKey instance + */ + PendingPreKey.create = function create(properties) { + return new PendingPreKey(properties); + }; + + /** + * Encodes the specified PendingPreKey message. Does not implicitly {@link proto.SessionStructure.PendingPreKey.verify|verify} messages. + * @function encode + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {proto.SessionStructure.IPendingPreKey} message PendingPreKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PendingPreKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.preKeyId != null && Object.hasOwnProperty.call(message, "preKeyId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.preKeyId); + if (message.baseKey != null && Object.hasOwnProperty.call(message, "baseKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.baseKey); + if (message.signedPreKeyId != null && Object.hasOwnProperty.call(message, "signedPreKeyId")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.signedPreKeyId); + return writer; + }; + + /** + * Encodes the specified PendingPreKey message, length delimited. Does not implicitly {@link proto.SessionStructure.PendingPreKey.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {proto.SessionStructure.IPendingPreKey} message PendingPreKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PendingPreKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PendingPreKey message from the specified reader or buffer. + * @function decode + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SessionStructure.PendingPreKey} PendingPreKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PendingPreKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SessionStructure.PendingPreKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.preKeyId = reader.uint32(); + break; + case 3: + message.signedPreKeyId = reader.int32(); + break; + case 2: + message.baseKey = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PendingPreKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SessionStructure.PendingPreKey} PendingPreKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PendingPreKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PendingPreKey message. + * @function verify + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PendingPreKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.preKeyId != null && message.hasOwnProperty("preKeyId")) + if (!$util.isInteger(message.preKeyId)) + return "preKeyId: integer expected"; + if (message.signedPreKeyId != null && message.hasOwnProperty("signedPreKeyId")) + if (!$util.isInteger(message.signedPreKeyId)) + return "signedPreKeyId: integer expected"; + if (message.baseKey != null && message.hasOwnProperty("baseKey")) + if (!(message.baseKey && typeof message.baseKey.length === "number" || $util.isString(message.baseKey))) + return "baseKey: buffer expected"; + return null; + }; + + /** + * Creates a PendingPreKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {Object.} object Plain object + * @returns {proto.SessionStructure.PendingPreKey} PendingPreKey + */ + PendingPreKey.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SessionStructure.PendingPreKey) + return object; + var message = new $root.proto.SessionStructure.PendingPreKey(); + if (object.preKeyId != null) + message.preKeyId = object.preKeyId >>> 0; + if (object.signedPreKeyId != null) + message.signedPreKeyId = object.signedPreKeyId | 0; + if (object.baseKey != null) + if (typeof object.baseKey === "string") + $util.base64.decode(object.baseKey, message.baseKey = $util.newBuffer($util.base64.length(object.baseKey)), 0); + else if (object.baseKey.length) + message.baseKey = object.baseKey; + return message; + }; + + /** + * Creates a plain object from a PendingPreKey message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SessionStructure.PendingPreKey + * @static + * @param {proto.SessionStructure.PendingPreKey} message PendingPreKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PendingPreKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.preKeyId = 0; + if (options.bytes === String) + object.baseKey = ""; + else { + object.baseKey = []; + if (options.bytes !== Array) + object.baseKey = $util.newBuffer(object.baseKey); + } + object.signedPreKeyId = 0; + } + if (message.preKeyId != null && message.hasOwnProperty("preKeyId")) + object.preKeyId = message.preKeyId; + if (message.baseKey != null && message.hasOwnProperty("baseKey")) + object.baseKey = options.bytes === String ? $util.base64.encode(message.baseKey, 0, message.baseKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.baseKey) : message.baseKey; + if (message.signedPreKeyId != null && message.hasOwnProperty("signedPreKeyId")) + object.signedPreKeyId = message.signedPreKeyId; + return object; + }; + + /** + * Converts this PendingPreKey to JSON. + * @function toJSON + * @memberof proto.SessionStructure.PendingPreKey + * @instance + * @returns {Object.} JSON object + */ + PendingPreKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PendingPreKey; + })(); + + return SessionStructure; + })(); + + proto.SignedPreKeyRecordStructure = (function() { + + /** + * Properties of a SignedPreKeyRecordStructure. + * @memberof proto + * @interface ISignedPreKeyRecordStructure + * @property {number|null} [id] SignedPreKeyRecordStructure id + * @property {Uint8Array|null} [publicKey] SignedPreKeyRecordStructure publicKey + * @property {Uint8Array|null} [privateKey] SignedPreKeyRecordStructure privateKey + * @property {Uint8Array|null} [signature] SignedPreKeyRecordStructure signature + * @property {number|Long|null} [timestamp] SignedPreKeyRecordStructure timestamp + */ + + /** + * Constructs a new SignedPreKeyRecordStructure. + * @memberof proto + * @classdesc Represents a SignedPreKeyRecordStructure. + * @implements ISignedPreKeyRecordStructure + * @constructor + * @param {proto.ISignedPreKeyRecordStructure=} [properties] Properties to set + */ + function SignedPreKeyRecordStructure(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SignedPreKeyRecordStructure id. + * @member {number} id + * @memberof proto.SignedPreKeyRecordStructure + * @instance + */ + SignedPreKeyRecordStructure.prototype.id = 0; + + /** + * SignedPreKeyRecordStructure publicKey. + * @member {Uint8Array} publicKey + * @memberof proto.SignedPreKeyRecordStructure + * @instance + */ + SignedPreKeyRecordStructure.prototype.publicKey = $util.newBuffer([]); + + /** + * SignedPreKeyRecordStructure privateKey. + * @member {Uint8Array} privateKey + * @memberof proto.SignedPreKeyRecordStructure + * @instance + */ + SignedPreKeyRecordStructure.prototype.privateKey = $util.newBuffer([]); + + /** + * SignedPreKeyRecordStructure signature. + * @member {Uint8Array} signature + * @memberof proto.SignedPreKeyRecordStructure + * @instance + */ + SignedPreKeyRecordStructure.prototype.signature = $util.newBuffer([]); + + /** + * SignedPreKeyRecordStructure timestamp. + * @member {number|Long} timestamp + * @memberof proto.SignedPreKeyRecordStructure + * @instance + */ + SignedPreKeyRecordStructure.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new SignedPreKeyRecordStructure instance using the specified properties. + * @function create + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {proto.ISignedPreKeyRecordStructure=} [properties] Properties to set + * @returns {proto.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure instance + */ + SignedPreKeyRecordStructure.create = function create(properties) { + return new SignedPreKeyRecordStructure(properties); + }; + + /** + * Encodes the specified SignedPreKeyRecordStructure message. Does not implicitly {@link proto.SignedPreKeyRecordStructure.verify|verify} messages. + * @function encode + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {proto.ISignedPreKeyRecordStructure} message SignedPreKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignedPreKeyRecordStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.id); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.publicKey); + if (message.privateKey != null && Object.hasOwnProperty.call(message, "privateKey")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.privateKey); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.signature); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 5, wireType 1 =*/41).fixed64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified SignedPreKeyRecordStructure message, length delimited. Does not implicitly {@link proto.SignedPreKeyRecordStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {proto.ISignedPreKeyRecordStructure} message SignedPreKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignedPreKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SignedPreKeyRecordStructure message from the specified reader or buffer. + * @function decode + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignedPreKeyRecordStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SignedPreKeyRecordStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.publicKey = reader.bytes(); + break; + case 3: + message.privateKey = reader.bytes(); + break; + case 4: + message.signature = reader.bytes(); + break; + case 5: + message.timestamp = reader.fixed64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SignedPreKeyRecordStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignedPreKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SignedPreKeyRecordStructure message. + * @function verify + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignedPreKeyRecordStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!(message.publicKey && typeof message.publicKey.length === "number" || $util.isString(message.publicKey))) + return "publicKey: buffer expected"; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + if (!(message.privateKey && typeof message.privateKey.length === "number" || $util.isString(message.privateKey))) + return "privateKey: buffer expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a SignedPreKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {Object.} object Plain object + * @returns {proto.SignedPreKeyRecordStructure} SignedPreKeyRecordStructure + */ + SignedPreKeyRecordStructure.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SignedPreKeyRecordStructure) + return object; + var message = new $root.proto.SignedPreKeyRecordStructure(); + if (object.id != null) + message.id = object.id >>> 0; + if (object.publicKey != null) + if (typeof object.publicKey === "string") + $util.base64.decode(object.publicKey, message.publicKey = $util.newBuffer($util.base64.length(object.publicKey)), 0); + else if (object.publicKey.length) + message.publicKey = object.publicKey; + if (object.privateKey != null) + if (typeof object.privateKey === "string") + $util.base64.decode(object.privateKey, message.privateKey = $util.newBuffer($util.base64.length(object.privateKey)), 0); + else if (object.privateKey.length) + message.privateKey = object.privateKey; + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a SignedPreKeyRecordStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SignedPreKeyRecordStructure + * @static + * @param {proto.SignedPreKeyRecordStructure} message SignedPreKeyRecordStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SignedPreKeyRecordStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = 0; + if (options.bytes === String) + object.publicKey = ""; + else { + object.publicKey = []; + if (options.bytes !== Array) + object.publicKey = $util.newBuffer(object.publicKey); + } + if (options.bytes === String) + object.privateKey = ""; + else { + object.privateKey = []; + if (options.bytes !== Array) + object.privateKey = $util.newBuffer(object.privateKey); + } + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = options.bytes === String ? $util.base64.encode(message.publicKey, 0, message.publicKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.publicKey) : message.publicKey; + if (message.privateKey != null && message.hasOwnProperty("privateKey")) + object.privateKey = options.bytes === String ? $util.base64.encode(message.privateKey, 0, message.privateKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.privateKey) : message.privateKey; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + return object; + }; + + /** + * Converts this SignedPreKeyRecordStructure to JSON. + * @function toJSON + * @memberof proto.SignedPreKeyRecordStructure + * @instance + * @returns {Object.} JSON object + */ + SignedPreKeyRecordStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SignedPreKeyRecordStructure; + })(); + + proto.StatusPSA = (function() { + + /** + * Properties of a StatusPSA. + * @memberof proto + * @interface IStatusPSA + * @property {number|Long} campaignId StatusPSA campaignId + * @property {number|Long|null} [campaignExpirationTimestamp] StatusPSA campaignExpirationTimestamp + */ + + /** + * Constructs a new StatusPSA. + * @memberof proto + * @classdesc Represents a StatusPSA. + * @implements IStatusPSA + * @constructor + * @param {proto.IStatusPSA=} [properties] Properties to set + */ + function StatusPSA(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StatusPSA campaignId. + * @member {number|Long} campaignId + * @memberof proto.StatusPSA + * @instance + */ + StatusPSA.prototype.campaignId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * StatusPSA campaignExpirationTimestamp. + * @member {number|Long} campaignExpirationTimestamp + * @memberof proto.StatusPSA + * @instance + */ + StatusPSA.prototype.campaignExpirationTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new StatusPSA instance using the specified properties. + * @function create + * @memberof proto.StatusPSA + * @static + * @param {proto.IStatusPSA=} [properties] Properties to set + * @returns {proto.StatusPSA} StatusPSA instance + */ + StatusPSA.create = function create(properties) { + return new StatusPSA(properties); + }; + + /** + * Encodes the specified StatusPSA message. Does not implicitly {@link proto.StatusPSA.verify|verify} messages. + * @function encode + * @memberof proto.StatusPSA + * @static + * @param {proto.IStatusPSA} message StatusPSA message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StatusPSA.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 44, wireType 0 =*/352).uint64(message.campaignId); + if (message.campaignExpirationTimestamp != null && Object.hasOwnProperty.call(message, "campaignExpirationTimestamp")) + writer.uint32(/* id 45, wireType 0 =*/360).uint64(message.campaignExpirationTimestamp); + return writer; + }; + + /** + * Encodes the specified StatusPSA message, length delimited. Does not implicitly {@link proto.StatusPSA.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.StatusPSA + * @static + * @param {proto.IStatusPSA} message StatusPSA message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StatusPSA.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StatusPSA message from the specified reader or buffer. + * @function decode + * @memberof proto.StatusPSA + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.StatusPSA} StatusPSA + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StatusPSA.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.StatusPSA(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 44: + message.campaignId = reader.uint64(); + break; + case 45: + message.campaignExpirationTimestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("campaignId")) + throw $util.ProtocolError("missing required 'campaignId'", { instance: message }); + return message; + }; + + /** + * Decodes a StatusPSA message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.StatusPSA + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.StatusPSA} StatusPSA + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StatusPSA.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StatusPSA message. + * @function verify + * @memberof proto.StatusPSA + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StatusPSA.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isInteger(message.campaignId) && !(message.campaignId && $util.isInteger(message.campaignId.low) && $util.isInteger(message.campaignId.high))) + return "campaignId: integer|Long expected"; + if (message.campaignExpirationTimestamp != null && message.hasOwnProperty("campaignExpirationTimestamp")) + if (!$util.isInteger(message.campaignExpirationTimestamp) && !(message.campaignExpirationTimestamp && $util.isInteger(message.campaignExpirationTimestamp.low) && $util.isInteger(message.campaignExpirationTimestamp.high))) + return "campaignExpirationTimestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a StatusPSA message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.StatusPSA + * @static + * @param {Object.} object Plain object + * @returns {proto.StatusPSA} StatusPSA + */ + StatusPSA.fromObject = function fromObject(object) { + if (object instanceof $root.proto.StatusPSA) + return object; + var message = new $root.proto.StatusPSA(); + if (object.campaignId != null) + if ($util.Long) + (message.campaignId = $util.Long.fromValue(object.campaignId)).unsigned = true; + else if (typeof object.campaignId === "string") + message.campaignId = parseInt(object.campaignId, 10); + else if (typeof object.campaignId === "number") + message.campaignId = object.campaignId; + else if (typeof object.campaignId === "object") + message.campaignId = new $util.LongBits(object.campaignId.low >>> 0, object.campaignId.high >>> 0).toNumber(true); + if (object.campaignExpirationTimestamp != null) + if ($util.Long) + (message.campaignExpirationTimestamp = $util.Long.fromValue(object.campaignExpirationTimestamp)).unsigned = true; + else if (typeof object.campaignExpirationTimestamp === "string") + message.campaignExpirationTimestamp = parseInt(object.campaignExpirationTimestamp, 10); + else if (typeof object.campaignExpirationTimestamp === "number") + message.campaignExpirationTimestamp = object.campaignExpirationTimestamp; + else if (typeof object.campaignExpirationTimestamp === "object") + message.campaignExpirationTimestamp = new $util.LongBits(object.campaignExpirationTimestamp.low >>> 0, object.campaignExpirationTimestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a StatusPSA message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.StatusPSA + * @static + * @param {proto.StatusPSA} message StatusPSA + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StatusPSA.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.campaignId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.campaignId = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.campaignExpirationTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.campaignExpirationTimestamp = options.longs === String ? "0" : 0; + } + if (message.campaignId != null && message.hasOwnProperty("campaignId")) + if (typeof message.campaignId === "number") + object.campaignId = options.longs === String ? String(message.campaignId) : message.campaignId; + else + object.campaignId = options.longs === String ? $util.Long.prototype.toString.call(message.campaignId) : options.longs === Number ? new $util.LongBits(message.campaignId.low >>> 0, message.campaignId.high >>> 0).toNumber(true) : message.campaignId; + if (message.campaignExpirationTimestamp != null && message.hasOwnProperty("campaignExpirationTimestamp")) + if (typeof message.campaignExpirationTimestamp === "number") + object.campaignExpirationTimestamp = options.longs === String ? String(message.campaignExpirationTimestamp) : message.campaignExpirationTimestamp; + else + object.campaignExpirationTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.campaignExpirationTimestamp) : options.longs === Number ? new $util.LongBits(message.campaignExpirationTimestamp.low >>> 0, message.campaignExpirationTimestamp.high >>> 0).toNumber(true) : message.campaignExpirationTimestamp; + return object; + }; + + /** + * Converts this StatusPSA to JSON. + * @function toJSON + * @memberof proto.StatusPSA + * @instance + * @returns {Object.} JSON object + */ + StatusPSA.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StatusPSA; + })(); + + proto.StickerMetadata = (function() { + + /** + * Properties of a StickerMetadata. + * @memberof proto + * @interface IStickerMetadata + * @property {string|null} [url] StickerMetadata url + * @property {Uint8Array|null} [fileSha256] StickerMetadata fileSha256 + * @property {Uint8Array|null} [fileEncSha256] StickerMetadata fileEncSha256 + * @property {Uint8Array|null} [mediaKey] StickerMetadata mediaKey + * @property {string|null} [mimetype] StickerMetadata mimetype + * @property {number|null} [height] StickerMetadata height + * @property {number|null} [width] StickerMetadata width + * @property {string|null} [directPath] StickerMetadata directPath + * @property {number|Long|null} [fileLength] StickerMetadata fileLength + * @property {number|null} [weight] StickerMetadata weight + * @property {number|Long|null} [lastStickerSentTs] StickerMetadata lastStickerSentTs + */ + + /** + * Constructs a new StickerMetadata. + * @memberof proto + * @classdesc Represents a StickerMetadata. + * @implements IStickerMetadata + * @constructor + * @param {proto.IStickerMetadata=} [properties] Properties to set + */ + function StickerMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StickerMetadata url. + * @member {string} url + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.url = ""; + + /** + * StickerMetadata fileSha256. + * @member {Uint8Array} fileSha256 + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.fileSha256 = $util.newBuffer([]); + + /** + * StickerMetadata fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * StickerMetadata mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.mediaKey = $util.newBuffer([]); + + /** + * StickerMetadata mimetype. + * @member {string} mimetype + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.mimetype = ""; + + /** + * StickerMetadata height. + * @member {number} height + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.height = 0; + + /** + * StickerMetadata width. + * @member {number} width + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.width = 0; + + /** + * StickerMetadata directPath. + * @member {string} directPath + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.directPath = ""; + + /** + * StickerMetadata fileLength. + * @member {number|Long} fileLength + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * StickerMetadata weight. + * @member {number} weight + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.weight = 0; + + /** + * StickerMetadata lastStickerSentTs. + * @member {number|Long} lastStickerSentTs + * @memberof proto.StickerMetadata + * @instance + */ + StickerMetadata.prototype.lastStickerSentTs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new StickerMetadata instance using the specified properties. + * @function create + * @memberof proto.StickerMetadata + * @static + * @param {proto.IStickerMetadata=} [properties] Properties to set + * @returns {proto.StickerMetadata} StickerMetadata instance + */ + StickerMetadata.create = function create(properties) { + return new StickerMetadata(properties); + }; + + /** + * Encodes the specified StickerMetadata message. Does not implicitly {@link proto.StickerMetadata.verify|verify} messages. + * @function encode + * @memberof proto.StickerMetadata + * @static + * @param {proto.IStickerMetadata} message StickerMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.fileSha256 != null && Object.hasOwnProperty.call(message, "fileSha256")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.fileSha256); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.fileEncSha256); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.mediaKey); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.mimetype); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 7, wireType 0 =*/56).uint32(message.width); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.directPath); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 9, wireType 0 =*/72).uint64(message.fileLength); + if (message.weight != null && Object.hasOwnProperty.call(message, "weight")) + writer.uint32(/* id 10, wireType 5 =*/85).float(message.weight); + if (message.lastStickerSentTs != null && Object.hasOwnProperty.call(message, "lastStickerSentTs")) + writer.uint32(/* id 11, wireType 0 =*/88).int64(message.lastStickerSentTs); + return writer; + }; + + /** + * Encodes the specified StickerMetadata message, length delimited. Does not implicitly {@link proto.StickerMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.StickerMetadata + * @static + * @param {proto.IStickerMetadata} message StickerMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StickerMetadata message from the specified reader or buffer. + * @function decode + * @memberof proto.StickerMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.StickerMetadata} StickerMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.StickerMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.fileSha256 = reader.bytes(); + break; + case 3: + message.fileEncSha256 = reader.bytes(); + break; + case 4: + message.mediaKey = reader.bytes(); + break; + case 5: + message.mimetype = reader.string(); + break; + case 6: + message.height = reader.uint32(); + break; + case 7: + message.width = reader.uint32(); + break; + case 8: + message.directPath = reader.string(); + break; + case 9: + message.fileLength = reader.uint64(); + break; + case 10: + message.weight = reader.float(); + break; + case 11: + message.lastStickerSentTs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StickerMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.StickerMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.StickerMetadata} StickerMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StickerMetadata message. + * @function verify + * @memberof proto.StickerMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StickerMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + if (!(message.fileSha256 && typeof message.fileSha256.length === "number" || $util.isString(message.fileSha256))) + return "fileSha256: buffer expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.weight != null && message.hasOwnProperty("weight")) + if (typeof message.weight !== "number") + return "weight: number expected"; + if (message.lastStickerSentTs != null && message.hasOwnProperty("lastStickerSentTs")) + if (!$util.isInteger(message.lastStickerSentTs) && !(message.lastStickerSentTs && $util.isInteger(message.lastStickerSentTs.low) && $util.isInteger(message.lastStickerSentTs.high))) + return "lastStickerSentTs: integer|Long expected"; + return null; + }; + + /** + * Creates a StickerMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.StickerMetadata + * @static + * @param {Object.} object Plain object + * @returns {proto.StickerMetadata} StickerMetadata + */ + StickerMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.proto.StickerMetadata) + return object; + var message = new $root.proto.StickerMetadata(); + if (object.url != null) + message.url = String(object.url); + if (object.fileSha256 != null) + if (typeof object.fileSha256 === "string") + $util.base64.decode(object.fileSha256, message.fileSha256 = $util.newBuffer($util.base64.length(object.fileSha256)), 0); + else if (object.fileSha256.length) + message.fileSha256 = object.fileSha256; + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.height != null) + message.height = object.height >>> 0; + if (object.width != null) + message.width = object.width >>> 0; + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.weight != null) + message.weight = Number(object.weight); + if (object.lastStickerSentTs != null) + if ($util.Long) + (message.lastStickerSentTs = $util.Long.fromValue(object.lastStickerSentTs)).unsigned = false; + else if (typeof object.lastStickerSentTs === "string") + message.lastStickerSentTs = parseInt(object.lastStickerSentTs, 10); + else if (typeof object.lastStickerSentTs === "number") + message.lastStickerSentTs = object.lastStickerSentTs; + else if (typeof object.lastStickerSentTs === "object") + message.lastStickerSentTs = new $util.LongBits(object.lastStickerSentTs.low >>> 0, object.lastStickerSentTs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a StickerMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.StickerMetadata + * @static + * @param {proto.StickerMetadata} message StickerMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StickerMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + if (options.bytes === String) + object.fileSha256 = ""; + else { + object.fileSha256 = []; + if (options.bytes !== Array) + object.fileSha256 = $util.newBuffer(object.fileSha256); + } + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + object.mimetype = ""; + object.height = 0; + object.width = 0; + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.weight = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastStickerSentTs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastStickerSentTs = options.longs === String ? "0" : 0; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.fileSha256 != null && message.hasOwnProperty("fileSha256")) + object.fileSha256 = options.bytes === String ? $util.base64.encode(message.fileSha256, 0, message.fileSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileSha256) : message.fileSha256; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.weight != null && message.hasOwnProperty("weight")) + object.weight = options.json && !isFinite(message.weight) ? String(message.weight) : message.weight; + if (message.lastStickerSentTs != null && message.hasOwnProperty("lastStickerSentTs")) + if (typeof message.lastStickerSentTs === "number") + object.lastStickerSentTs = options.longs === String ? String(message.lastStickerSentTs) : message.lastStickerSentTs; + else + object.lastStickerSentTs = options.longs === String ? $util.Long.prototype.toString.call(message.lastStickerSentTs) : options.longs === Number ? new $util.LongBits(message.lastStickerSentTs.low >>> 0, message.lastStickerSentTs.high >>> 0).toNumber() : message.lastStickerSentTs; + return object; + }; + + /** + * Converts this StickerMetadata to JSON. + * @function toJSON + * @memberof proto.StickerMetadata + * @instance + * @returns {Object.} JSON object + */ + StickerMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StickerMetadata; + })(); + + proto.SyncActionData = (function() { + + /** + * Properties of a SyncActionData. + * @memberof proto + * @interface ISyncActionData + * @property {Uint8Array|null} [index] SyncActionData index + * @property {proto.ISyncActionValue|null} [value] SyncActionData value + * @property {Uint8Array|null} [padding] SyncActionData padding + * @property {number|null} [version] SyncActionData version + */ + + /** + * Constructs a new SyncActionData. + * @memberof proto + * @classdesc Represents a SyncActionData. + * @implements ISyncActionData + * @constructor + * @param {proto.ISyncActionData=} [properties] Properties to set + */ + function SyncActionData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncActionData index. + * @member {Uint8Array} index + * @memberof proto.SyncActionData + * @instance + */ + SyncActionData.prototype.index = $util.newBuffer([]); + + /** + * SyncActionData value. + * @member {proto.ISyncActionValue|null|undefined} value + * @memberof proto.SyncActionData + * @instance + */ + SyncActionData.prototype.value = null; + + /** + * SyncActionData padding. + * @member {Uint8Array} padding + * @memberof proto.SyncActionData + * @instance + */ + SyncActionData.prototype.padding = $util.newBuffer([]); + + /** + * SyncActionData version. + * @member {number} version + * @memberof proto.SyncActionData + * @instance + */ + SyncActionData.prototype.version = 0; + + /** + * Creates a new SyncActionData instance using the specified properties. + * @function create + * @memberof proto.SyncActionData + * @static + * @param {proto.ISyncActionData=} [properties] Properties to set + * @returns {proto.SyncActionData} SyncActionData instance + */ + SyncActionData.create = function create(properties) { + return new SyncActionData(properties); + }; + + /** + * Encodes the specified SyncActionData message. Does not implicitly {@link proto.SyncActionData.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionData + * @static + * @param {proto.ISyncActionData} message SyncActionData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.index); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.proto.SyncActionValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.padding != null && Object.hasOwnProperty.call(message, "padding")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.padding); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.version); + return writer; + }; + + /** + * Encodes the specified SyncActionData message, length delimited. Does not implicitly {@link proto.SyncActionData.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionData + * @static + * @param {proto.ISyncActionData} message SyncActionData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncActionData message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionData} SyncActionData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.bytes(); + break; + case 2: + message.value = $root.proto.SyncActionValue.decode(reader, reader.uint32()); + break; + case 3: + message.padding = reader.bytes(); + break; + case 4: + message.version = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncActionData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionData} SyncActionData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncActionData message. + * @function verify + * @memberof proto.SyncActionData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncActionData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!(message.index && typeof message.index.length === "number" || $util.isString(message.index))) + return "index: buffer expected"; + if (message.value != null && message.hasOwnProperty("value")) { + var error = $root.proto.SyncActionValue.verify(message.value); + if (error) + return "value." + error; + } + if (message.padding != null && message.hasOwnProperty("padding")) + if (!(message.padding && typeof message.padding.length === "number" || $util.isString(message.padding))) + return "padding: buffer expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; + return null; + }; + + /** + * Creates a SyncActionData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionData + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionData} SyncActionData + */ + SyncActionData.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionData) + return object; + var message = new $root.proto.SyncActionData(); + if (object.index != null) + if (typeof object.index === "string") + $util.base64.decode(object.index, message.index = $util.newBuffer($util.base64.length(object.index)), 0); + else if (object.index.length) + message.index = object.index; + if (object.value != null) { + if (typeof object.value !== "object") + throw TypeError(".proto.SyncActionData.value: object expected"); + message.value = $root.proto.SyncActionValue.fromObject(object.value); + } + if (object.padding != null) + if (typeof object.padding === "string") + $util.base64.decode(object.padding, message.padding = $util.newBuffer($util.base64.length(object.padding)), 0); + else if (object.padding.length) + message.padding = object.padding; + if (object.version != null) + message.version = object.version | 0; + return message; + }; + + /** + * Creates a plain object from a SyncActionData message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionData + * @static + * @param {proto.SyncActionData} message SyncActionData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncActionData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.index = ""; + else { + object.index = []; + if (options.bytes !== Array) + object.index = $util.newBuffer(object.index); + } + object.value = null; + if (options.bytes === String) + object.padding = ""; + else { + object.padding = []; + if (options.bytes !== Array) + object.padding = $util.newBuffer(object.padding); + } + object.version = 0; + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = options.bytes === String ? $util.base64.encode(message.index, 0, message.index.length) : options.bytes === Array ? Array.prototype.slice.call(message.index) : message.index; + if (message.value != null && message.hasOwnProperty("value")) + object.value = $root.proto.SyncActionValue.toObject(message.value, options); + if (message.padding != null && message.hasOwnProperty("padding")) + object.padding = options.bytes === String ? $util.base64.encode(message.padding, 0, message.padding.length) : options.bytes === Array ? Array.prototype.slice.call(message.padding) : message.padding; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this SyncActionData to JSON. + * @function toJSON + * @memberof proto.SyncActionData + * @instance + * @returns {Object.} JSON object + */ + SyncActionData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncActionData; + })(); + + proto.SyncActionValue = (function() { + + /** + * Properties of a SyncActionValue. + * @memberof proto + * @interface ISyncActionValue + * @property {number|Long|null} [timestamp] SyncActionValue timestamp + * @property {proto.SyncActionValue.IStarAction|null} [starAction] SyncActionValue starAction + * @property {proto.SyncActionValue.IContactAction|null} [contactAction] SyncActionValue contactAction + * @property {proto.SyncActionValue.IMuteAction|null} [muteAction] SyncActionValue muteAction + * @property {proto.SyncActionValue.IPinAction|null} [pinAction] SyncActionValue pinAction + * @property {proto.SyncActionValue.ISecurityNotificationSetting|null} [securityNotificationSetting] SyncActionValue securityNotificationSetting + * @property {proto.SyncActionValue.IPushNameSetting|null} [pushNameSetting] SyncActionValue pushNameSetting + * @property {proto.SyncActionValue.IQuickReplyAction|null} [quickReplyAction] SyncActionValue quickReplyAction + * @property {proto.SyncActionValue.IRecentEmojiWeightsAction|null} [recentEmojiWeightsAction] SyncActionValue recentEmojiWeightsAction + * @property {proto.SyncActionValue.ILabelEditAction|null} [labelEditAction] SyncActionValue labelEditAction + * @property {proto.SyncActionValue.ILabelAssociationAction|null} [labelAssociationAction] SyncActionValue labelAssociationAction + * @property {proto.SyncActionValue.ILocaleSetting|null} [localeSetting] SyncActionValue localeSetting + * @property {proto.SyncActionValue.IArchiveChatAction|null} [archiveChatAction] SyncActionValue archiveChatAction + * @property {proto.SyncActionValue.IDeleteMessageForMeAction|null} [deleteMessageForMeAction] SyncActionValue deleteMessageForMeAction + * @property {proto.SyncActionValue.IKeyExpiration|null} [keyExpiration] SyncActionValue keyExpiration + * @property {proto.SyncActionValue.IMarkChatAsReadAction|null} [markChatAsReadAction] SyncActionValue markChatAsReadAction + * @property {proto.SyncActionValue.IClearChatAction|null} [clearChatAction] SyncActionValue clearChatAction + * @property {proto.SyncActionValue.IDeleteChatAction|null} [deleteChatAction] SyncActionValue deleteChatAction + * @property {proto.SyncActionValue.IUnarchiveChatsSetting|null} [unarchiveChatsSetting] SyncActionValue unarchiveChatsSetting + * @property {proto.SyncActionValue.IPrimaryFeature|null} [primaryFeature] SyncActionValue primaryFeature + * @property {proto.SyncActionValue.IAndroidUnsupportedActions|null} [androidUnsupportedActions] SyncActionValue androidUnsupportedActions + * @property {proto.SyncActionValue.IAgentAction|null} [agentAction] SyncActionValue agentAction + * @property {proto.SyncActionValue.ISubscriptionAction|null} [subscriptionAction] SyncActionValue subscriptionAction + * @property {proto.SyncActionValue.IUserStatusMuteAction|null} [userStatusMuteAction] SyncActionValue userStatusMuteAction + * @property {proto.SyncActionValue.ITimeFormatAction|null} [timeFormatAction] SyncActionValue timeFormatAction + * @property {proto.SyncActionValue.INuxAction|null} [nuxAction] SyncActionValue nuxAction + * @property {proto.SyncActionValue.IPrimaryVersionAction|null} [primaryVersionAction] SyncActionValue primaryVersionAction + * @property {proto.SyncActionValue.IStickerAction|null} [stickerAction] SyncActionValue stickerAction + * @property {proto.SyncActionValue.IRemoveRecentStickerAction|null} [removeRecentStickerAction] SyncActionValue removeRecentStickerAction + * @property {proto.SyncActionValue.IChatAssignmentAction|null} [chatAssignment] SyncActionValue chatAssignment + * @property {proto.SyncActionValue.IChatAssignmentOpenedStatusAction|null} [chatAssignmentOpenedStatus] SyncActionValue chatAssignmentOpenedStatus + * @property {proto.SyncActionValue.IPnForLidChatAction|null} [pnForLidChatAction] SyncActionValue pnForLidChatAction + */ + + /** + * Constructs a new SyncActionValue. + * @memberof proto + * @classdesc Represents a SyncActionValue. + * @implements ISyncActionValue + * @constructor + * @param {proto.ISyncActionValue=} [properties] Properties to set + */ + function SyncActionValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncActionValue timestamp. + * @member {number|Long} timestamp + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SyncActionValue starAction. + * @member {proto.SyncActionValue.IStarAction|null|undefined} starAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.starAction = null; + + /** + * SyncActionValue contactAction. + * @member {proto.SyncActionValue.IContactAction|null|undefined} contactAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.contactAction = null; + + /** + * SyncActionValue muteAction. + * @member {proto.SyncActionValue.IMuteAction|null|undefined} muteAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.muteAction = null; + + /** + * SyncActionValue pinAction. + * @member {proto.SyncActionValue.IPinAction|null|undefined} pinAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.pinAction = null; + + /** + * SyncActionValue securityNotificationSetting. + * @member {proto.SyncActionValue.ISecurityNotificationSetting|null|undefined} securityNotificationSetting + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.securityNotificationSetting = null; + + /** + * SyncActionValue pushNameSetting. + * @member {proto.SyncActionValue.IPushNameSetting|null|undefined} pushNameSetting + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.pushNameSetting = null; + + /** + * SyncActionValue quickReplyAction. + * @member {proto.SyncActionValue.IQuickReplyAction|null|undefined} quickReplyAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.quickReplyAction = null; + + /** + * SyncActionValue recentEmojiWeightsAction. + * @member {proto.SyncActionValue.IRecentEmojiWeightsAction|null|undefined} recentEmojiWeightsAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.recentEmojiWeightsAction = null; + + /** + * SyncActionValue labelEditAction. + * @member {proto.SyncActionValue.ILabelEditAction|null|undefined} labelEditAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.labelEditAction = null; + + /** + * SyncActionValue labelAssociationAction. + * @member {proto.SyncActionValue.ILabelAssociationAction|null|undefined} labelAssociationAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.labelAssociationAction = null; + + /** + * SyncActionValue localeSetting. + * @member {proto.SyncActionValue.ILocaleSetting|null|undefined} localeSetting + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.localeSetting = null; + + /** + * SyncActionValue archiveChatAction. + * @member {proto.SyncActionValue.IArchiveChatAction|null|undefined} archiveChatAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.archiveChatAction = null; + + /** + * SyncActionValue deleteMessageForMeAction. + * @member {proto.SyncActionValue.IDeleteMessageForMeAction|null|undefined} deleteMessageForMeAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.deleteMessageForMeAction = null; + + /** + * SyncActionValue keyExpiration. + * @member {proto.SyncActionValue.IKeyExpiration|null|undefined} keyExpiration + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.keyExpiration = null; + + /** + * SyncActionValue markChatAsReadAction. + * @member {proto.SyncActionValue.IMarkChatAsReadAction|null|undefined} markChatAsReadAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.markChatAsReadAction = null; + + /** + * SyncActionValue clearChatAction. + * @member {proto.SyncActionValue.IClearChatAction|null|undefined} clearChatAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.clearChatAction = null; + + /** + * SyncActionValue deleteChatAction. + * @member {proto.SyncActionValue.IDeleteChatAction|null|undefined} deleteChatAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.deleteChatAction = null; + + /** + * SyncActionValue unarchiveChatsSetting. + * @member {proto.SyncActionValue.IUnarchiveChatsSetting|null|undefined} unarchiveChatsSetting + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.unarchiveChatsSetting = null; + + /** + * SyncActionValue primaryFeature. + * @member {proto.SyncActionValue.IPrimaryFeature|null|undefined} primaryFeature + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.primaryFeature = null; + + /** + * SyncActionValue androidUnsupportedActions. + * @member {proto.SyncActionValue.IAndroidUnsupportedActions|null|undefined} androidUnsupportedActions + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.androidUnsupportedActions = null; + + /** + * SyncActionValue agentAction. + * @member {proto.SyncActionValue.IAgentAction|null|undefined} agentAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.agentAction = null; + + /** + * SyncActionValue subscriptionAction. + * @member {proto.SyncActionValue.ISubscriptionAction|null|undefined} subscriptionAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.subscriptionAction = null; + + /** + * SyncActionValue userStatusMuteAction. + * @member {proto.SyncActionValue.IUserStatusMuteAction|null|undefined} userStatusMuteAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.userStatusMuteAction = null; + + /** + * SyncActionValue timeFormatAction. + * @member {proto.SyncActionValue.ITimeFormatAction|null|undefined} timeFormatAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.timeFormatAction = null; + + /** + * SyncActionValue nuxAction. + * @member {proto.SyncActionValue.INuxAction|null|undefined} nuxAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.nuxAction = null; + + /** + * SyncActionValue primaryVersionAction. + * @member {proto.SyncActionValue.IPrimaryVersionAction|null|undefined} primaryVersionAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.primaryVersionAction = null; + + /** + * SyncActionValue stickerAction. + * @member {proto.SyncActionValue.IStickerAction|null|undefined} stickerAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.stickerAction = null; + + /** + * SyncActionValue removeRecentStickerAction. + * @member {proto.SyncActionValue.IRemoveRecentStickerAction|null|undefined} removeRecentStickerAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.removeRecentStickerAction = null; + + /** + * SyncActionValue chatAssignment. + * @member {proto.SyncActionValue.IChatAssignmentAction|null|undefined} chatAssignment + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.chatAssignment = null; + + /** + * SyncActionValue chatAssignmentOpenedStatus. + * @member {proto.SyncActionValue.IChatAssignmentOpenedStatusAction|null|undefined} chatAssignmentOpenedStatus + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.chatAssignmentOpenedStatus = null; + + /** + * SyncActionValue pnForLidChatAction. + * @member {proto.SyncActionValue.IPnForLidChatAction|null|undefined} pnForLidChatAction + * @memberof proto.SyncActionValue + * @instance + */ + SyncActionValue.prototype.pnForLidChatAction = null; + + /** + * Creates a new SyncActionValue instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue + * @static + * @param {proto.ISyncActionValue=} [properties] Properties to set + * @returns {proto.SyncActionValue} SyncActionValue instance + */ + SyncActionValue.create = function create(properties) { + return new SyncActionValue(properties); + }; + + /** + * Encodes the specified SyncActionValue message. Does not implicitly {@link proto.SyncActionValue.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue + * @static + * @param {proto.ISyncActionValue} message SyncActionValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.timestamp); + if (message.starAction != null && Object.hasOwnProperty.call(message, "starAction")) + $root.proto.SyncActionValue.StarAction.encode(message.starAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contactAction != null && Object.hasOwnProperty.call(message, "contactAction")) + $root.proto.SyncActionValue.ContactAction.encode(message.contactAction, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.muteAction != null && Object.hasOwnProperty.call(message, "muteAction")) + $root.proto.SyncActionValue.MuteAction.encode(message.muteAction, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pinAction != null && Object.hasOwnProperty.call(message, "pinAction")) + $root.proto.SyncActionValue.PinAction.encode(message.pinAction, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.securityNotificationSetting != null && Object.hasOwnProperty.call(message, "securityNotificationSetting")) + $root.proto.SyncActionValue.SecurityNotificationSetting.encode(message.securityNotificationSetting, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.pushNameSetting != null && Object.hasOwnProperty.call(message, "pushNameSetting")) + $root.proto.SyncActionValue.PushNameSetting.encode(message.pushNameSetting, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.quickReplyAction != null && Object.hasOwnProperty.call(message, "quickReplyAction")) + $root.proto.SyncActionValue.QuickReplyAction.encode(message.quickReplyAction, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.recentEmojiWeightsAction != null && Object.hasOwnProperty.call(message, "recentEmojiWeightsAction")) + $root.proto.SyncActionValue.RecentEmojiWeightsAction.encode(message.recentEmojiWeightsAction, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.labelEditAction != null && Object.hasOwnProperty.call(message, "labelEditAction")) + $root.proto.SyncActionValue.LabelEditAction.encode(message.labelEditAction, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.labelAssociationAction != null && Object.hasOwnProperty.call(message, "labelAssociationAction")) + $root.proto.SyncActionValue.LabelAssociationAction.encode(message.labelAssociationAction, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.localeSetting != null && Object.hasOwnProperty.call(message, "localeSetting")) + $root.proto.SyncActionValue.LocaleSetting.encode(message.localeSetting, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.archiveChatAction != null && Object.hasOwnProperty.call(message, "archiveChatAction")) + $root.proto.SyncActionValue.ArchiveChatAction.encode(message.archiveChatAction, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.deleteMessageForMeAction != null && Object.hasOwnProperty.call(message, "deleteMessageForMeAction")) + $root.proto.SyncActionValue.DeleteMessageForMeAction.encode(message.deleteMessageForMeAction, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.keyExpiration != null && Object.hasOwnProperty.call(message, "keyExpiration")) + $root.proto.SyncActionValue.KeyExpiration.encode(message.keyExpiration, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.markChatAsReadAction != null && Object.hasOwnProperty.call(message, "markChatAsReadAction")) + $root.proto.SyncActionValue.MarkChatAsReadAction.encode(message.markChatAsReadAction, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.clearChatAction != null && Object.hasOwnProperty.call(message, "clearChatAction")) + $root.proto.SyncActionValue.ClearChatAction.encode(message.clearChatAction, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.deleteChatAction != null && Object.hasOwnProperty.call(message, "deleteChatAction")) + $root.proto.SyncActionValue.DeleteChatAction.encode(message.deleteChatAction, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.unarchiveChatsSetting != null && Object.hasOwnProperty.call(message, "unarchiveChatsSetting")) + $root.proto.SyncActionValue.UnarchiveChatsSetting.encode(message.unarchiveChatsSetting, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.primaryFeature != null && Object.hasOwnProperty.call(message, "primaryFeature")) + $root.proto.SyncActionValue.PrimaryFeature.encode(message.primaryFeature, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.androidUnsupportedActions != null && Object.hasOwnProperty.call(message, "androidUnsupportedActions")) + $root.proto.SyncActionValue.AndroidUnsupportedActions.encode(message.androidUnsupportedActions, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.agentAction != null && Object.hasOwnProperty.call(message, "agentAction")) + $root.proto.SyncActionValue.AgentAction.encode(message.agentAction, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.subscriptionAction != null && Object.hasOwnProperty.call(message, "subscriptionAction")) + $root.proto.SyncActionValue.SubscriptionAction.encode(message.subscriptionAction, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + if (message.userStatusMuteAction != null && Object.hasOwnProperty.call(message, "userStatusMuteAction")) + $root.proto.SyncActionValue.UserStatusMuteAction.encode(message.userStatusMuteAction, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.timeFormatAction != null && Object.hasOwnProperty.call(message, "timeFormatAction")) + $root.proto.SyncActionValue.TimeFormatAction.encode(message.timeFormatAction, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.nuxAction != null && Object.hasOwnProperty.call(message, "nuxAction")) + $root.proto.SyncActionValue.NuxAction.encode(message.nuxAction, writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.primaryVersionAction != null && Object.hasOwnProperty.call(message, "primaryVersionAction")) + $root.proto.SyncActionValue.PrimaryVersionAction.encode(message.primaryVersionAction, writer.uint32(/* id 32, wireType 2 =*/258).fork()).ldelim(); + if (message.stickerAction != null && Object.hasOwnProperty.call(message, "stickerAction")) + $root.proto.SyncActionValue.StickerAction.encode(message.stickerAction, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.removeRecentStickerAction != null && Object.hasOwnProperty.call(message, "removeRecentStickerAction")) + $root.proto.SyncActionValue.RemoveRecentStickerAction.encode(message.removeRecentStickerAction, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.chatAssignment != null && Object.hasOwnProperty.call(message, "chatAssignment")) + $root.proto.SyncActionValue.ChatAssignmentAction.encode(message.chatAssignment, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.chatAssignmentOpenedStatus != null && Object.hasOwnProperty.call(message, "chatAssignmentOpenedStatus")) + $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction.encode(message.chatAssignmentOpenedStatus, writer.uint32(/* id 36, wireType 2 =*/290).fork()).ldelim(); + if (message.pnForLidChatAction != null && Object.hasOwnProperty.call(message, "pnForLidChatAction")) + $root.proto.SyncActionValue.PnForLidChatAction.encode(message.pnForLidChatAction, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SyncActionValue message, length delimited. Does not implicitly {@link proto.SyncActionValue.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue + * @static + * @param {proto.ISyncActionValue} message SyncActionValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncActionValue message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue} SyncActionValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.timestamp = reader.int64(); + break; + case 2: + message.starAction = $root.proto.SyncActionValue.StarAction.decode(reader, reader.uint32()); + break; + case 3: + message.contactAction = $root.proto.SyncActionValue.ContactAction.decode(reader, reader.uint32()); + break; + case 4: + message.muteAction = $root.proto.SyncActionValue.MuteAction.decode(reader, reader.uint32()); + break; + case 5: + message.pinAction = $root.proto.SyncActionValue.PinAction.decode(reader, reader.uint32()); + break; + case 6: + message.securityNotificationSetting = $root.proto.SyncActionValue.SecurityNotificationSetting.decode(reader, reader.uint32()); + break; + case 7: + message.pushNameSetting = $root.proto.SyncActionValue.PushNameSetting.decode(reader, reader.uint32()); + break; + case 8: + message.quickReplyAction = $root.proto.SyncActionValue.QuickReplyAction.decode(reader, reader.uint32()); + break; + case 11: + message.recentEmojiWeightsAction = $root.proto.SyncActionValue.RecentEmojiWeightsAction.decode(reader, reader.uint32()); + break; + case 14: + message.labelEditAction = $root.proto.SyncActionValue.LabelEditAction.decode(reader, reader.uint32()); + break; + case 15: + message.labelAssociationAction = $root.proto.SyncActionValue.LabelAssociationAction.decode(reader, reader.uint32()); + break; + case 16: + message.localeSetting = $root.proto.SyncActionValue.LocaleSetting.decode(reader, reader.uint32()); + break; + case 17: + message.archiveChatAction = $root.proto.SyncActionValue.ArchiveChatAction.decode(reader, reader.uint32()); + break; + case 18: + message.deleteMessageForMeAction = $root.proto.SyncActionValue.DeleteMessageForMeAction.decode(reader, reader.uint32()); + break; + case 19: + message.keyExpiration = $root.proto.SyncActionValue.KeyExpiration.decode(reader, reader.uint32()); + break; + case 20: + message.markChatAsReadAction = $root.proto.SyncActionValue.MarkChatAsReadAction.decode(reader, reader.uint32()); + break; + case 21: + message.clearChatAction = $root.proto.SyncActionValue.ClearChatAction.decode(reader, reader.uint32()); + break; + case 22: + message.deleteChatAction = $root.proto.SyncActionValue.DeleteChatAction.decode(reader, reader.uint32()); + break; + case 23: + message.unarchiveChatsSetting = $root.proto.SyncActionValue.UnarchiveChatsSetting.decode(reader, reader.uint32()); + break; + case 24: + message.primaryFeature = $root.proto.SyncActionValue.PrimaryFeature.decode(reader, reader.uint32()); + break; + case 26: + message.androidUnsupportedActions = $root.proto.SyncActionValue.AndroidUnsupportedActions.decode(reader, reader.uint32()); + break; + case 27: + message.agentAction = $root.proto.SyncActionValue.AgentAction.decode(reader, reader.uint32()); + break; + case 28: + message.subscriptionAction = $root.proto.SyncActionValue.SubscriptionAction.decode(reader, reader.uint32()); + break; + case 29: + message.userStatusMuteAction = $root.proto.SyncActionValue.UserStatusMuteAction.decode(reader, reader.uint32()); + break; + case 30: + message.timeFormatAction = $root.proto.SyncActionValue.TimeFormatAction.decode(reader, reader.uint32()); + break; + case 31: + message.nuxAction = $root.proto.SyncActionValue.NuxAction.decode(reader, reader.uint32()); + break; + case 32: + message.primaryVersionAction = $root.proto.SyncActionValue.PrimaryVersionAction.decode(reader, reader.uint32()); + break; + case 33: + message.stickerAction = $root.proto.SyncActionValue.StickerAction.decode(reader, reader.uint32()); + break; + case 34: + message.removeRecentStickerAction = $root.proto.SyncActionValue.RemoveRecentStickerAction.decode(reader, reader.uint32()); + break; + case 35: + message.chatAssignment = $root.proto.SyncActionValue.ChatAssignmentAction.decode(reader, reader.uint32()); + break; + case 36: + message.chatAssignmentOpenedStatus = $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction.decode(reader, reader.uint32()); + break; + case 37: + message.pnForLidChatAction = $root.proto.SyncActionValue.PnForLidChatAction.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncActionValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue} SyncActionValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncActionValue message. + * @function verify + * @memberof proto.SyncActionValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncActionValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.starAction != null && message.hasOwnProperty("starAction")) { + var error = $root.proto.SyncActionValue.StarAction.verify(message.starAction); + if (error) + return "starAction." + error; + } + if (message.contactAction != null && message.hasOwnProperty("contactAction")) { + var error = $root.proto.SyncActionValue.ContactAction.verify(message.contactAction); + if (error) + return "contactAction." + error; + } + if (message.muteAction != null && message.hasOwnProperty("muteAction")) { + var error = $root.proto.SyncActionValue.MuteAction.verify(message.muteAction); + if (error) + return "muteAction." + error; + } + if (message.pinAction != null && message.hasOwnProperty("pinAction")) { + var error = $root.proto.SyncActionValue.PinAction.verify(message.pinAction); + if (error) + return "pinAction." + error; + } + if (message.securityNotificationSetting != null && message.hasOwnProperty("securityNotificationSetting")) { + var error = $root.proto.SyncActionValue.SecurityNotificationSetting.verify(message.securityNotificationSetting); + if (error) + return "securityNotificationSetting." + error; + } + if (message.pushNameSetting != null && message.hasOwnProperty("pushNameSetting")) { + var error = $root.proto.SyncActionValue.PushNameSetting.verify(message.pushNameSetting); + if (error) + return "pushNameSetting." + error; + } + if (message.quickReplyAction != null && message.hasOwnProperty("quickReplyAction")) { + var error = $root.proto.SyncActionValue.QuickReplyAction.verify(message.quickReplyAction); + if (error) + return "quickReplyAction." + error; + } + if (message.recentEmojiWeightsAction != null && message.hasOwnProperty("recentEmojiWeightsAction")) { + var error = $root.proto.SyncActionValue.RecentEmojiWeightsAction.verify(message.recentEmojiWeightsAction); + if (error) + return "recentEmojiWeightsAction." + error; + } + if (message.labelEditAction != null && message.hasOwnProperty("labelEditAction")) { + var error = $root.proto.SyncActionValue.LabelEditAction.verify(message.labelEditAction); + if (error) + return "labelEditAction." + error; + } + if (message.labelAssociationAction != null && message.hasOwnProperty("labelAssociationAction")) { + var error = $root.proto.SyncActionValue.LabelAssociationAction.verify(message.labelAssociationAction); + if (error) + return "labelAssociationAction." + error; + } + if (message.localeSetting != null && message.hasOwnProperty("localeSetting")) { + var error = $root.proto.SyncActionValue.LocaleSetting.verify(message.localeSetting); + if (error) + return "localeSetting." + error; + } + if (message.archiveChatAction != null && message.hasOwnProperty("archiveChatAction")) { + var error = $root.proto.SyncActionValue.ArchiveChatAction.verify(message.archiveChatAction); + if (error) + return "archiveChatAction." + error; + } + if (message.deleteMessageForMeAction != null && message.hasOwnProperty("deleteMessageForMeAction")) { + var error = $root.proto.SyncActionValue.DeleteMessageForMeAction.verify(message.deleteMessageForMeAction); + if (error) + return "deleteMessageForMeAction." + error; + } + if (message.keyExpiration != null && message.hasOwnProperty("keyExpiration")) { + var error = $root.proto.SyncActionValue.KeyExpiration.verify(message.keyExpiration); + if (error) + return "keyExpiration." + error; + } + if (message.markChatAsReadAction != null && message.hasOwnProperty("markChatAsReadAction")) { + var error = $root.proto.SyncActionValue.MarkChatAsReadAction.verify(message.markChatAsReadAction); + if (error) + return "markChatAsReadAction." + error; + } + if (message.clearChatAction != null && message.hasOwnProperty("clearChatAction")) { + var error = $root.proto.SyncActionValue.ClearChatAction.verify(message.clearChatAction); + if (error) + return "clearChatAction." + error; + } + if (message.deleteChatAction != null && message.hasOwnProperty("deleteChatAction")) { + var error = $root.proto.SyncActionValue.DeleteChatAction.verify(message.deleteChatAction); + if (error) + return "deleteChatAction." + error; + } + if (message.unarchiveChatsSetting != null && message.hasOwnProperty("unarchiveChatsSetting")) { + var error = $root.proto.SyncActionValue.UnarchiveChatsSetting.verify(message.unarchiveChatsSetting); + if (error) + return "unarchiveChatsSetting." + error; + } + if (message.primaryFeature != null && message.hasOwnProperty("primaryFeature")) { + var error = $root.proto.SyncActionValue.PrimaryFeature.verify(message.primaryFeature); + if (error) + return "primaryFeature." + error; + } + if (message.androidUnsupportedActions != null && message.hasOwnProperty("androidUnsupportedActions")) { + var error = $root.proto.SyncActionValue.AndroidUnsupportedActions.verify(message.androidUnsupportedActions); + if (error) + return "androidUnsupportedActions." + error; + } + if (message.agentAction != null && message.hasOwnProperty("agentAction")) { + var error = $root.proto.SyncActionValue.AgentAction.verify(message.agentAction); + if (error) + return "agentAction." + error; + } + if (message.subscriptionAction != null && message.hasOwnProperty("subscriptionAction")) { + var error = $root.proto.SyncActionValue.SubscriptionAction.verify(message.subscriptionAction); + if (error) + return "subscriptionAction." + error; + } + if (message.userStatusMuteAction != null && message.hasOwnProperty("userStatusMuteAction")) { + var error = $root.proto.SyncActionValue.UserStatusMuteAction.verify(message.userStatusMuteAction); + if (error) + return "userStatusMuteAction." + error; + } + if (message.timeFormatAction != null && message.hasOwnProperty("timeFormatAction")) { + var error = $root.proto.SyncActionValue.TimeFormatAction.verify(message.timeFormatAction); + if (error) + return "timeFormatAction." + error; + } + if (message.nuxAction != null && message.hasOwnProperty("nuxAction")) { + var error = $root.proto.SyncActionValue.NuxAction.verify(message.nuxAction); + if (error) + return "nuxAction." + error; + } + if (message.primaryVersionAction != null && message.hasOwnProperty("primaryVersionAction")) { + var error = $root.proto.SyncActionValue.PrimaryVersionAction.verify(message.primaryVersionAction); + if (error) + return "primaryVersionAction." + error; + } + if (message.stickerAction != null && message.hasOwnProperty("stickerAction")) { + var error = $root.proto.SyncActionValue.StickerAction.verify(message.stickerAction); + if (error) + return "stickerAction." + error; + } + if (message.removeRecentStickerAction != null && message.hasOwnProperty("removeRecentStickerAction")) { + var error = $root.proto.SyncActionValue.RemoveRecentStickerAction.verify(message.removeRecentStickerAction); + if (error) + return "removeRecentStickerAction." + error; + } + if (message.chatAssignment != null && message.hasOwnProperty("chatAssignment")) { + var error = $root.proto.SyncActionValue.ChatAssignmentAction.verify(message.chatAssignment); + if (error) + return "chatAssignment." + error; + } + if (message.chatAssignmentOpenedStatus != null && message.hasOwnProperty("chatAssignmentOpenedStatus")) { + var error = $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction.verify(message.chatAssignmentOpenedStatus); + if (error) + return "chatAssignmentOpenedStatus." + error; + } + if (message.pnForLidChatAction != null && message.hasOwnProperty("pnForLidChatAction")) { + var error = $root.proto.SyncActionValue.PnForLidChatAction.verify(message.pnForLidChatAction); + if (error) + return "pnForLidChatAction." + error; + } + return null; + }; + + /** + * Creates a SyncActionValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue} SyncActionValue + */ + SyncActionValue.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue) + return object; + var message = new $root.proto.SyncActionValue(); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + if (object.starAction != null) { + if (typeof object.starAction !== "object") + throw TypeError(".proto.SyncActionValue.starAction: object expected"); + message.starAction = $root.proto.SyncActionValue.StarAction.fromObject(object.starAction); + } + if (object.contactAction != null) { + if (typeof object.contactAction !== "object") + throw TypeError(".proto.SyncActionValue.contactAction: object expected"); + message.contactAction = $root.proto.SyncActionValue.ContactAction.fromObject(object.contactAction); + } + if (object.muteAction != null) { + if (typeof object.muteAction !== "object") + throw TypeError(".proto.SyncActionValue.muteAction: object expected"); + message.muteAction = $root.proto.SyncActionValue.MuteAction.fromObject(object.muteAction); + } + if (object.pinAction != null) { + if (typeof object.pinAction !== "object") + throw TypeError(".proto.SyncActionValue.pinAction: object expected"); + message.pinAction = $root.proto.SyncActionValue.PinAction.fromObject(object.pinAction); + } + if (object.securityNotificationSetting != null) { + if (typeof object.securityNotificationSetting !== "object") + throw TypeError(".proto.SyncActionValue.securityNotificationSetting: object expected"); + message.securityNotificationSetting = $root.proto.SyncActionValue.SecurityNotificationSetting.fromObject(object.securityNotificationSetting); + } + if (object.pushNameSetting != null) { + if (typeof object.pushNameSetting !== "object") + throw TypeError(".proto.SyncActionValue.pushNameSetting: object expected"); + message.pushNameSetting = $root.proto.SyncActionValue.PushNameSetting.fromObject(object.pushNameSetting); + } + if (object.quickReplyAction != null) { + if (typeof object.quickReplyAction !== "object") + throw TypeError(".proto.SyncActionValue.quickReplyAction: object expected"); + message.quickReplyAction = $root.proto.SyncActionValue.QuickReplyAction.fromObject(object.quickReplyAction); + } + if (object.recentEmojiWeightsAction != null) { + if (typeof object.recentEmojiWeightsAction !== "object") + throw TypeError(".proto.SyncActionValue.recentEmojiWeightsAction: object expected"); + message.recentEmojiWeightsAction = $root.proto.SyncActionValue.RecentEmojiWeightsAction.fromObject(object.recentEmojiWeightsAction); + } + if (object.labelEditAction != null) { + if (typeof object.labelEditAction !== "object") + throw TypeError(".proto.SyncActionValue.labelEditAction: object expected"); + message.labelEditAction = $root.proto.SyncActionValue.LabelEditAction.fromObject(object.labelEditAction); + } + if (object.labelAssociationAction != null) { + if (typeof object.labelAssociationAction !== "object") + throw TypeError(".proto.SyncActionValue.labelAssociationAction: object expected"); + message.labelAssociationAction = $root.proto.SyncActionValue.LabelAssociationAction.fromObject(object.labelAssociationAction); + } + if (object.localeSetting != null) { + if (typeof object.localeSetting !== "object") + throw TypeError(".proto.SyncActionValue.localeSetting: object expected"); + message.localeSetting = $root.proto.SyncActionValue.LocaleSetting.fromObject(object.localeSetting); + } + if (object.archiveChatAction != null) { + if (typeof object.archiveChatAction !== "object") + throw TypeError(".proto.SyncActionValue.archiveChatAction: object expected"); + message.archiveChatAction = $root.proto.SyncActionValue.ArchiveChatAction.fromObject(object.archiveChatAction); + } + if (object.deleteMessageForMeAction != null) { + if (typeof object.deleteMessageForMeAction !== "object") + throw TypeError(".proto.SyncActionValue.deleteMessageForMeAction: object expected"); + message.deleteMessageForMeAction = $root.proto.SyncActionValue.DeleteMessageForMeAction.fromObject(object.deleteMessageForMeAction); + } + if (object.keyExpiration != null) { + if (typeof object.keyExpiration !== "object") + throw TypeError(".proto.SyncActionValue.keyExpiration: object expected"); + message.keyExpiration = $root.proto.SyncActionValue.KeyExpiration.fromObject(object.keyExpiration); + } + if (object.markChatAsReadAction != null) { + if (typeof object.markChatAsReadAction !== "object") + throw TypeError(".proto.SyncActionValue.markChatAsReadAction: object expected"); + message.markChatAsReadAction = $root.proto.SyncActionValue.MarkChatAsReadAction.fromObject(object.markChatAsReadAction); + } + if (object.clearChatAction != null) { + if (typeof object.clearChatAction !== "object") + throw TypeError(".proto.SyncActionValue.clearChatAction: object expected"); + message.clearChatAction = $root.proto.SyncActionValue.ClearChatAction.fromObject(object.clearChatAction); + } + if (object.deleteChatAction != null) { + if (typeof object.deleteChatAction !== "object") + throw TypeError(".proto.SyncActionValue.deleteChatAction: object expected"); + message.deleteChatAction = $root.proto.SyncActionValue.DeleteChatAction.fromObject(object.deleteChatAction); + } + if (object.unarchiveChatsSetting != null) { + if (typeof object.unarchiveChatsSetting !== "object") + throw TypeError(".proto.SyncActionValue.unarchiveChatsSetting: object expected"); + message.unarchiveChatsSetting = $root.proto.SyncActionValue.UnarchiveChatsSetting.fromObject(object.unarchiveChatsSetting); + } + if (object.primaryFeature != null) { + if (typeof object.primaryFeature !== "object") + throw TypeError(".proto.SyncActionValue.primaryFeature: object expected"); + message.primaryFeature = $root.proto.SyncActionValue.PrimaryFeature.fromObject(object.primaryFeature); + } + if (object.androidUnsupportedActions != null) { + if (typeof object.androidUnsupportedActions !== "object") + throw TypeError(".proto.SyncActionValue.androidUnsupportedActions: object expected"); + message.androidUnsupportedActions = $root.proto.SyncActionValue.AndroidUnsupportedActions.fromObject(object.androidUnsupportedActions); + } + if (object.agentAction != null) { + if (typeof object.agentAction !== "object") + throw TypeError(".proto.SyncActionValue.agentAction: object expected"); + message.agentAction = $root.proto.SyncActionValue.AgentAction.fromObject(object.agentAction); + } + if (object.subscriptionAction != null) { + if (typeof object.subscriptionAction !== "object") + throw TypeError(".proto.SyncActionValue.subscriptionAction: object expected"); + message.subscriptionAction = $root.proto.SyncActionValue.SubscriptionAction.fromObject(object.subscriptionAction); + } + if (object.userStatusMuteAction != null) { + if (typeof object.userStatusMuteAction !== "object") + throw TypeError(".proto.SyncActionValue.userStatusMuteAction: object expected"); + message.userStatusMuteAction = $root.proto.SyncActionValue.UserStatusMuteAction.fromObject(object.userStatusMuteAction); + } + if (object.timeFormatAction != null) { + if (typeof object.timeFormatAction !== "object") + throw TypeError(".proto.SyncActionValue.timeFormatAction: object expected"); + message.timeFormatAction = $root.proto.SyncActionValue.TimeFormatAction.fromObject(object.timeFormatAction); + } + if (object.nuxAction != null) { + if (typeof object.nuxAction !== "object") + throw TypeError(".proto.SyncActionValue.nuxAction: object expected"); + message.nuxAction = $root.proto.SyncActionValue.NuxAction.fromObject(object.nuxAction); + } + if (object.primaryVersionAction != null) { + if (typeof object.primaryVersionAction !== "object") + throw TypeError(".proto.SyncActionValue.primaryVersionAction: object expected"); + message.primaryVersionAction = $root.proto.SyncActionValue.PrimaryVersionAction.fromObject(object.primaryVersionAction); + } + if (object.stickerAction != null) { + if (typeof object.stickerAction !== "object") + throw TypeError(".proto.SyncActionValue.stickerAction: object expected"); + message.stickerAction = $root.proto.SyncActionValue.StickerAction.fromObject(object.stickerAction); + } + if (object.removeRecentStickerAction != null) { + if (typeof object.removeRecentStickerAction !== "object") + throw TypeError(".proto.SyncActionValue.removeRecentStickerAction: object expected"); + message.removeRecentStickerAction = $root.proto.SyncActionValue.RemoveRecentStickerAction.fromObject(object.removeRecentStickerAction); + } + if (object.chatAssignment != null) { + if (typeof object.chatAssignment !== "object") + throw TypeError(".proto.SyncActionValue.chatAssignment: object expected"); + message.chatAssignment = $root.proto.SyncActionValue.ChatAssignmentAction.fromObject(object.chatAssignment); + } + if (object.chatAssignmentOpenedStatus != null) { + if (typeof object.chatAssignmentOpenedStatus !== "object") + throw TypeError(".proto.SyncActionValue.chatAssignmentOpenedStatus: object expected"); + message.chatAssignmentOpenedStatus = $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction.fromObject(object.chatAssignmentOpenedStatus); + } + if (object.pnForLidChatAction != null) { + if (typeof object.pnForLidChatAction !== "object") + throw TypeError(".proto.SyncActionValue.pnForLidChatAction: object expected"); + message.pnForLidChatAction = $root.proto.SyncActionValue.PnForLidChatAction.fromObject(object.pnForLidChatAction); + } + return message; + }; + + /** + * Creates a plain object from a SyncActionValue message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue + * @static + * @param {proto.SyncActionValue} message SyncActionValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncActionValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + object.starAction = null; + object.contactAction = null; + object.muteAction = null; + object.pinAction = null; + object.securityNotificationSetting = null; + object.pushNameSetting = null; + object.quickReplyAction = null; + object.recentEmojiWeightsAction = null; + object.labelEditAction = null; + object.labelAssociationAction = null; + object.localeSetting = null; + object.archiveChatAction = null; + object.deleteMessageForMeAction = null; + object.keyExpiration = null; + object.markChatAsReadAction = null; + object.clearChatAction = null; + object.deleteChatAction = null; + object.unarchiveChatsSetting = null; + object.primaryFeature = null; + object.androidUnsupportedActions = null; + object.agentAction = null; + object.subscriptionAction = null; + object.userStatusMuteAction = null; + object.timeFormatAction = null; + object.nuxAction = null; + object.primaryVersionAction = null; + object.stickerAction = null; + object.removeRecentStickerAction = null; + object.chatAssignment = null; + object.chatAssignmentOpenedStatus = null; + object.pnForLidChatAction = null; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + if (message.starAction != null && message.hasOwnProperty("starAction")) + object.starAction = $root.proto.SyncActionValue.StarAction.toObject(message.starAction, options); + if (message.contactAction != null && message.hasOwnProperty("contactAction")) + object.contactAction = $root.proto.SyncActionValue.ContactAction.toObject(message.contactAction, options); + if (message.muteAction != null && message.hasOwnProperty("muteAction")) + object.muteAction = $root.proto.SyncActionValue.MuteAction.toObject(message.muteAction, options); + if (message.pinAction != null && message.hasOwnProperty("pinAction")) + object.pinAction = $root.proto.SyncActionValue.PinAction.toObject(message.pinAction, options); + if (message.securityNotificationSetting != null && message.hasOwnProperty("securityNotificationSetting")) + object.securityNotificationSetting = $root.proto.SyncActionValue.SecurityNotificationSetting.toObject(message.securityNotificationSetting, options); + if (message.pushNameSetting != null && message.hasOwnProperty("pushNameSetting")) + object.pushNameSetting = $root.proto.SyncActionValue.PushNameSetting.toObject(message.pushNameSetting, options); + if (message.quickReplyAction != null && message.hasOwnProperty("quickReplyAction")) + object.quickReplyAction = $root.proto.SyncActionValue.QuickReplyAction.toObject(message.quickReplyAction, options); + if (message.recentEmojiWeightsAction != null && message.hasOwnProperty("recentEmojiWeightsAction")) + object.recentEmojiWeightsAction = $root.proto.SyncActionValue.RecentEmojiWeightsAction.toObject(message.recentEmojiWeightsAction, options); + if (message.labelEditAction != null && message.hasOwnProperty("labelEditAction")) + object.labelEditAction = $root.proto.SyncActionValue.LabelEditAction.toObject(message.labelEditAction, options); + if (message.labelAssociationAction != null && message.hasOwnProperty("labelAssociationAction")) + object.labelAssociationAction = $root.proto.SyncActionValue.LabelAssociationAction.toObject(message.labelAssociationAction, options); + if (message.localeSetting != null && message.hasOwnProperty("localeSetting")) + object.localeSetting = $root.proto.SyncActionValue.LocaleSetting.toObject(message.localeSetting, options); + if (message.archiveChatAction != null && message.hasOwnProperty("archiveChatAction")) + object.archiveChatAction = $root.proto.SyncActionValue.ArchiveChatAction.toObject(message.archiveChatAction, options); + if (message.deleteMessageForMeAction != null && message.hasOwnProperty("deleteMessageForMeAction")) + object.deleteMessageForMeAction = $root.proto.SyncActionValue.DeleteMessageForMeAction.toObject(message.deleteMessageForMeAction, options); + if (message.keyExpiration != null && message.hasOwnProperty("keyExpiration")) + object.keyExpiration = $root.proto.SyncActionValue.KeyExpiration.toObject(message.keyExpiration, options); + if (message.markChatAsReadAction != null && message.hasOwnProperty("markChatAsReadAction")) + object.markChatAsReadAction = $root.proto.SyncActionValue.MarkChatAsReadAction.toObject(message.markChatAsReadAction, options); + if (message.clearChatAction != null && message.hasOwnProperty("clearChatAction")) + object.clearChatAction = $root.proto.SyncActionValue.ClearChatAction.toObject(message.clearChatAction, options); + if (message.deleteChatAction != null && message.hasOwnProperty("deleteChatAction")) + object.deleteChatAction = $root.proto.SyncActionValue.DeleteChatAction.toObject(message.deleteChatAction, options); + if (message.unarchiveChatsSetting != null && message.hasOwnProperty("unarchiveChatsSetting")) + object.unarchiveChatsSetting = $root.proto.SyncActionValue.UnarchiveChatsSetting.toObject(message.unarchiveChatsSetting, options); + if (message.primaryFeature != null && message.hasOwnProperty("primaryFeature")) + object.primaryFeature = $root.proto.SyncActionValue.PrimaryFeature.toObject(message.primaryFeature, options); + if (message.androidUnsupportedActions != null && message.hasOwnProperty("androidUnsupportedActions")) + object.androidUnsupportedActions = $root.proto.SyncActionValue.AndroidUnsupportedActions.toObject(message.androidUnsupportedActions, options); + if (message.agentAction != null && message.hasOwnProperty("agentAction")) + object.agentAction = $root.proto.SyncActionValue.AgentAction.toObject(message.agentAction, options); + if (message.subscriptionAction != null && message.hasOwnProperty("subscriptionAction")) + object.subscriptionAction = $root.proto.SyncActionValue.SubscriptionAction.toObject(message.subscriptionAction, options); + if (message.userStatusMuteAction != null && message.hasOwnProperty("userStatusMuteAction")) + object.userStatusMuteAction = $root.proto.SyncActionValue.UserStatusMuteAction.toObject(message.userStatusMuteAction, options); + if (message.timeFormatAction != null && message.hasOwnProperty("timeFormatAction")) + object.timeFormatAction = $root.proto.SyncActionValue.TimeFormatAction.toObject(message.timeFormatAction, options); + if (message.nuxAction != null && message.hasOwnProperty("nuxAction")) + object.nuxAction = $root.proto.SyncActionValue.NuxAction.toObject(message.nuxAction, options); + if (message.primaryVersionAction != null && message.hasOwnProperty("primaryVersionAction")) + object.primaryVersionAction = $root.proto.SyncActionValue.PrimaryVersionAction.toObject(message.primaryVersionAction, options); + if (message.stickerAction != null && message.hasOwnProperty("stickerAction")) + object.stickerAction = $root.proto.SyncActionValue.StickerAction.toObject(message.stickerAction, options); + if (message.removeRecentStickerAction != null && message.hasOwnProperty("removeRecentStickerAction")) + object.removeRecentStickerAction = $root.proto.SyncActionValue.RemoveRecentStickerAction.toObject(message.removeRecentStickerAction, options); + if (message.chatAssignment != null && message.hasOwnProperty("chatAssignment")) + object.chatAssignment = $root.proto.SyncActionValue.ChatAssignmentAction.toObject(message.chatAssignment, options); + if (message.chatAssignmentOpenedStatus != null && message.hasOwnProperty("chatAssignmentOpenedStatus")) + object.chatAssignmentOpenedStatus = $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction.toObject(message.chatAssignmentOpenedStatus, options); + if (message.pnForLidChatAction != null && message.hasOwnProperty("pnForLidChatAction")) + object.pnForLidChatAction = $root.proto.SyncActionValue.PnForLidChatAction.toObject(message.pnForLidChatAction, options); + return object; + }; + + /** + * Converts this SyncActionValue to JSON. + * @function toJSON + * @memberof proto.SyncActionValue + * @instance + * @returns {Object.} JSON object + */ + SyncActionValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SyncActionValue.AgentAction = (function() { + + /** + * Properties of an AgentAction. + * @memberof proto.SyncActionValue + * @interface IAgentAction + * @property {string|null} [name] AgentAction name + * @property {number|null} [deviceID] AgentAction deviceID + * @property {boolean|null} [isDeleted] AgentAction isDeleted + */ + + /** + * Constructs a new AgentAction. + * @memberof proto.SyncActionValue + * @classdesc Represents an AgentAction. + * @implements IAgentAction + * @constructor + * @param {proto.SyncActionValue.IAgentAction=} [properties] Properties to set + */ + function AgentAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AgentAction name. + * @member {string} name + * @memberof proto.SyncActionValue.AgentAction + * @instance + */ + AgentAction.prototype.name = ""; + + /** + * AgentAction deviceID. + * @member {number} deviceID + * @memberof proto.SyncActionValue.AgentAction + * @instance + */ + AgentAction.prototype.deviceID = 0; + + /** + * AgentAction isDeleted. + * @member {boolean} isDeleted + * @memberof proto.SyncActionValue.AgentAction + * @instance + */ + AgentAction.prototype.isDeleted = false; + + /** + * Creates a new AgentAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {proto.SyncActionValue.IAgentAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.AgentAction} AgentAction instance + */ + AgentAction.create = function create(properties) { + return new AgentAction(properties); + }; + + /** + * Encodes the specified AgentAction message. Does not implicitly {@link proto.SyncActionValue.AgentAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {proto.SyncActionValue.IAgentAction} message AgentAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.deviceID != null && Object.hasOwnProperty.call(message, "deviceID")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.deviceID); + if (message.isDeleted != null && Object.hasOwnProperty.call(message, "isDeleted")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isDeleted); + return writer; + }; + + /** + * Encodes the specified AgentAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.AgentAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {proto.SyncActionValue.IAgentAction} message AgentAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AgentAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.AgentAction} AgentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.AgentAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.deviceID = reader.int32(); + break; + case 3: + message.isDeleted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AgentAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.AgentAction} AgentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AgentAction message. + * @function verify + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AgentAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.deviceID != null && message.hasOwnProperty("deviceID")) + if (!$util.isInteger(message.deviceID)) + return "deviceID: integer expected"; + if (message.isDeleted != null && message.hasOwnProperty("isDeleted")) + if (typeof message.isDeleted !== "boolean") + return "isDeleted: boolean expected"; + return null; + }; + + /** + * Creates an AgentAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.AgentAction} AgentAction + */ + AgentAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.AgentAction) + return object; + var message = new $root.proto.SyncActionValue.AgentAction(); + if (object.name != null) + message.name = String(object.name); + if (object.deviceID != null) + message.deviceID = object.deviceID | 0; + if (object.isDeleted != null) + message.isDeleted = Boolean(object.isDeleted); + return message; + }; + + /** + * Creates a plain object from an AgentAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.AgentAction + * @static + * @param {proto.SyncActionValue.AgentAction} message AgentAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AgentAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.deviceID = 0; + object.isDeleted = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.deviceID != null && message.hasOwnProperty("deviceID")) + object.deviceID = message.deviceID; + if (message.isDeleted != null && message.hasOwnProperty("isDeleted")) + object.isDeleted = message.isDeleted; + return object; + }; + + /** + * Converts this AgentAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.AgentAction + * @instance + * @returns {Object.} JSON object + */ + AgentAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AgentAction; + })(); + + SyncActionValue.AndroidUnsupportedActions = (function() { + + /** + * Properties of an AndroidUnsupportedActions. + * @memberof proto.SyncActionValue + * @interface IAndroidUnsupportedActions + * @property {boolean|null} [allowed] AndroidUnsupportedActions allowed + */ + + /** + * Constructs a new AndroidUnsupportedActions. + * @memberof proto.SyncActionValue + * @classdesc Represents an AndroidUnsupportedActions. + * @implements IAndroidUnsupportedActions + * @constructor + * @param {proto.SyncActionValue.IAndroidUnsupportedActions=} [properties] Properties to set + */ + function AndroidUnsupportedActions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AndroidUnsupportedActions allowed. + * @member {boolean} allowed + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @instance + */ + AndroidUnsupportedActions.prototype.allowed = false; + + /** + * Creates a new AndroidUnsupportedActions instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {proto.SyncActionValue.IAndroidUnsupportedActions=} [properties] Properties to set + * @returns {proto.SyncActionValue.AndroidUnsupportedActions} AndroidUnsupportedActions instance + */ + AndroidUnsupportedActions.create = function create(properties) { + return new AndroidUnsupportedActions(properties); + }; + + /** + * Encodes the specified AndroidUnsupportedActions message. Does not implicitly {@link proto.SyncActionValue.AndroidUnsupportedActions.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {proto.SyncActionValue.IAndroidUnsupportedActions} message AndroidUnsupportedActions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AndroidUnsupportedActions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowed != null && Object.hasOwnProperty.call(message, "allowed")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.allowed); + return writer; + }; + + /** + * Encodes the specified AndroidUnsupportedActions message, length delimited. Does not implicitly {@link proto.SyncActionValue.AndroidUnsupportedActions.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {proto.SyncActionValue.IAndroidUnsupportedActions} message AndroidUnsupportedActions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AndroidUnsupportedActions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AndroidUnsupportedActions message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.AndroidUnsupportedActions} AndroidUnsupportedActions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AndroidUnsupportedActions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.AndroidUnsupportedActions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AndroidUnsupportedActions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.AndroidUnsupportedActions} AndroidUnsupportedActions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AndroidUnsupportedActions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AndroidUnsupportedActions message. + * @function verify + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AndroidUnsupportedActions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowed != null && message.hasOwnProperty("allowed")) + if (typeof message.allowed !== "boolean") + return "allowed: boolean expected"; + return null; + }; + + /** + * Creates an AndroidUnsupportedActions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.AndroidUnsupportedActions} AndroidUnsupportedActions + */ + AndroidUnsupportedActions.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.AndroidUnsupportedActions) + return object; + var message = new $root.proto.SyncActionValue.AndroidUnsupportedActions(); + if (object.allowed != null) + message.allowed = Boolean(object.allowed); + return message; + }; + + /** + * Creates a plain object from an AndroidUnsupportedActions message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @static + * @param {proto.SyncActionValue.AndroidUnsupportedActions} message AndroidUnsupportedActions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AndroidUnsupportedActions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.allowed = false; + if (message.allowed != null && message.hasOwnProperty("allowed")) + object.allowed = message.allowed; + return object; + }; + + /** + * Converts this AndroidUnsupportedActions to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.AndroidUnsupportedActions + * @instance + * @returns {Object.} JSON object + */ + AndroidUnsupportedActions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AndroidUnsupportedActions; + })(); + + SyncActionValue.ArchiveChatAction = (function() { + + /** + * Properties of an ArchiveChatAction. + * @memberof proto.SyncActionValue + * @interface IArchiveChatAction + * @property {boolean|null} [archived] ArchiveChatAction archived + * @property {proto.SyncActionValue.ISyncActionMessageRange|null} [messageRange] ArchiveChatAction messageRange + */ + + /** + * Constructs a new ArchiveChatAction. + * @memberof proto.SyncActionValue + * @classdesc Represents an ArchiveChatAction. + * @implements IArchiveChatAction + * @constructor + * @param {proto.SyncActionValue.IArchiveChatAction=} [properties] Properties to set + */ + function ArchiveChatAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ArchiveChatAction archived. + * @member {boolean} archived + * @memberof proto.SyncActionValue.ArchiveChatAction + * @instance + */ + ArchiveChatAction.prototype.archived = false; + + /** + * ArchiveChatAction messageRange. + * @member {proto.SyncActionValue.ISyncActionMessageRange|null|undefined} messageRange + * @memberof proto.SyncActionValue.ArchiveChatAction + * @instance + */ + ArchiveChatAction.prototype.messageRange = null; + + /** + * Creates a new ArchiveChatAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {proto.SyncActionValue.IArchiveChatAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.ArchiveChatAction} ArchiveChatAction instance + */ + ArchiveChatAction.create = function create(properties) { + return new ArchiveChatAction(properties); + }; + + /** + * Encodes the specified ArchiveChatAction message. Does not implicitly {@link proto.SyncActionValue.ArchiveChatAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {proto.SyncActionValue.IArchiveChatAction} message ArchiveChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArchiveChatAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.archived != null && Object.hasOwnProperty.call(message, "archived")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.archived); + if (message.messageRange != null && Object.hasOwnProperty.call(message, "messageRange")) + $root.proto.SyncActionValue.SyncActionMessageRange.encode(message.messageRange, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ArchiveChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ArchiveChatAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {proto.SyncActionValue.IArchiveChatAction} message ArchiveChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArchiveChatAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ArchiveChatAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.ArchiveChatAction} ArchiveChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArchiveChatAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.ArchiveChatAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.archived = reader.bool(); + break; + case 2: + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ArchiveChatAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.ArchiveChatAction} ArchiveChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArchiveChatAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ArchiveChatAction message. + * @function verify + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ArchiveChatAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.archived != null && message.hasOwnProperty("archived")) + if (typeof message.archived !== "boolean") + return "archived: boolean expected"; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) { + var error = $root.proto.SyncActionValue.SyncActionMessageRange.verify(message.messageRange); + if (error) + return "messageRange." + error; + } + return null; + }; + + /** + * Creates an ArchiveChatAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.ArchiveChatAction} ArchiveChatAction + */ + ArchiveChatAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.ArchiveChatAction) + return object; + var message = new $root.proto.SyncActionValue.ArchiveChatAction(); + if (object.archived != null) + message.archived = Boolean(object.archived); + if (object.messageRange != null) { + if (typeof object.messageRange !== "object") + throw TypeError(".proto.SyncActionValue.ArchiveChatAction.messageRange: object expected"); + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.fromObject(object.messageRange); + } + return message; + }; + + /** + * Creates a plain object from an ArchiveChatAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.ArchiveChatAction + * @static + * @param {proto.SyncActionValue.ArchiveChatAction} message ArchiveChatAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ArchiveChatAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.archived = false; + object.messageRange = null; + } + if (message.archived != null && message.hasOwnProperty("archived")) + object.archived = message.archived; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) + object.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.toObject(message.messageRange, options); + return object; + }; + + /** + * Converts this ArchiveChatAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.ArchiveChatAction + * @instance + * @returns {Object.} JSON object + */ + ArchiveChatAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ArchiveChatAction; + })(); + + SyncActionValue.ChatAssignmentAction = (function() { + + /** + * Properties of a ChatAssignmentAction. + * @memberof proto.SyncActionValue + * @interface IChatAssignmentAction + * @property {string|null} [deviceAgentID] ChatAssignmentAction deviceAgentID + */ + + /** + * Constructs a new ChatAssignmentAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a ChatAssignmentAction. + * @implements IChatAssignmentAction + * @constructor + * @param {proto.SyncActionValue.IChatAssignmentAction=} [properties] Properties to set + */ + function ChatAssignmentAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChatAssignmentAction deviceAgentID. + * @member {string} deviceAgentID + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @instance + */ + ChatAssignmentAction.prototype.deviceAgentID = ""; + + /** + * Creates a new ChatAssignmentAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {proto.SyncActionValue.IChatAssignmentAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.ChatAssignmentAction} ChatAssignmentAction instance + */ + ChatAssignmentAction.create = function create(properties) { + return new ChatAssignmentAction(properties); + }; + + /** + * Encodes the specified ChatAssignmentAction message. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {proto.SyncActionValue.IChatAssignmentAction} message ChatAssignmentAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChatAssignmentAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deviceAgentID != null && Object.hasOwnProperty.call(message, "deviceAgentID")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.deviceAgentID); + return writer; + }; + + /** + * Encodes the specified ChatAssignmentAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {proto.SyncActionValue.IChatAssignmentAction} message ChatAssignmentAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChatAssignmentAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChatAssignmentAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.ChatAssignmentAction} ChatAssignmentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChatAssignmentAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.ChatAssignmentAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deviceAgentID = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChatAssignmentAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.ChatAssignmentAction} ChatAssignmentAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChatAssignmentAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChatAssignmentAction message. + * @function verify + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChatAssignmentAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deviceAgentID != null && message.hasOwnProperty("deviceAgentID")) + if (!$util.isString(message.deviceAgentID)) + return "deviceAgentID: string expected"; + return null; + }; + + /** + * Creates a ChatAssignmentAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.ChatAssignmentAction} ChatAssignmentAction + */ + ChatAssignmentAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.ChatAssignmentAction) + return object; + var message = new $root.proto.SyncActionValue.ChatAssignmentAction(); + if (object.deviceAgentID != null) + message.deviceAgentID = String(object.deviceAgentID); + return message; + }; + + /** + * Creates a plain object from a ChatAssignmentAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @static + * @param {proto.SyncActionValue.ChatAssignmentAction} message ChatAssignmentAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChatAssignmentAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.deviceAgentID = ""; + if (message.deviceAgentID != null && message.hasOwnProperty("deviceAgentID")) + object.deviceAgentID = message.deviceAgentID; + return object; + }; + + /** + * Converts this ChatAssignmentAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.ChatAssignmentAction + * @instance + * @returns {Object.} JSON object + */ + ChatAssignmentAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ChatAssignmentAction; + })(); + + SyncActionValue.ChatAssignmentOpenedStatusAction = (function() { + + /** + * Properties of a ChatAssignmentOpenedStatusAction. + * @memberof proto.SyncActionValue + * @interface IChatAssignmentOpenedStatusAction + * @property {boolean|null} [chatOpened] ChatAssignmentOpenedStatusAction chatOpened + */ + + /** + * Constructs a new ChatAssignmentOpenedStatusAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a ChatAssignmentOpenedStatusAction. + * @implements IChatAssignmentOpenedStatusAction + * @constructor + * @param {proto.SyncActionValue.IChatAssignmentOpenedStatusAction=} [properties] Properties to set + */ + function ChatAssignmentOpenedStatusAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChatAssignmentOpenedStatusAction chatOpened. + * @member {boolean} chatOpened + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @instance + */ + ChatAssignmentOpenedStatusAction.prototype.chatOpened = false; + + /** + * Creates a new ChatAssignmentOpenedStatusAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {proto.SyncActionValue.IChatAssignmentOpenedStatusAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.ChatAssignmentOpenedStatusAction} ChatAssignmentOpenedStatusAction instance + */ + ChatAssignmentOpenedStatusAction.create = function create(properties) { + return new ChatAssignmentOpenedStatusAction(properties); + }; + + /** + * Encodes the specified ChatAssignmentOpenedStatusAction message. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentOpenedStatusAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {proto.SyncActionValue.IChatAssignmentOpenedStatusAction} message ChatAssignmentOpenedStatusAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChatAssignmentOpenedStatusAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chatOpened != null && Object.hasOwnProperty.call(message, "chatOpened")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.chatOpened); + return writer; + }; + + /** + * Encodes the specified ChatAssignmentOpenedStatusAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ChatAssignmentOpenedStatusAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {proto.SyncActionValue.IChatAssignmentOpenedStatusAction} message ChatAssignmentOpenedStatusAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChatAssignmentOpenedStatusAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChatAssignmentOpenedStatusAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.ChatAssignmentOpenedStatusAction} ChatAssignmentOpenedStatusAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChatAssignmentOpenedStatusAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chatOpened = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChatAssignmentOpenedStatusAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.ChatAssignmentOpenedStatusAction} ChatAssignmentOpenedStatusAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChatAssignmentOpenedStatusAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChatAssignmentOpenedStatusAction message. + * @function verify + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChatAssignmentOpenedStatusAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chatOpened != null && message.hasOwnProperty("chatOpened")) + if (typeof message.chatOpened !== "boolean") + return "chatOpened: boolean expected"; + return null; + }; + + /** + * Creates a ChatAssignmentOpenedStatusAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.ChatAssignmentOpenedStatusAction} ChatAssignmentOpenedStatusAction + */ + ChatAssignmentOpenedStatusAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction) + return object; + var message = new $root.proto.SyncActionValue.ChatAssignmentOpenedStatusAction(); + if (object.chatOpened != null) + message.chatOpened = Boolean(object.chatOpened); + return message; + }; + + /** + * Creates a plain object from a ChatAssignmentOpenedStatusAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @static + * @param {proto.SyncActionValue.ChatAssignmentOpenedStatusAction} message ChatAssignmentOpenedStatusAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChatAssignmentOpenedStatusAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.chatOpened = false; + if (message.chatOpened != null && message.hasOwnProperty("chatOpened")) + object.chatOpened = message.chatOpened; + return object; + }; + + /** + * Converts this ChatAssignmentOpenedStatusAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.ChatAssignmentOpenedStatusAction + * @instance + * @returns {Object.} JSON object + */ + ChatAssignmentOpenedStatusAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ChatAssignmentOpenedStatusAction; + })(); + + SyncActionValue.ClearChatAction = (function() { + + /** + * Properties of a ClearChatAction. + * @memberof proto.SyncActionValue + * @interface IClearChatAction + * @property {proto.SyncActionValue.ISyncActionMessageRange|null} [messageRange] ClearChatAction messageRange + */ + + /** + * Constructs a new ClearChatAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a ClearChatAction. + * @implements IClearChatAction + * @constructor + * @param {proto.SyncActionValue.IClearChatAction=} [properties] Properties to set + */ + function ClearChatAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClearChatAction messageRange. + * @member {proto.SyncActionValue.ISyncActionMessageRange|null|undefined} messageRange + * @memberof proto.SyncActionValue.ClearChatAction + * @instance + */ + ClearChatAction.prototype.messageRange = null; + + /** + * Creates a new ClearChatAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {proto.SyncActionValue.IClearChatAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.ClearChatAction} ClearChatAction instance + */ + ClearChatAction.create = function create(properties) { + return new ClearChatAction(properties); + }; + + /** + * Encodes the specified ClearChatAction message. Does not implicitly {@link proto.SyncActionValue.ClearChatAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {proto.SyncActionValue.IClearChatAction} message ClearChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearChatAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageRange != null && Object.hasOwnProperty.call(message, "messageRange")) + $root.proto.SyncActionValue.SyncActionMessageRange.encode(message.messageRange, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClearChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ClearChatAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {proto.SyncActionValue.IClearChatAction} message ClearChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearChatAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClearChatAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.ClearChatAction} ClearChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearChatAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.ClearChatAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClearChatAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.ClearChatAction} ClearChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearChatAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClearChatAction message. + * @function verify + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClearChatAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) { + var error = $root.proto.SyncActionValue.SyncActionMessageRange.verify(message.messageRange); + if (error) + return "messageRange." + error; + } + return null; + }; + + /** + * Creates a ClearChatAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.ClearChatAction} ClearChatAction + */ + ClearChatAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.ClearChatAction) + return object; + var message = new $root.proto.SyncActionValue.ClearChatAction(); + if (object.messageRange != null) { + if (typeof object.messageRange !== "object") + throw TypeError(".proto.SyncActionValue.ClearChatAction.messageRange: object expected"); + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.fromObject(object.messageRange); + } + return message; + }; + + /** + * Creates a plain object from a ClearChatAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.ClearChatAction + * @static + * @param {proto.SyncActionValue.ClearChatAction} message ClearChatAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClearChatAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.messageRange = null; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) + object.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.toObject(message.messageRange, options); + return object; + }; + + /** + * Converts this ClearChatAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.ClearChatAction + * @instance + * @returns {Object.} JSON object + */ + ClearChatAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ClearChatAction; + })(); + + SyncActionValue.ContactAction = (function() { + + /** + * Properties of a ContactAction. + * @memberof proto.SyncActionValue + * @interface IContactAction + * @property {string|null} [fullName] ContactAction fullName + * @property {string|null} [firstName] ContactAction firstName + * @property {string|null} [lidJid] ContactAction lidJid + */ + + /** + * Constructs a new ContactAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a ContactAction. + * @implements IContactAction + * @constructor + * @param {proto.SyncActionValue.IContactAction=} [properties] Properties to set + */ + function ContactAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContactAction fullName. + * @member {string} fullName + * @memberof proto.SyncActionValue.ContactAction + * @instance + */ + ContactAction.prototype.fullName = ""; + + /** + * ContactAction firstName. + * @member {string} firstName + * @memberof proto.SyncActionValue.ContactAction + * @instance + */ + ContactAction.prototype.firstName = ""; + + /** + * ContactAction lidJid. + * @member {string} lidJid + * @memberof proto.SyncActionValue.ContactAction + * @instance + */ + ContactAction.prototype.lidJid = ""; + + /** + * Creates a new ContactAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {proto.SyncActionValue.IContactAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.ContactAction} ContactAction instance + */ + ContactAction.create = function create(properties) { + return new ContactAction(properties); + }; + + /** + * Encodes the specified ContactAction message. Does not implicitly {@link proto.SyncActionValue.ContactAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {proto.SyncActionValue.IContactAction} message ContactAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContactAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fullName); + if (message.firstName != null && Object.hasOwnProperty.call(message, "firstName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.firstName); + if (message.lidJid != null && Object.hasOwnProperty.call(message, "lidJid")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.lidJid); + return writer; + }; + + /** + * Encodes the specified ContactAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.ContactAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {proto.SyncActionValue.IContactAction} message ContactAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContactAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContactAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.ContactAction} ContactAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContactAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.ContactAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fullName = reader.string(); + break; + case 2: + message.firstName = reader.string(); + break; + case 3: + message.lidJid = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContactAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.ContactAction} ContactAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContactAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContactAction message. + * @function verify + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContactAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fullName != null && message.hasOwnProperty("fullName")) + if (!$util.isString(message.fullName)) + return "fullName: string expected"; + if (message.firstName != null && message.hasOwnProperty("firstName")) + if (!$util.isString(message.firstName)) + return "firstName: string expected"; + if (message.lidJid != null && message.hasOwnProperty("lidJid")) + if (!$util.isString(message.lidJid)) + return "lidJid: string expected"; + return null; + }; + + /** + * Creates a ContactAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.ContactAction} ContactAction + */ + ContactAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.ContactAction) + return object; + var message = new $root.proto.SyncActionValue.ContactAction(); + if (object.fullName != null) + message.fullName = String(object.fullName); + if (object.firstName != null) + message.firstName = String(object.firstName); + if (object.lidJid != null) + message.lidJid = String(object.lidJid); + return message; + }; + + /** + * Creates a plain object from a ContactAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.ContactAction + * @static + * @param {proto.SyncActionValue.ContactAction} message ContactAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContactAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fullName = ""; + object.firstName = ""; + object.lidJid = ""; + } + if (message.fullName != null && message.hasOwnProperty("fullName")) + object.fullName = message.fullName; + if (message.firstName != null && message.hasOwnProperty("firstName")) + object.firstName = message.firstName; + if (message.lidJid != null && message.hasOwnProperty("lidJid")) + object.lidJid = message.lidJid; + return object; + }; + + /** + * Converts this ContactAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.ContactAction + * @instance + * @returns {Object.} JSON object + */ + ContactAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ContactAction; + })(); + + SyncActionValue.DeleteChatAction = (function() { + + /** + * Properties of a DeleteChatAction. + * @memberof proto.SyncActionValue + * @interface IDeleteChatAction + * @property {proto.SyncActionValue.ISyncActionMessageRange|null} [messageRange] DeleteChatAction messageRange + */ + + /** + * Constructs a new DeleteChatAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a DeleteChatAction. + * @implements IDeleteChatAction + * @constructor + * @param {proto.SyncActionValue.IDeleteChatAction=} [properties] Properties to set + */ + function DeleteChatAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteChatAction messageRange. + * @member {proto.SyncActionValue.ISyncActionMessageRange|null|undefined} messageRange + * @memberof proto.SyncActionValue.DeleteChatAction + * @instance + */ + DeleteChatAction.prototype.messageRange = null; + + /** + * Creates a new DeleteChatAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {proto.SyncActionValue.IDeleteChatAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.DeleteChatAction} DeleteChatAction instance + */ + DeleteChatAction.create = function create(properties) { + return new DeleteChatAction(properties); + }; + + /** + * Encodes the specified DeleteChatAction message. Does not implicitly {@link proto.SyncActionValue.DeleteChatAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {proto.SyncActionValue.IDeleteChatAction} message DeleteChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteChatAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageRange != null && Object.hasOwnProperty.call(message, "messageRange")) + $root.proto.SyncActionValue.SyncActionMessageRange.encode(message.messageRange, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.DeleteChatAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {proto.SyncActionValue.IDeleteChatAction} message DeleteChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteChatAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteChatAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.DeleteChatAction} DeleteChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteChatAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.DeleteChatAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteChatAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.DeleteChatAction} DeleteChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteChatAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteChatAction message. + * @function verify + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteChatAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) { + var error = $root.proto.SyncActionValue.SyncActionMessageRange.verify(message.messageRange); + if (error) + return "messageRange." + error; + } + return null; + }; + + /** + * Creates a DeleteChatAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.DeleteChatAction} DeleteChatAction + */ + DeleteChatAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.DeleteChatAction) + return object; + var message = new $root.proto.SyncActionValue.DeleteChatAction(); + if (object.messageRange != null) { + if (typeof object.messageRange !== "object") + throw TypeError(".proto.SyncActionValue.DeleteChatAction.messageRange: object expected"); + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.fromObject(object.messageRange); + } + return message; + }; + + /** + * Creates a plain object from a DeleteChatAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.DeleteChatAction + * @static + * @param {proto.SyncActionValue.DeleteChatAction} message DeleteChatAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteChatAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.messageRange = null; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) + object.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.toObject(message.messageRange, options); + return object; + }; + + /** + * Converts this DeleteChatAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.DeleteChatAction + * @instance + * @returns {Object.} JSON object + */ + DeleteChatAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteChatAction; + })(); + + SyncActionValue.DeleteMessageForMeAction = (function() { + + /** + * Properties of a DeleteMessageForMeAction. + * @memberof proto.SyncActionValue + * @interface IDeleteMessageForMeAction + * @property {boolean|null} [deleteMedia] DeleteMessageForMeAction deleteMedia + * @property {number|Long|null} [messageTimestamp] DeleteMessageForMeAction messageTimestamp + */ + + /** + * Constructs a new DeleteMessageForMeAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a DeleteMessageForMeAction. + * @implements IDeleteMessageForMeAction + * @constructor + * @param {proto.SyncActionValue.IDeleteMessageForMeAction=} [properties] Properties to set + */ + function DeleteMessageForMeAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteMessageForMeAction deleteMedia. + * @member {boolean} deleteMedia + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @instance + */ + DeleteMessageForMeAction.prototype.deleteMedia = false; + + /** + * DeleteMessageForMeAction messageTimestamp. + * @member {number|Long} messageTimestamp + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @instance + */ + DeleteMessageForMeAction.prototype.messageTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new DeleteMessageForMeAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {proto.SyncActionValue.IDeleteMessageForMeAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.DeleteMessageForMeAction} DeleteMessageForMeAction instance + */ + DeleteMessageForMeAction.create = function create(properties) { + return new DeleteMessageForMeAction(properties); + }; + + /** + * Encodes the specified DeleteMessageForMeAction message. Does not implicitly {@link proto.SyncActionValue.DeleteMessageForMeAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {proto.SyncActionValue.IDeleteMessageForMeAction} message DeleteMessageForMeAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteMessageForMeAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deleteMedia != null && Object.hasOwnProperty.call(message, "deleteMedia")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deleteMedia); + if (message.messageTimestamp != null && Object.hasOwnProperty.call(message, "messageTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.messageTimestamp); + return writer; + }; + + /** + * Encodes the specified DeleteMessageForMeAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.DeleteMessageForMeAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {proto.SyncActionValue.IDeleteMessageForMeAction} message DeleteMessageForMeAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteMessageForMeAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteMessageForMeAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.DeleteMessageForMeAction} DeleteMessageForMeAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteMessageForMeAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.DeleteMessageForMeAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deleteMedia = reader.bool(); + break; + case 2: + message.messageTimestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteMessageForMeAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.DeleteMessageForMeAction} DeleteMessageForMeAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteMessageForMeAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteMessageForMeAction message. + * @function verify + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteMessageForMeAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deleteMedia != null && message.hasOwnProperty("deleteMedia")) + if (typeof message.deleteMedia !== "boolean") + return "deleteMedia: boolean expected"; + if (message.messageTimestamp != null && message.hasOwnProperty("messageTimestamp")) + if (!$util.isInteger(message.messageTimestamp) && !(message.messageTimestamp && $util.isInteger(message.messageTimestamp.low) && $util.isInteger(message.messageTimestamp.high))) + return "messageTimestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a DeleteMessageForMeAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.DeleteMessageForMeAction} DeleteMessageForMeAction + */ + DeleteMessageForMeAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.DeleteMessageForMeAction) + return object; + var message = new $root.proto.SyncActionValue.DeleteMessageForMeAction(); + if (object.deleteMedia != null) + message.deleteMedia = Boolean(object.deleteMedia); + if (object.messageTimestamp != null) + if ($util.Long) + (message.messageTimestamp = $util.Long.fromValue(object.messageTimestamp)).unsigned = false; + else if (typeof object.messageTimestamp === "string") + message.messageTimestamp = parseInt(object.messageTimestamp, 10); + else if (typeof object.messageTimestamp === "number") + message.messageTimestamp = object.messageTimestamp; + else if (typeof object.messageTimestamp === "object") + message.messageTimestamp = new $util.LongBits(object.messageTimestamp.low >>> 0, object.messageTimestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a DeleteMessageForMeAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @static + * @param {proto.SyncActionValue.DeleteMessageForMeAction} message DeleteMessageForMeAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteMessageForMeAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.deleteMedia = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.messageTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.messageTimestamp = options.longs === String ? "0" : 0; + } + if (message.deleteMedia != null && message.hasOwnProperty("deleteMedia")) + object.deleteMedia = message.deleteMedia; + if (message.messageTimestamp != null && message.hasOwnProperty("messageTimestamp")) + if (typeof message.messageTimestamp === "number") + object.messageTimestamp = options.longs === String ? String(message.messageTimestamp) : message.messageTimestamp; + else + object.messageTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.messageTimestamp) : options.longs === Number ? new $util.LongBits(message.messageTimestamp.low >>> 0, message.messageTimestamp.high >>> 0).toNumber() : message.messageTimestamp; + return object; + }; + + /** + * Converts this DeleteMessageForMeAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.DeleteMessageForMeAction + * @instance + * @returns {Object.} JSON object + */ + DeleteMessageForMeAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteMessageForMeAction; + })(); + + SyncActionValue.KeyExpiration = (function() { + + /** + * Properties of a KeyExpiration. + * @memberof proto.SyncActionValue + * @interface IKeyExpiration + * @property {number|null} [expiredKeyEpoch] KeyExpiration expiredKeyEpoch + */ + + /** + * Constructs a new KeyExpiration. + * @memberof proto.SyncActionValue + * @classdesc Represents a KeyExpiration. + * @implements IKeyExpiration + * @constructor + * @param {proto.SyncActionValue.IKeyExpiration=} [properties] Properties to set + */ + function KeyExpiration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyExpiration expiredKeyEpoch. + * @member {number} expiredKeyEpoch + * @memberof proto.SyncActionValue.KeyExpiration + * @instance + */ + KeyExpiration.prototype.expiredKeyEpoch = 0; + + /** + * Creates a new KeyExpiration instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {proto.SyncActionValue.IKeyExpiration=} [properties] Properties to set + * @returns {proto.SyncActionValue.KeyExpiration} KeyExpiration instance + */ + KeyExpiration.create = function create(properties) { + return new KeyExpiration(properties); + }; + + /** + * Encodes the specified KeyExpiration message. Does not implicitly {@link proto.SyncActionValue.KeyExpiration.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {proto.SyncActionValue.IKeyExpiration} message KeyExpiration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyExpiration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.expiredKeyEpoch != null && Object.hasOwnProperty.call(message, "expiredKeyEpoch")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.expiredKeyEpoch); + return writer; + }; + + /** + * Encodes the specified KeyExpiration message, length delimited. Does not implicitly {@link proto.SyncActionValue.KeyExpiration.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {proto.SyncActionValue.IKeyExpiration} message KeyExpiration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyExpiration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyExpiration message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.KeyExpiration} KeyExpiration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyExpiration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.KeyExpiration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expiredKeyEpoch = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyExpiration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.KeyExpiration} KeyExpiration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyExpiration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyExpiration message. + * @function verify + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyExpiration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expiredKeyEpoch != null && message.hasOwnProperty("expiredKeyEpoch")) + if (!$util.isInteger(message.expiredKeyEpoch)) + return "expiredKeyEpoch: integer expected"; + return null; + }; + + /** + * Creates a KeyExpiration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.KeyExpiration} KeyExpiration + */ + KeyExpiration.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.KeyExpiration) + return object; + var message = new $root.proto.SyncActionValue.KeyExpiration(); + if (object.expiredKeyEpoch != null) + message.expiredKeyEpoch = object.expiredKeyEpoch | 0; + return message; + }; + + /** + * Creates a plain object from a KeyExpiration message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.KeyExpiration + * @static + * @param {proto.SyncActionValue.KeyExpiration} message KeyExpiration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyExpiration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.expiredKeyEpoch = 0; + if (message.expiredKeyEpoch != null && message.hasOwnProperty("expiredKeyEpoch")) + object.expiredKeyEpoch = message.expiredKeyEpoch; + return object; + }; + + /** + * Converts this KeyExpiration to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.KeyExpiration + * @instance + * @returns {Object.} JSON object + */ + KeyExpiration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return KeyExpiration; + })(); + + SyncActionValue.LabelAssociationAction = (function() { + + /** + * Properties of a LabelAssociationAction. + * @memberof proto.SyncActionValue + * @interface ILabelAssociationAction + * @property {boolean|null} [labeled] LabelAssociationAction labeled + */ + + /** + * Constructs a new LabelAssociationAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a LabelAssociationAction. + * @implements ILabelAssociationAction + * @constructor + * @param {proto.SyncActionValue.ILabelAssociationAction=} [properties] Properties to set + */ + function LabelAssociationAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LabelAssociationAction labeled. + * @member {boolean} labeled + * @memberof proto.SyncActionValue.LabelAssociationAction + * @instance + */ + LabelAssociationAction.prototype.labeled = false; + + /** + * Creates a new LabelAssociationAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {proto.SyncActionValue.ILabelAssociationAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.LabelAssociationAction} LabelAssociationAction instance + */ + LabelAssociationAction.create = function create(properties) { + return new LabelAssociationAction(properties); + }; + + /** + * Encodes the specified LabelAssociationAction message. Does not implicitly {@link proto.SyncActionValue.LabelAssociationAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {proto.SyncActionValue.ILabelAssociationAction} message LabelAssociationAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelAssociationAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labeled != null && Object.hasOwnProperty.call(message, "labeled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.labeled); + return writer; + }; + + /** + * Encodes the specified LabelAssociationAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.LabelAssociationAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {proto.SyncActionValue.ILabelAssociationAction} message LabelAssociationAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelAssociationAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LabelAssociationAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.LabelAssociationAction} LabelAssociationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelAssociationAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.LabelAssociationAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.labeled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LabelAssociationAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.LabelAssociationAction} LabelAssociationAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelAssociationAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LabelAssociationAction message. + * @function verify + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LabelAssociationAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.labeled != null && message.hasOwnProperty("labeled")) + if (typeof message.labeled !== "boolean") + return "labeled: boolean expected"; + return null; + }; + + /** + * Creates a LabelAssociationAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.LabelAssociationAction} LabelAssociationAction + */ + LabelAssociationAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.LabelAssociationAction) + return object; + var message = new $root.proto.SyncActionValue.LabelAssociationAction(); + if (object.labeled != null) + message.labeled = Boolean(object.labeled); + return message; + }; + + /** + * Creates a plain object from a LabelAssociationAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.LabelAssociationAction + * @static + * @param {proto.SyncActionValue.LabelAssociationAction} message LabelAssociationAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LabelAssociationAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.labeled = false; + if (message.labeled != null && message.hasOwnProperty("labeled")) + object.labeled = message.labeled; + return object; + }; + + /** + * Converts this LabelAssociationAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.LabelAssociationAction + * @instance + * @returns {Object.} JSON object + */ + LabelAssociationAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LabelAssociationAction; + })(); + + SyncActionValue.LabelEditAction = (function() { + + /** + * Properties of a LabelEditAction. + * @memberof proto.SyncActionValue + * @interface ILabelEditAction + * @property {string|null} [name] LabelEditAction name + * @property {number|null} [color] LabelEditAction color + * @property {number|null} [predefinedId] LabelEditAction predefinedId + * @property {boolean|null} [deleted] LabelEditAction deleted + */ + + /** + * Constructs a new LabelEditAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a LabelEditAction. + * @implements ILabelEditAction + * @constructor + * @param {proto.SyncActionValue.ILabelEditAction=} [properties] Properties to set + */ + function LabelEditAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LabelEditAction name. + * @member {string} name + * @memberof proto.SyncActionValue.LabelEditAction + * @instance + */ + LabelEditAction.prototype.name = ""; + + /** + * LabelEditAction color. + * @member {number} color + * @memberof proto.SyncActionValue.LabelEditAction + * @instance + */ + LabelEditAction.prototype.color = 0; + + /** + * LabelEditAction predefinedId. + * @member {number} predefinedId + * @memberof proto.SyncActionValue.LabelEditAction + * @instance + */ + LabelEditAction.prototype.predefinedId = 0; + + /** + * LabelEditAction deleted. + * @member {boolean} deleted + * @memberof proto.SyncActionValue.LabelEditAction + * @instance + */ + LabelEditAction.prototype.deleted = false; + + /** + * Creates a new LabelEditAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {proto.SyncActionValue.ILabelEditAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.LabelEditAction} LabelEditAction instance + */ + LabelEditAction.create = function create(properties) { + return new LabelEditAction(properties); + }; + + /** + * Encodes the specified LabelEditAction message. Does not implicitly {@link proto.SyncActionValue.LabelEditAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {proto.SyncActionValue.ILabelEditAction} message LabelEditAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelEditAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.color != null && Object.hasOwnProperty.call(message, "color")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.color); + if (message.predefinedId != null && Object.hasOwnProperty.call(message, "predefinedId")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.predefinedId); + if (message.deleted != null && Object.hasOwnProperty.call(message, "deleted")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.deleted); + return writer; + }; + + /** + * Encodes the specified LabelEditAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.LabelEditAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {proto.SyncActionValue.ILabelEditAction} message LabelEditAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelEditAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LabelEditAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.LabelEditAction} LabelEditAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelEditAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.LabelEditAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.color = reader.int32(); + break; + case 3: + message.predefinedId = reader.int32(); + break; + case 4: + message.deleted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LabelEditAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.LabelEditAction} LabelEditAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelEditAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LabelEditAction message. + * @function verify + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LabelEditAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.color != null && message.hasOwnProperty("color")) + if (!$util.isInteger(message.color)) + return "color: integer expected"; + if (message.predefinedId != null && message.hasOwnProperty("predefinedId")) + if (!$util.isInteger(message.predefinedId)) + return "predefinedId: integer expected"; + if (message.deleted != null && message.hasOwnProperty("deleted")) + if (typeof message.deleted !== "boolean") + return "deleted: boolean expected"; + return null; + }; + + /** + * Creates a LabelEditAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.LabelEditAction} LabelEditAction + */ + LabelEditAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.LabelEditAction) + return object; + var message = new $root.proto.SyncActionValue.LabelEditAction(); + if (object.name != null) + message.name = String(object.name); + if (object.color != null) + message.color = object.color | 0; + if (object.predefinedId != null) + message.predefinedId = object.predefinedId | 0; + if (object.deleted != null) + message.deleted = Boolean(object.deleted); + return message; + }; + + /** + * Creates a plain object from a LabelEditAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.LabelEditAction + * @static + * @param {proto.SyncActionValue.LabelEditAction} message LabelEditAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LabelEditAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.color = 0; + object.predefinedId = 0; + object.deleted = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.color != null && message.hasOwnProperty("color")) + object.color = message.color; + if (message.predefinedId != null && message.hasOwnProperty("predefinedId")) + object.predefinedId = message.predefinedId; + if (message.deleted != null && message.hasOwnProperty("deleted")) + object.deleted = message.deleted; + return object; + }; + + /** + * Converts this LabelEditAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.LabelEditAction + * @instance + * @returns {Object.} JSON object + */ + LabelEditAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LabelEditAction; + })(); + + SyncActionValue.LocaleSetting = (function() { + + /** + * Properties of a LocaleSetting. + * @memberof proto.SyncActionValue + * @interface ILocaleSetting + * @property {string|null} [locale] LocaleSetting locale + */ + + /** + * Constructs a new LocaleSetting. + * @memberof proto.SyncActionValue + * @classdesc Represents a LocaleSetting. + * @implements ILocaleSetting + * @constructor + * @param {proto.SyncActionValue.ILocaleSetting=} [properties] Properties to set + */ + function LocaleSetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocaleSetting locale. + * @member {string} locale + * @memberof proto.SyncActionValue.LocaleSetting + * @instance + */ + LocaleSetting.prototype.locale = ""; + + /** + * Creates a new LocaleSetting instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {proto.SyncActionValue.ILocaleSetting=} [properties] Properties to set + * @returns {proto.SyncActionValue.LocaleSetting} LocaleSetting instance + */ + LocaleSetting.create = function create(properties) { + return new LocaleSetting(properties); + }; + + /** + * Encodes the specified LocaleSetting message. Does not implicitly {@link proto.SyncActionValue.LocaleSetting.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {proto.SyncActionValue.ILocaleSetting} message LocaleSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocaleSetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locale != null && Object.hasOwnProperty.call(message, "locale")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.locale); + return writer; + }; + + /** + * Encodes the specified LocaleSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.LocaleSetting.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {proto.SyncActionValue.ILocaleSetting} message LocaleSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocaleSetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocaleSetting message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.LocaleSetting} LocaleSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocaleSetting.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.LocaleSetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.locale = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocaleSetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.LocaleSetting} LocaleSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocaleSetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocaleSetting message. + * @function verify + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocaleSetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locale != null && message.hasOwnProperty("locale")) + if (!$util.isString(message.locale)) + return "locale: string expected"; + return null; + }; + + /** + * Creates a LocaleSetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.LocaleSetting} LocaleSetting + */ + LocaleSetting.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.LocaleSetting) + return object; + var message = new $root.proto.SyncActionValue.LocaleSetting(); + if (object.locale != null) + message.locale = String(object.locale); + return message; + }; + + /** + * Creates a plain object from a LocaleSetting message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.LocaleSetting + * @static + * @param {proto.SyncActionValue.LocaleSetting} message LocaleSetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocaleSetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.locale = ""; + if (message.locale != null && message.hasOwnProperty("locale")) + object.locale = message.locale; + return object; + }; + + /** + * Converts this LocaleSetting to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.LocaleSetting + * @instance + * @returns {Object.} JSON object + */ + LocaleSetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocaleSetting; + })(); + + SyncActionValue.MarkChatAsReadAction = (function() { + + /** + * Properties of a MarkChatAsReadAction. + * @memberof proto.SyncActionValue + * @interface IMarkChatAsReadAction + * @property {boolean|null} [read] MarkChatAsReadAction read + * @property {proto.SyncActionValue.ISyncActionMessageRange|null} [messageRange] MarkChatAsReadAction messageRange + */ + + /** + * Constructs a new MarkChatAsReadAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a MarkChatAsReadAction. + * @implements IMarkChatAsReadAction + * @constructor + * @param {proto.SyncActionValue.IMarkChatAsReadAction=} [properties] Properties to set + */ + function MarkChatAsReadAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MarkChatAsReadAction read. + * @member {boolean} read + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @instance + */ + MarkChatAsReadAction.prototype.read = false; + + /** + * MarkChatAsReadAction messageRange. + * @member {proto.SyncActionValue.ISyncActionMessageRange|null|undefined} messageRange + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @instance + */ + MarkChatAsReadAction.prototype.messageRange = null; + + /** + * Creates a new MarkChatAsReadAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {proto.SyncActionValue.IMarkChatAsReadAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.MarkChatAsReadAction} MarkChatAsReadAction instance + */ + MarkChatAsReadAction.create = function create(properties) { + return new MarkChatAsReadAction(properties); + }; + + /** + * Encodes the specified MarkChatAsReadAction message. Does not implicitly {@link proto.SyncActionValue.MarkChatAsReadAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {proto.SyncActionValue.IMarkChatAsReadAction} message MarkChatAsReadAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MarkChatAsReadAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.read != null && Object.hasOwnProperty.call(message, "read")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.read); + if (message.messageRange != null && Object.hasOwnProperty.call(message, "messageRange")) + $root.proto.SyncActionValue.SyncActionMessageRange.encode(message.messageRange, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MarkChatAsReadAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.MarkChatAsReadAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {proto.SyncActionValue.IMarkChatAsReadAction} message MarkChatAsReadAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MarkChatAsReadAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MarkChatAsReadAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.MarkChatAsReadAction} MarkChatAsReadAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MarkChatAsReadAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.MarkChatAsReadAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.read = reader.bool(); + break; + case 2: + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MarkChatAsReadAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.MarkChatAsReadAction} MarkChatAsReadAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MarkChatAsReadAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MarkChatAsReadAction message. + * @function verify + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MarkChatAsReadAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.read != null && message.hasOwnProperty("read")) + if (typeof message.read !== "boolean") + return "read: boolean expected"; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) { + var error = $root.proto.SyncActionValue.SyncActionMessageRange.verify(message.messageRange); + if (error) + return "messageRange." + error; + } + return null; + }; + + /** + * Creates a MarkChatAsReadAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.MarkChatAsReadAction} MarkChatAsReadAction + */ + MarkChatAsReadAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.MarkChatAsReadAction) + return object; + var message = new $root.proto.SyncActionValue.MarkChatAsReadAction(); + if (object.read != null) + message.read = Boolean(object.read); + if (object.messageRange != null) { + if (typeof object.messageRange !== "object") + throw TypeError(".proto.SyncActionValue.MarkChatAsReadAction.messageRange: object expected"); + message.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.fromObject(object.messageRange); + } + return message; + }; + + /** + * Creates a plain object from a MarkChatAsReadAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @static + * @param {proto.SyncActionValue.MarkChatAsReadAction} message MarkChatAsReadAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MarkChatAsReadAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.read = false; + object.messageRange = null; + } + if (message.read != null && message.hasOwnProperty("read")) + object.read = message.read; + if (message.messageRange != null && message.hasOwnProperty("messageRange")) + object.messageRange = $root.proto.SyncActionValue.SyncActionMessageRange.toObject(message.messageRange, options); + return object; + }; + + /** + * Converts this MarkChatAsReadAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.MarkChatAsReadAction + * @instance + * @returns {Object.} JSON object + */ + MarkChatAsReadAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MarkChatAsReadAction; + })(); + + SyncActionValue.MuteAction = (function() { + + /** + * Properties of a MuteAction. + * @memberof proto.SyncActionValue + * @interface IMuteAction + * @property {boolean|null} [muted] MuteAction muted + * @property {number|Long|null} [muteEndTimestamp] MuteAction muteEndTimestamp + * @property {boolean|null} [autoMuted] MuteAction autoMuted + */ + + /** + * Constructs a new MuteAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a MuteAction. + * @implements IMuteAction + * @constructor + * @param {proto.SyncActionValue.IMuteAction=} [properties] Properties to set + */ + function MuteAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MuteAction muted. + * @member {boolean} muted + * @memberof proto.SyncActionValue.MuteAction + * @instance + */ + MuteAction.prototype.muted = false; + + /** + * MuteAction muteEndTimestamp. + * @member {number|Long} muteEndTimestamp + * @memberof proto.SyncActionValue.MuteAction + * @instance + */ + MuteAction.prototype.muteEndTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * MuteAction autoMuted. + * @member {boolean} autoMuted + * @memberof proto.SyncActionValue.MuteAction + * @instance + */ + MuteAction.prototype.autoMuted = false; + + /** + * Creates a new MuteAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {proto.SyncActionValue.IMuteAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.MuteAction} MuteAction instance + */ + MuteAction.create = function create(properties) { + return new MuteAction(properties); + }; + + /** + * Encodes the specified MuteAction message. Does not implicitly {@link proto.SyncActionValue.MuteAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {proto.SyncActionValue.IMuteAction} message MuteAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MuteAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.muted != null && Object.hasOwnProperty.call(message, "muted")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.muted); + if (message.muteEndTimestamp != null && Object.hasOwnProperty.call(message, "muteEndTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.muteEndTimestamp); + if (message.autoMuted != null && Object.hasOwnProperty.call(message, "autoMuted")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.autoMuted); + return writer; + }; + + /** + * Encodes the specified MuteAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.MuteAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {proto.SyncActionValue.IMuteAction} message MuteAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MuteAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MuteAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.MuteAction} MuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MuteAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.MuteAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.muted = reader.bool(); + break; + case 2: + message.muteEndTimestamp = reader.int64(); + break; + case 3: + message.autoMuted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MuteAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.MuteAction} MuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MuteAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MuteAction message. + * @function verify + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MuteAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.muted != null && message.hasOwnProperty("muted")) + if (typeof message.muted !== "boolean") + return "muted: boolean expected"; + if (message.muteEndTimestamp != null && message.hasOwnProperty("muteEndTimestamp")) + if (!$util.isInteger(message.muteEndTimestamp) && !(message.muteEndTimestamp && $util.isInteger(message.muteEndTimestamp.low) && $util.isInteger(message.muteEndTimestamp.high))) + return "muteEndTimestamp: integer|Long expected"; + if (message.autoMuted != null && message.hasOwnProperty("autoMuted")) + if (typeof message.autoMuted !== "boolean") + return "autoMuted: boolean expected"; + return null; + }; + + /** + * Creates a MuteAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.MuteAction} MuteAction + */ + MuteAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.MuteAction) + return object; + var message = new $root.proto.SyncActionValue.MuteAction(); + if (object.muted != null) + message.muted = Boolean(object.muted); + if (object.muteEndTimestamp != null) + if ($util.Long) + (message.muteEndTimestamp = $util.Long.fromValue(object.muteEndTimestamp)).unsigned = false; + else if (typeof object.muteEndTimestamp === "string") + message.muteEndTimestamp = parseInt(object.muteEndTimestamp, 10); + else if (typeof object.muteEndTimestamp === "number") + message.muteEndTimestamp = object.muteEndTimestamp; + else if (typeof object.muteEndTimestamp === "object") + message.muteEndTimestamp = new $util.LongBits(object.muteEndTimestamp.low >>> 0, object.muteEndTimestamp.high >>> 0).toNumber(); + if (object.autoMuted != null) + message.autoMuted = Boolean(object.autoMuted); + return message; + }; + + /** + * Creates a plain object from a MuteAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.MuteAction + * @static + * @param {proto.SyncActionValue.MuteAction} message MuteAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MuteAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.muted = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.muteEndTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.muteEndTimestamp = options.longs === String ? "0" : 0; + object.autoMuted = false; + } + if (message.muted != null && message.hasOwnProperty("muted")) + object.muted = message.muted; + if (message.muteEndTimestamp != null && message.hasOwnProperty("muteEndTimestamp")) + if (typeof message.muteEndTimestamp === "number") + object.muteEndTimestamp = options.longs === String ? String(message.muteEndTimestamp) : message.muteEndTimestamp; + else + object.muteEndTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.muteEndTimestamp) : options.longs === Number ? new $util.LongBits(message.muteEndTimestamp.low >>> 0, message.muteEndTimestamp.high >>> 0).toNumber() : message.muteEndTimestamp; + if (message.autoMuted != null && message.hasOwnProperty("autoMuted")) + object.autoMuted = message.autoMuted; + return object; + }; + + /** + * Converts this MuteAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.MuteAction + * @instance + * @returns {Object.} JSON object + */ + MuteAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MuteAction; + })(); + + SyncActionValue.NuxAction = (function() { + + /** + * Properties of a NuxAction. + * @memberof proto.SyncActionValue + * @interface INuxAction + * @property {boolean|null} [acknowledged] NuxAction acknowledged + */ + + /** + * Constructs a new NuxAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a NuxAction. + * @implements INuxAction + * @constructor + * @param {proto.SyncActionValue.INuxAction=} [properties] Properties to set + */ + function NuxAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NuxAction acknowledged. + * @member {boolean} acknowledged + * @memberof proto.SyncActionValue.NuxAction + * @instance + */ + NuxAction.prototype.acknowledged = false; + + /** + * Creates a new NuxAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {proto.SyncActionValue.INuxAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.NuxAction} NuxAction instance + */ + NuxAction.create = function create(properties) { + return new NuxAction(properties); + }; + + /** + * Encodes the specified NuxAction message. Does not implicitly {@link proto.SyncActionValue.NuxAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {proto.SyncActionValue.INuxAction} message NuxAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NuxAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acknowledged != null && Object.hasOwnProperty.call(message, "acknowledged")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.acknowledged); + return writer; + }; + + /** + * Encodes the specified NuxAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.NuxAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {proto.SyncActionValue.INuxAction} message NuxAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NuxAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NuxAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.NuxAction} NuxAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NuxAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.NuxAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.acknowledged = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NuxAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.NuxAction} NuxAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NuxAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NuxAction message. + * @function verify + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NuxAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acknowledged != null && message.hasOwnProperty("acknowledged")) + if (typeof message.acknowledged !== "boolean") + return "acknowledged: boolean expected"; + return null; + }; + + /** + * Creates a NuxAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.NuxAction} NuxAction + */ + NuxAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.NuxAction) + return object; + var message = new $root.proto.SyncActionValue.NuxAction(); + if (object.acknowledged != null) + message.acknowledged = Boolean(object.acknowledged); + return message; + }; + + /** + * Creates a plain object from a NuxAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.NuxAction + * @static + * @param {proto.SyncActionValue.NuxAction} message NuxAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NuxAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.acknowledged = false; + if (message.acknowledged != null && message.hasOwnProperty("acknowledged")) + object.acknowledged = message.acknowledged; + return object; + }; + + /** + * Converts this NuxAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.NuxAction + * @instance + * @returns {Object.} JSON object + */ + NuxAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NuxAction; + })(); + + SyncActionValue.PinAction = (function() { + + /** + * Properties of a PinAction. + * @memberof proto.SyncActionValue + * @interface IPinAction + * @property {boolean|null} [pinned] PinAction pinned + */ + + /** + * Constructs a new PinAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a PinAction. + * @implements IPinAction + * @constructor + * @param {proto.SyncActionValue.IPinAction=} [properties] Properties to set + */ + function PinAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PinAction pinned. + * @member {boolean} pinned + * @memberof proto.SyncActionValue.PinAction + * @instance + */ + PinAction.prototype.pinned = false; + + /** + * Creates a new PinAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {proto.SyncActionValue.IPinAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.PinAction} PinAction instance + */ + PinAction.create = function create(properties) { + return new PinAction(properties); + }; + + /** + * Encodes the specified PinAction message. Does not implicitly {@link proto.SyncActionValue.PinAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {proto.SyncActionValue.IPinAction} message PinAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PinAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pinned != null && Object.hasOwnProperty.call(message, "pinned")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.pinned); + return writer; + }; + + /** + * Encodes the specified PinAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.PinAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {proto.SyncActionValue.IPinAction} message PinAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PinAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PinAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.PinAction} PinAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PinAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.PinAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pinned = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PinAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.PinAction} PinAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PinAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PinAction message. + * @function verify + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PinAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pinned != null && message.hasOwnProperty("pinned")) + if (typeof message.pinned !== "boolean") + return "pinned: boolean expected"; + return null; + }; + + /** + * Creates a PinAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.PinAction} PinAction + */ + PinAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.PinAction) + return object; + var message = new $root.proto.SyncActionValue.PinAction(); + if (object.pinned != null) + message.pinned = Boolean(object.pinned); + return message; + }; + + /** + * Creates a plain object from a PinAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.PinAction + * @static + * @param {proto.SyncActionValue.PinAction} message PinAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PinAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pinned = false; + if (message.pinned != null && message.hasOwnProperty("pinned")) + object.pinned = message.pinned; + return object; + }; + + /** + * Converts this PinAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.PinAction + * @instance + * @returns {Object.} JSON object + */ + PinAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PinAction; + })(); + + SyncActionValue.PnForLidChatAction = (function() { + + /** + * Properties of a PnForLidChatAction. + * @memberof proto.SyncActionValue + * @interface IPnForLidChatAction + * @property {string|null} [pnJid] PnForLidChatAction pnJid + */ + + /** + * Constructs a new PnForLidChatAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a PnForLidChatAction. + * @implements IPnForLidChatAction + * @constructor + * @param {proto.SyncActionValue.IPnForLidChatAction=} [properties] Properties to set + */ + function PnForLidChatAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PnForLidChatAction pnJid. + * @member {string} pnJid + * @memberof proto.SyncActionValue.PnForLidChatAction + * @instance + */ + PnForLidChatAction.prototype.pnJid = ""; + + /** + * Creates a new PnForLidChatAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {proto.SyncActionValue.IPnForLidChatAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.PnForLidChatAction} PnForLidChatAction instance + */ + PnForLidChatAction.create = function create(properties) { + return new PnForLidChatAction(properties); + }; + + /** + * Encodes the specified PnForLidChatAction message. Does not implicitly {@link proto.SyncActionValue.PnForLidChatAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {proto.SyncActionValue.IPnForLidChatAction} message PnForLidChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PnForLidChatAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pnJid != null && Object.hasOwnProperty.call(message, "pnJid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.pnJid); + return writer; + }; + + /** + * Encodes the specified PnForLidChatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.PnForLidChatAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {proto.SyncActionValue.IPnForLidChatAction} message PnForLidChatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PnForLidChatAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PnForLidChatAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.PnForLidChatAction} PnForLidChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PnForLidChatAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.PnForLidChatAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pnJid = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PnForLidChatAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.PnForLidChatAction} PnForLidChatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PnForLidChatAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PnForLidChatAction message. + * @function verify + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PnForLidChatAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pnJid != null && message.hasOwnProperty("pnJid")) + if (!$util.isString(message.pnJid)) + return "pnJid: string expected"; + return null; + }; + + /** + * Creates a PnForLidChatAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.PnForLidChatAction} PnForLidChatAction + */ + PnForLidChatAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.PnForLidChatAction) + return object; + var message = new $root.proto.SyncActionValue.PnForLidChatAction(); + if (object.pnJid != null) + message.pnJid = String(object.pnJid); + return message; + }; + + /** + * Creates a plain object from a PnForLidChatAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.PnForLidChatAction + * @static + * @param {proto.SyncActionValue.PnForLidChatAction} message PnForLidChatAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PnForLidChatAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pnJid = ""; + if (message.pnJid != null && message.hasOwnProperty("pnJid")) + object.pnJid = message.pnJid; + return object; + }; + + /** + * Converts this PnForLidChatAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.PnForLidChatAction + * @instance + * @returns {Object.} JSON object + */ + PnForLidChatAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PnForLidChatAction; + })(); + + SyncActionValue.PrimaryFeature = (function() { + + /** + * Properties of a PrimaryFeature. + * @memberof proto.SyncActionValue + * @interface IPrimaryFeature + * @property {Array.|null} [flags] PrimaryFeature flags + */ + + /** + * Constructs a new PrimaryFeature. + * @memberof proto.SyncActionValue + * @classdesc Represents a PrimaryFeature. + * @implements IPrimaryFeature + * @constructor + * @param {proto.SyncActionValue.IPrimaryFeature=} [properties] Properties to set + */ + function PrimaryFeature(properties) { + this.flags = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PrimaryFeature flags. + * @member {Array.} flags + * @memberof proto.SyncActionValue.PrimaryFeature + * @instance + */ + PrimaryFeature.prototype.flags = $util.emptyArray; + + /** + * Creates a new PrimaryFeature instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {proto.SyncActionValue.IPrimaryFeature=} [properties] Properties to set + * @returns {proto.SyncActionValue.PrimaryFeature} PrimaryFeature instance + */ + PrimaryFeature.create = function create(properties) { + return new PrimaryFeature(properties); + }; + + /** + * Encodes the specified PrimaryFeature message. Does not implicitly {@link proto.SyncActionValue.PrimaryFeature.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {proto.SyncActionValue.IPrimaryFeature} message PrimaryFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrimaryFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.flags != null && message.flags.length) + for (var i = 0; i < message.flags.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.flags[i]); + return writer; + }; + + /** + * Encodes the specified PrimaryFeature message, length delimited. Does not implicitly {@link proto.SyncActionValue.PrimaryFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {proto.SyncActionValue.IPrimaryFeature} message PrimaryFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrimaryFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PrimaryFeature message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.PrimaryFeature} PrimaryFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrimaryFeature.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.PrimaryFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.flags && message.flags.length)) + message.flags = []; + message.flags.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PrimaryFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.PrimaryFeature} PrimaryFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrimaryFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PrimaryFeature message. + * @function verify + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PrimaryFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.flags != null && message.hasOwnProperty("flags")) { + if (!Array.isArray(message.flags)) + return "flags: array expected"; + for (var i = 0; i < message.flags.length; ++i) + if (!$util.isString(message.flags[i])) + return "flags: string[] expected"; + } + return null; + }; + + /** + * Creates a PrimaryFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.PrimaryFeature} PrimaryFeature + */ + PrimaryFeature.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.PrimaryFeature) + return object; + var message = new $root.proto.SyncActionValue.PrimaryFeature(); + if (object.flags) { + if (!Array.isArray(object.flags)) + throw TypeError(".proto.SyncActionValue.PrimaryFeature.flags: array expected"); + message.flags = []; + for (var i = 0; i < object.flags.length; ++i) + message.flags[i] = String(object.flags[i]); + } + return message; + }; + + /** + * Creates a plain object from a PrimaryFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.PrimaryFeature + * @static + * @param {proto.SyncActionValue.PrimaryFeature} message PrimaryFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PrimaryFeature.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.flags = []; + if (message.flags && message.flags.length) { + object.flags = []; + for (var j = 0; j < message.flags.length; ++j) + object.flags[j] = message.flags[j]; + } + return object; + }; + + /** + * Converts this PrimaryFeature to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.PrimaryFeature + * @instance + * @returns {Object.} JSON object + */ + PrimaryFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PrimaryFeature; + })(); + + SyncActionValue.PrimaryVersionAction = (function() { + + /** + * Properties of a PrimaryVersionAction. + * @memberof proto.SyncActionValue + * @interface IPrimaryVersionAction + * @property {string|null} [version] PrimaryVersionAction version + */ + + /** + * Constructs a new PrimaryVersionAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a PrimaryVersionAction. + * @implements IPrimaryVersionAction + * @constructor + * @param {proto.SyncActionValue.IPrimaryVersionAction=} [properties] Properties to set + */ + function PrimaryVersionAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PrimaryVersionAction version. + * @member {string} version + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @instance + */ + PrimaryVersionAction.prototype.version = ""; + + /** + * Creates a new PrimaryVersionAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {proto.SyncActionValue.IPrimaryVersionAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.PrimaryVersionAction} PrimaryVersionAction instance + */ + PrimaryVersionAction.create = function create(properties) { + return new PrimaryVersionAction(properties); + }; + + /** + * Encodes the specified PrimaryVersionAction message. Does not implicitly {@link proto.SyncActionValue.PrimaryVersionAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {proto.SyncActionValue.IPrimaryVersionAction} message PrimaryVersionAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrimaryVersionAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + return writer; + }; + + /** + * Encodes the specified PrimaryVersionAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.PrimaryVersionAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {proto.SyncActionValue.IPrimaryVersionAction} message PrimaryVersionAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PrimaryVersionAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PrimaryVersionAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.PrimaryVersionAction} PrimaryVersionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrimaryVersionAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.PrimaryVersionAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PrimaryVersionAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.PrimaryVersionAction} PrimaryVersionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PrimaryVersionAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PrimaryVersionAction message. + * @function verify + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PrimaryVersionAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + return null; + }; + + /** + * Creates a PrimaryVersionAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.PrimaryVersionAction} PrimaryVersionAction + */ + PrimaryVersionAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.PrimaryVersionAction) + return object; + var message = new $root.proto.SyncActionValue.PrimaryVersionAction(); + if (object.version != null) + message.version = String(object.version); + return message; + }; + + /** + * Creates a plain object from a PrimaryVersionAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @static + * @param {proto.SyncActionValue.PrimaryVersionAction} message PrimaryVersionAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PrimaryVersionAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.version = ""; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + return object; + }; + + /** + * Converts this PrimaryVersionAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.PrimaryVersionAction + * @instance + * @returns {Object.} JSON object + */ + PrimaryVersionAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PrimaryVersionAction; + })(); + + SyncActionValue.PushNameSetting = (function() { + + /** + * Properties of a PushNameSetting. + * @memberof proto.SyncActionValue + * @interface IPushNameSetting + * @property {string|null} [name] PushNameSetting name + */ + + /** + * Constructs a new PushNameSetting. + * @memberof proto.SyncActionValue + * @classdesc Represents a PushNameSetting. + * @implements IPushNameSetting + * @constructor + * @param {proto.SyncActionValue.IPushNameSetting=} [properties] Properties to set + */ + function PushNameSetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PushNameSetting name. + * @member {string} name + * @memberof proto.SyncActionValue.PushNameSetting + * @instance + */ + PushNameSetting.prototype.name = ""; + + /** + * Creates a new PushNameSetting instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {proto.SyncActionValue.IPushNameSetting=} [properties] Properties to set + * @returns {proto.SyncActionValue.PushNameSetting} PushNameSetting instance + */ + PushNameSetting.create = function create(properties) { + return new PushNameSetting(properties); + }; + + /** + * Encodes the specified PushNameSetting message. Does not implicitly {@link proto.SyncActionValue.PushNameSetting.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {proto.SyncActionValue.IPushNameSetting} message PushNameSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PushNameSetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified PushNameSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.PushNameSetting.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {proto.SyncActionValue.IPushNameSetting} message PushNameSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PushNameSetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PushNameSetting message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.PushNameSetting} PushNameSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PushNameSetting.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.PushNameSetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PushNameSetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.PushNameSetting} PushNameSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PushNameSetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PushNameSetting message. + * @function verify + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PushNameSetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a PushNameSetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.PushNameSetting} PushNameSetting + */ + PushNameSetting.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.PushNameSetting) + return object; + var message = new $root.proto.SyncActionValue.PushNameSetting(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a PushNameSetting message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.PushNameSetting + * @static + * @param {proto.SyncActionValue.PushNameSetting} message PushNameSetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PushNameSetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this PushNameSetting to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.PushNameSetting + * @instance + * @returns {Object.} JSON object + */ + PushNameSetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PushNameSetting; + })(); + + SyncActionValue.QuickReplyAction = (function() { + + /** + * Properties of a QuickReplyAction. + * @memberof proto.SyncActionValue + * @interface IQuickReplyAction + * @property {string|null} [shortcut] QuickReplyAction shortcut + * @property {string|null} [message] QuickReplyAction message + * @property {Array.|null} [keywords] QuickReplyAction keywords + * @property {number|null} [count] QuickReplyAction count + * @property {boolean|null} [deleted] QuickReplyAction deleted + */ + + /** + * Constructs a new QuickReplyAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a QuickReplyAction. + * @implements IQuickReplyAction + * @constructor + * @param {proto.SyncActionValue.IQuickReplyAction=} [properties] Properties to set + */ + function QuickReplyAction(properties) { + this.keywords = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuickReplyAction shortcut. + * @member {string} shortcut + * @memberof proto.SyncActionValue.QuickReplyAction + * @instance + */ + QuickReplyAction.prototype.shortcut = ""; + + /** + * QuickReplyAction message. + * @member {string} message + * @memberof proto.SyncActionValue.QuickReplyAction + * @instance + */ + QuickReplyAction.prototype.message = ""; + + /** + * QuickReplyAction keywords. + * @member {Array.} keywords + * @memberof proto.SyncActionValue.QuickReplyAction + * @instance + */ + QuickReplyAction.prototype.keywords = $util.emptyArray; + + /** + * QuickReplyAction count. + * @member {number} count + * @memberof proto.SyncActionValue.QuickReplyAction + * @instance + */ + QuickReplyAction.prototype.count = 0; + + /** + * QuickReplyAction deleted. + * @member {boolean} deleted + * @memberof proto.SyncActionValue.QuickReplyAction + * @instance + */ + QuickReplyAction.prototype.deleted = false; + + /** + * Creates a new QuickReplyAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {proto.SyncActionValue.IQuickReplyAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.QuickReplyAction} QuickReplyAction instance + */ + QuickReplyAction.create = function create(properties) { + return new QuickReplyAction(properties); + }; + + /** + * Encodes the specified QuickReplyAction message. Does not implicitly {@link proto.SyncActionValue.QuickReplyAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {proto.SyncActionValue.IQuickReplyAction} message QuickReplyAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplyAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.shortcut != null && Object.hasOwnProperty.call(message, "shortcut")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.shortcut); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.keywords != null && message.keywords.length) + for (var i = 0; i < message.keywords.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.keywords[i]); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.count); + if (message.deleted != null && Object.hasOwnProperty.call(message, "deleted")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.deleted); + return writer; + }; + + /** + * Encodes the specified QuickReplyAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.QuickReplyAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {proto.SyncActionValue.IQuickReplyAction} message QuickReplyAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplyAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuickReplyAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.QuickReplyAction} QuickReplyAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplyAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.QuickReplyAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.shortcut = reader.string(); + break; + case 2: + message.message = reader.string(); + break; + case 3: + if (!(message.keywords && message.keywords.length)) + message.keywords = []; + message.keywords.push(reader.string()); + break; + case 4: + message.count = reader.int32(); + break; + case 5: + message.deleted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuickReplyAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.QuickReplyAction} QuickReplyAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplyAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuickReplyAction message. + * @function verify + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuickReplyAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.shortcut != null && message.hasOwnProperty("shortcut")) + if (!$util.isString(message.shortcut)) + return "shortcut: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.keywords != null && message.hasOwnProperty("keywords")) { + if (!Array.isArray(message.keywords)) + return "keywords: array expected"; + for (var i = 0; i < message.keywords.length; ++i) + if (!$util.isString(message.keywords[i])) + return "keywords: string[] expected"; + } + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count)) + return "count: integer expected"; + if (message.deleted != null && message.hasOwnProperty("deleted")) + if (typeof message.deleted !== "boolean") + return "deleted: boolean expected"; + return null; + }; + + /** + * Creates a QuickReplyAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.QuickReplyAction} QuickReplyAction + */ + QuickReplyAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.QuickReplyAction) + return object; + var message = new $root.proto.SyncActionValue.QuickReplyAction(); + if (object.shortcut != null) + message.shortcut = String(object.shortcut); + if (object.message != null) + message.message = String(object.message); + if (object.keywords) { + if (!Array.isArray(object.keywords)) + throw TypeError(".proto.SyncActionValue.QuickReplyAction.keywords: array expected"); + message.keywords = []; + for (var i = 0; i < object.keywords.length; ++i) + message.keywords[i] = String(object.keywords[i]); + } + if (object.count != null) + message.count = object.count | 0; + if (object.deleted != null) + message.deleted = Boolean(object.deleted); + return message; + }; + + /** + * Creates a plain object from a QuickReplyAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.QuickReplyAction + * @static + * @param {proto.SyncActionValue.QuickReplyAction} message QuickReplyAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuickReplyAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keywords = []; + if (options.defaults) { + object.shortcut = ""; + object.message = ""; + object.count = 0; + object.deleted = false; + } + if (message.shortcut != null && message.hasOwnProperty("shortcut")) + object.shortcut = message.shortcut; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.keywords && message.keywords.length) { + object.keywords = []; + for (var j = 0; j < message.keywords.length; ++j) + object.keywords[j] = message.keywords[j]; + } + if (message.count != null && message.hasOwnProperty("count")) + object.count = message.count; + if (message.deleted != null && message.hasOwnProperty("deleted")) + object.deleted = message.deleted; + return object; + }; + + /** + * Converts this QuickReplyAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.QuickReplyAction + * @instance + * @returns {Object.} JSON object + */ + QuickReplyAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuickReplyAction; + })(); + + SyncActionValue.RecentEmojiWeightsAction = (function() { + + /** + * Properties of a RecentEmojiWeightsAction. + * @memberof proto.SyncActionValue + * @interface IRecentEmojiWeightsAction + * @property {Array.|null} [weights] RecentEmojiWeightsAction weights + */ + + /** + * Constructs a new RecentEmojiWeightsAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a RecentEmojiWeightsAction. + * @implements IRecentEmojiWeightsAction + * @constructor + * @param {proto.SyncActionValue.IRecentEmojiWeightsAction=} [properties] Properties to set + */ + function RecentEmojiWeightsAction(properties) { + this.weights = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RecentEmojiWeightsAction weights. + * @member {Array.} weights + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @instance + */ + RecentEmojiWeightsAction.prototype.weights = $util.emptyArray; + + /** + * Creates a new RecentEmojiWeightsAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {proto.SyncActionValue.IRecentEmojiWeightsAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.RecentEmojiWeightsAction} RecentEmojiWeightsAction instance + */ + RecentEmojiWeightsAction.create = function create(properties) { + return new RecentEmojiWeightsAction(properties); + }; + + /** + * Encodes the specified RecentEmojiWeightsAction message. Does not implicitly {@link proto.SyncActionValue.RecentEmojiWeightsAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {proto.SyncActionValue.IRecentEmojiWeightsAction} message RecentEmojiWeightsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentEmojiWeightsAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.weights != null && message.weights.length) + for (var i = 0; i < message.weights.length; ++i) + $root.proto.RecentEmojiWeight.encode(message.weights[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RecentEmojiWeightsAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.RecentEmojiWeightsAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {proto.SyncActionValue.IRecentEmojiWeightsAction} message RecentEmojiWeightsAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RecentEmojiWeightsAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RecentEmojiWeightsAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.RecentEmojiWeightsAction} RecentEmojiWeightsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentEmojiWeightsAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.RecentEmojiWeightsAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.weights && message.weights.length)) + message.weights = []; + message.weights.push($root.proto.RecentEmojiWeight.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RecentEmojiWeightsAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.RecentEmojiWeightsAction} RecentEmojiWeightsAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RecentEmojiWeightsAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RecentEmojiWeightsAction message. + * @function verify + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RecentEmojiWeightsAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.weights != null && message.hasOwnProperty("weights")) { + if (!Array.isArray(message.weights)) + return "weights: array expected"; + for (var i = 0; i < message.weights.length; ++i) { + var error = $root.proto.RecentEmojiWeight.verify(message.weights[i]); + if (error) + return "weights." + error; + } + } + return null; + }; + + /** + * Creates a RecentEmojiWeightsAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.RecentEmojiWeightsAction} RecentEmojiWeightsAction + */ + RecentEmojiWeightsAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.RecentEmojiWeightsAction) + return object; + var message = new $root.proto.SyncActionValue.RecentEmojiWeightsAction(); + if (object.weights) { + if (!Array.isArray(object.weights)) + throw TypeError(".proto.SyncActionValue.RecentEmojiWeightsAction.weights: array expected"); + message.weights = []; + for (var i = 0; i < object.weights.length; ++i) { + if (typeof object.weights[i] !== "object") + throw TypeError(".proto.SyncActionValue.RecentEmojiWeightsAction.weights: object expected"); + message.weights[i] = $root.proto.RecentEmojiWeight.fromObject(object.weights[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RecentEmojiWeightsAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @static + * @param {proto.SyncActionValue.RecentEmojiWeightsAction} message RecentEmojiWeightsAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RecentEmojiWeightsAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.weights = []; + if (message.weights && message.weights.length) { + object.weights = []; + for (var j = 0; j < message.weights.length; ++j) + object.weights[j] = $root.proto.RecentEmojiWeight.toObject(message.weights[j], options); + } + return object; + }; + + /** + * Converts this RecentEmojiWeightsAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.RecentEmojiWeightsAction + * @instance + * @returns {Object.} JSON object + */ + RecentEmojiWeightsAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RecentEmojiWeightsAction; + })(); + + SyncActionValue.RemoveRecentStickerAction = (function() { + + /** + * Properties of a RemoveRecentStickerAction. + * @memberof proto.SyncActionValue + * @interface IRemoveRecentStickerAction + * @property {number|Long|null} [lastStickerSentTs] RemoveRecentStickerAction lastStickerSentTs + */ + + /** + * Constructs a new RemoveRecentStickerAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a RemoveRecentStickerAction. + * @implements IRemoveRecentStickerAction + * @constructor + * @param {proto.SyncActionValue.IRemoveRecentStickerAction=} [properties] Properties to set + */ + function RemoveRecentStickerAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RemoveRecentStickerAction lastStickerSentTs. + * @member {number|Long} lastStickerSentTs + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @instance + */ + RemoveRecentStickerAction.prototype.lastStickerSentTs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new RemoveRecentStickerAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {proto.SyncActionValue.IRemoveRecentStickerAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.RemoveRecentStickerAction} RemoveRecentStickerAction instance + */ + RemoveRecentStickerAction.create = function create(properties) { + return new RemoveRecentStickerAction(properties); + }; + + /** + * Encodes the specified RemoveRecentStickerAction message. Does not implicitly {@link proto.SyncActionValue.RemoveRecentStickerAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {proto.SyncActionValue.IRemoveRecentStickerAction} message RemoveRecentStickerAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveRecentStickerAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lastStickerSentTs != null && Object.hasOwnProperty.call(message, "lastStickerSentTs")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.lastStickerSentTs); + return writer; + }; + + /** + * Encodes the specified RemoveRecentStickerAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.RemoveRecentStickerAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {proto.SyncActionValue.IRemoveRecentStickerAction} message RemoveRecentStickerAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RemoveRecentStickerAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RemoveRecentStickerAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.RemoveRecentStickerAction} RemoveRecentStickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveRecentStickerAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.RemoveRecentStickerAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lastStickerSentTs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RemoveRecentStickerAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.RemoveRecentStickerAction} RemoveRecentStickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RemoveRecentStickerAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RemoveRecentStickerAction message. + * @function verify + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RemoveRecentStickerAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lastStickerSentTs != null && message.hasOwnProperty("lastStickerSentTs")) + if (!$util.isInteger(message.lastStickerSentTs) && !(message.lastStickerSentTs && $util.isInteger(message.lastStickerSentTs.low) && $util.isInteger(message.lastStickerSentTs.high))) + return "lastStickerSentTs: integer|Long expected"; + return null; + }; + + /** + * Creates a RemoveRecentStickerAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.RemoveRecentStickerAction} RemoveRecentStickerAction + */ + RemoveRecentStickerAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.RemoveRecentStickerAction) + return object; + var message = new $root.proto.SyncActionValue.RemoveRecentStickerAction(); + if (object.lastStickerSentTs != null) + if ($util.Long) + (message.lastStickerSentTs = $util.Long.fromValue(object.lastStickerSentTs)).unsigned = false; + else if (typeof object.lastStickerSentTs === "string") + message.lastStickerSentTs = parseInt(object.lastStickerSentTs, 10); + else if (typeof object.lastStickerSentTs === "number") + message.lastStickerSentTs = object.lastStickerSentTs; + else if (typeof object.lastStickerSentTs === "object") + message.lastStickerSentTs = new $util.LongBits(object.lastStickerSentTs.low >>> 0, object.lastStickerSentTs.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a RemoveRecentStickerAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @static + * @param {proto.SyncActionValue.RemoveRecentStickerAction} message RemoveRecentStickerAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RemoveRecentStickerAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastStickerSentTs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastStickerSentTs = options.longs === String ? "0" : 0; + if (message.lastStickerSentTs != null && message.hasOwnProperty("lastStickerSentTs")) + if (typeof message.lastStickerSentTs === "number") + object.lastStickerSentTs = options.longs === String ? String(message.lastStickerSentTs) : message.lastStickerSentTs; + else + object.lastStickerSentTs = options.longs === String ? $util.Long.prototype.toString.call(message.lastStickerSentTs) : options.longs === Number ? new $util.LongBits(message.lastStickerSentTs.low >>> 0, message.lastStickerSentTs.high >>> 0).toNumber() : message.lastStickerSentTs; + return object; + }; + + /** + * Converts this RemoveRecentStickerAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.RemoveRecentStickerAction + * @instance + * @returns {Object.} JSON object + */ + RemoveRecentStickerAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return RemoveRecentStickerAction; + })(); + + SyncActionValue.SecurityNotificationSetting = (function() { + + /** + * Properties of a SecurityNotificationSetting. + * @memberof proto.SyncActionValue + * @interface ISecurityNotificationSetting + * @property {boolean|null} [showNotification] SecurityNotificationSetting showNotification + */ + + /** + * Constructs a new SecurityNotificationSetting. + * @memberof proto.SyncActionValue + * @classdesc Represents a SecurityNotificationSetting. + * @implements ISecurityNotificationSetting + * @constructor + * @param {proto.SyncActionValue.ISecurityNotificationSetting=} [properties] Properties to set + */ + function SecurityNotificationSetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SecurityNotificationSetting showNotification. + * @member {boolean} showNotification + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @instance + */ + SecurityNotificationSetting.prototype.showNotification = false; + + /** + * Creates a new SecurityNotificationSetting instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {proto.SyncActionValue.ISecurityNotificationSetting=} [properties] Properties to set + * @returns {proto.SyncActionValue.SecurityNotificationSetting} SecurityNotificationSetting instance + */ + SecurityNotificationSetting.create = function create(properties) { + return new SecurityNotificationSetting(properties); + }; + + /** + * Encodes the specified SecurityNotificationSetting message. Does not implicitly {@link proto.SyncActionValue.SecurityNotificationSetting.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {proto.SyncActionValue.ISecurityNotificationSetting} message SecurityNotificationSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecurityNotificationSetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.showNotification != null && Object.hasOwnProperty.call(message, "showNotification")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.showNotification); + return writer; + }; + + /** + * Encodes the specified SecurityNotificationSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.SecurityNotificationSetting.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {proto.SyncActionValue.ISecurityNotificationSetting} message SecurityNotificationSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SecurityNotificationSetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SecurityNotificationSetting message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.SecurityNotificationSetting} SecurityNotificationSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecurityNotificationSetting.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.SecurityNotificationSetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.showNotification = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SecurityNotificationSetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.SecurityNotificationSetting} SecurityNotificationSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SecurityNotificationSetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SecurityNotificationSetting message. + * @function verify + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SecurityNotificationSetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.showNotification != null && message.hasOwnProperty("showNotification")) + if (typeof message.showNotification !== "boolean") + return "showNotification: boolean expected"; + return null; + }; + + /** + * Creates a SecurityNotificationSetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.SecurityNotificationSetting} SecurityNotificationSetting + */ + SecurityNotificationSetting.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.SecurityNotificationSetting) + return object; + var message = new $root.proto.SyncActionValue.SecurityNotificationSetting(); + if (object.showNotification != null) + message.showNotification = Boolean(object.showNotification); + return message; + }; + + /** + * Creates a plain object from a SecurityNotificationSetting message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @static + * @param {proto.SyncActionValue.SecurityNotificationSetting} message SecurityNotificationSetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SecurityNotificationSetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.showNotification = false; + if (message.showNotification != null && message.hasOwnProperty("showNotification")) + object.showNotification = message.showNotification; + return object; + }; + + /** + * Converts this SecurityNotificationSetting to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.SecurityNotificationSetting + * @instance + * @returns {Object.} JSON object + */ + SecurityNotificationSetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SecurityNotificationSetting; + })(); + + SyncActionValue.StarAction = (function() { + + /** + * Properties of a StarAction. + * @memberof proto.SyncActionValue + * @interface IStarAction + * @property {boolean|null} [starred] StarAction starred + */ + + /** + * Constructs a new StarAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a StarAction. + * @implements IStarAction + * @constructor + * @param {proto.SyncActionValue.IStarAction=} [properties] Properties to set + */ + function StarAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StarAction starred. + * @member {boolean} starred + * @memberof proto.SyncActionValue.StarAction + * @instance + */ + StarAction.prototype.starred = false; + + /** + * Creates a new StarAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {proto.SyncActionValue.IStarAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.StarAction} StarAction instance + */ + StarAction.create = function create(properties) { + return new StarAction(properties); + }; + + /** + * Encodes the specified StarAction message. Does not implicitly {@link proto.SyncActionValue.StarAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {proto.SyncActionValue.IStarAction} message StarAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StarAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.starred != null && Object.hasOwnProperty.call(message, "starred")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.starred); + return writer; + }; + + /** + * Encodes the specified StarAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.StarAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {proto.SyncActionValue.IStarAction} message StarAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StarAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StarAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.StarAction} StarAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StarAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.StarAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.starred = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StarAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.StarAction} StarAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StarAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StarAction message. + * @function verify + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StarAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.starred != null && message.hasOwnProperty("starred")) + if (typeof message.starred !== "boolean") + return "starred: boolean expected"; + return null; + }; + + /** + * Creates a StarAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.StarAction} StarAction + */ + StarAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.StarAction) + return object; + var message = new $root.proto.SyncActionValue.StarAction(); + if (object.starred != null) + message.starred = Boolean(object.starred); + return message; + }; + + /** + * Creates a plain object from a StarAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.StarAction + * @static + * @param {proto.SyncActionValue.StarAction} message StarAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StarAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.starred = false; + if (message.starred != null && message.hasOwnProperty("starred")) + object.starred = message.starred; + return object; + }; + + /** + * Converts this StarAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.StarAction + * @instance + * @returns {Object.} JSON object + */ + StarAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StarAction; + })(); + + SyncActionValue.StickerAction = (function() { + + /** + * Properties of a StickerAction. + * @memberof proto.SyncActionValue + * @interface IStickerAction + * @property {string|null} [url] StickerAction url + * @property {Uint8Array|null} [fileEncSha256] StickerAction fileEncSha256 + * @property {Uint8Array|null} [mediaKey] StickerAction mediaKey + * @property {string|null} [mimetype] StickerAction mimetype + * @property {number|null} [height] StickerAction height + * @property {number|null} [width] StickerAction width + * @property {string|null} [directPath] StickerAction directPath + * @property {number|Long|null} [fileLength] StickerAction fileLength + * @property {boolean|null} [isFavorite] StickerAction isFavorite + * @property {number|null} [deviceIdHint] StickerAction deviceIdHint + */ + + /** + * Constructs a new StickerAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a StickerAction. + * @implements IStickerAction + * @constructor + * @param {proto.SyncActionValue.IStickerAction=} [properties] Properties to set + */ + function StickerAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StickerAction url. + * @member {string} url + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.url = ""; + + /** + * StickerAction fileEncSha256. + * @member {Uint8Array} fileEncSha256 + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.fileEncSha256 = $util.newBuffer([]); + + /** + * StickerAction mediaKey. + * @member {Uint8Array} mediaKey + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.mediaKey = $util.newBuffer([]); + + /** + * StickerAction mimetype. + * @member {string} mimetype + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.mimetype = ""; + + /** + * StickerAction height. + * @member {number} height + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.height = 0; + + /** + * StickerAction width. + * @member {number} width + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.width = 0; + + /** + * StickerAction directPath. + * @member {string} directPath + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.directPath = ""; + + /** + * StickerAction fileLength. + * @member {number|Long} fileLength + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.fileLength = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * StickerAction isFavorite. + * @member {boolean} isFavorite + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.isFavorite = false; + + /** + * StickerAction deviceIdHint. + * @member {number} deviceIdHint + * @memberof proto.SyncActionValue.StickerAction + * @instance + */ + StickerAction.prototype.deviceIdHint = 0; + + /** + * Creates a new StickerAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {proto.SyncActionValue.IStickerAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.StickerAction} StickerAction instance + */ + StickerAction.create = function create(properties) { + return new StickerAction(properties); + }; + + /** + * Encodes the specified StickerAction message. Does not implicitly {@link proto.SyncActionValue.StickerAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {proto.SyncActionValue.IStickerAction} message StickerAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.url); + if (message.fileEncSha256 != null && Object.hasOwnProperty.call(message, "fileEncSha256")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.fileEncSha256); + if (message.mediaKey != null && Object.hasOwnProperty.call(message, "mediaKey")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.mediaKey); + if (message.mimetype != null && Object.hasOwnProperty.call(message, "mimetype")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mimetype); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 5, wireType 0 =*/40).uint32(message.height); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 6, wireType 0 =*/48).uint32(message.width); + if (message.directPath != null && Object.hasOwnProperty.call(message, "directPath")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.directPath); + if (message.fileLength != null && Object.hasOwnProperty.call(message, "fileLength")) + writer.uint32(/* id 8, wireType 0 =*/64).uint64(message.fileLength); + if (message.isFavorite != null && Object.hasOwnProperty.call(message, "isFavorite")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.isFavorite); + if (message.deviceIdHint != null && Object.hasOwnProperty.call(message, "deviceIdHint")) + writer.uint32(/* id 10, wireType 0 =*/80).uint32(message.deviceIdHint); + return writer; + }; + + /** + * Encodes the specified StickerAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.StickerAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {proto.SyncActionValue.IStickerAction} message StickerAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StickerAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StickerAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.StickerAction} StickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.StickerAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.url = reader.string(); + break; + case 2: + message.fileEncSha256 = reader.bytes(); + break; + case 3: + message.mediaKey = reader.bytes(); + break; + case 4: + message.mimetype = reader.string(); + break; + case 5: + message.height = reader.uint32(); + break; + case 6: + message.width = reader.uint32(); + break; + case 7: + message.directPath = reader.string(); + break; + case 8: + message.fileLength = reader.uint64(); + break; + case 9: + message.isFavorite = reader.bool(); + break; + case 10: + message.deviceIdHint = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StickerAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.StickerAction} StickerAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StickerAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StickerAction message. + * @function verify + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StickerAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.url != null && message.hasOwnProperty("url")) + if (!$util.isString(message.url)) + return "url: string expected"; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + if (!(message.fileEncSha256 && typeof message.fileEncSha256.length === "number" || $util.isString(message.fileEncSha256))) + return "fileEncSha256: buffer expected"; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + if (!(message.mediaKey && typeof message.mediaKey.length === "number" || $util.isString(message.mediaKey))) + return "mediaKey: buffer expected"; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + if (!$util.isString(message.mimetype)) + return "mimetype: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.directPath != null && message.hasOwnProperty("directPath")) + if (!$util.isString(message.directPath)) + return "directPath: string expected"; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (!$util.isInteger(message.fileLength) && !(message.fileLength && $util.isInteger(message.fileLength.low) && $util.isInteger(message.fileLength.high))) + return "fileLength: integer|Long expected"; + if (message.isFavorite != null && message.hasOwnProperty("isFavorite")) + if (typeof message.isFavorite !== "boolean") + return "isFavorite: boolean expected"; + if (message.deviceIdHint != null && message.hasOwnProperty("deviceIdHint")) + if (!$util.isInteger(message.deviceIdHint)) + return "deviceIdHint: integer expected"; + return null; + }; + + /** + * Creates a StickerAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.StickerAction} StickerAction + */ + StickerAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.StickerAction) + return object; + var message = new $root.proto.SyncActionValue.StickerAction(); + if (object.url != null) + message.url = String(object.url); + if (object.fileEncSha256 != null) + if (typeof object.fileEncSha256 === "string") + $util.base64.decode(object.fileEncSha256, message.fileEncSha256 = $util.newBuffer($util.base64.length(object.fileEncSha256)), 0); + else if (object.fileEncSha256.length) + message.fileEncSha256 = object.fileEncSha256; + if (object.mediaKey != null) + if (typeof object.mediaKey === "string") + $util.base64.decode(object.mediaKey, message.mediaKey = $util.newBuffer($util.base64.length(object.mediaKey)), 0); + else if (object.mediaKey.length) + message.mediaKey = object.mediaKey; + if (object.mimetype != null) + message.mimetype = String(object.mimetype); + if (object.height != null) + message.height = object.height >>> 0; + if (object.width != null) + message.width = object.width >>> 0; + if (object.directPath != null) + message.directPath = String(object.directPath); + if (object.fileLength != null) + if ($util.Long) + (message.fileLength = $util.Long.fromValue(object.fileLength)).unsigned = true; + else if (typeof object.fileLength === "string") + message.fileLength = parseInt(object.fileLength, 10); + else if (typeof object.fileLength === "number") + message.fileLength = object.fileLength; + else if (typeof object.fileLength === "object") + message.fileLength = new $util.LongBits(object.fileLength.low >>> 0, object.fileLength.high >>> 0).toNumber(true); + if (object.isFavorite != null) + message.isFavorite = Boolean(object.isFavorite); + if (object.deviceIdHint != null) + message.deviceIdHint = object.deviceIdHint >>> 0; + return message; + }; + + /** + * Creates a plain object from a StickerAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.StickerAction + * @static + * @param {proto.SyncActionValue.StickerAction} message StickerAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StickerAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + if (options.bytes === String) + object.fileEncSha256 = ""; + else { + object.fileEncSha256 = []; + if (options.bytes !== Array) + object.fileEncSha256 = $util.newBuffer(object.fileEncSha256); + } + if (options.bytes === String) + object.mediaKey = ""; + else { + object.mediaKey = []; + if (options.bytes !== Array) + object.mediaKey = $util.newBuffer(object.mediaKey); + } + object.mimetype = ""; + object.height = 0; + object.width = 0; + object.directPath = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.fileLength = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.fileLength = options.longs === String ? "0" : 0; + object.isFavorite = false; + object.deviceIdHint = 0; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.fileEncSha256 != null && message.hasOwnProperty("fileEncSha256")) + object.fileEncSha256 = options.bytes === String ? $util.base64.encode(message.fileEncSha256, 0, message.fileEncSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.fileEncSha256) : message.fileEncSha256; + if (message.mediaKey != null && message.hasOwnProperty("mediaKey")) + object.mediaKey = options.bytes === String ? $util.base64.encode(message.mediaKey, 0, message.mediaKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaKey) : message.mediaKey; + if (message.mimetype != null && message.hasOwnProperty("mimetype")) + object.mimetype = message.mimetype; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.directPath != null && message.hasOwnProperty("directPath")) + object.directPath = message.directPath; + if (message.fileLength != null && message.hasOwnProperty("fileLength")) + if (typeof message.fileLength === "number") + object.fileLength = options.longs === String ? String(message.fileLength) : message.fileLength; + else + object.fileLength = options.longs === String ? $util.Long.prototype.toString.call(message.fileLength) : options.longs === Number ? new $util.LongBits(message.fileLength.low >>> 0, message.fileLength.high >>> 0).toNumber(true) : message.fileLength; + if (message.isFavorite != null && message.hasOwnProperty("isFavorite")) + object.isFavorite = message.isFavorite; + if (message.deviceIdHint != null && message.hasOwnProperty("deviceIdHint")) + object.deviceIdHint = message.deviceIdHint; + return object; + }; + + /** + * Converts this StickerAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.StickerAction + * @instance + * @returns {Object.} JSON object + */ + StickerAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return StickerAction; + })(); + + SyncActionValue.SubscriptionAction = (function() { + + /** + * Properties of a SubscriptionAction. + * @memberof proto.SyncActionValue + * @interface ISubscriptionAction + * @property {boolean|null} [isDeactivated] SubscriptionAction isDeactivated + * @property {boolean|null} [isAutoRenewing] SubscriptionAction isAutoRenewing + * @property {number|Long|null} [expirationDate] SubscriptionAction expirationDate + */ + + /** + * Constructs a new SubscriptionAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a SubscriptionAction. + * @implements ISubscriptionAction + * @constructor + * @param {proto.SyncActionValue.ISubscriptionAction=} [properties] Properties to set + */ + function SubscriptionAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SubscriptionAction isDeactivated. + * @member {boolean} isDeactivated + * @memberof proto.SyncActionValue.SubscriptionAction + * @instance + */ + SubscriptionAction.prototype.isDeactivated = false; + + /** + * SubscriptionAction isAutoRenewing. + * @member {boolean} isAutoRenewing + * @memberof proto.SyncActionValue.SubscriptionAction + * @instance + */ + SubscriptionAction.prototype.isAutoRenewing = false; + + /** + * SubscriptionAction expirationDate. + * @member {number|Long} expirationDate + * @memberof proto.SyncActionValue.SubscriptionAction + * @instance + */ + SubscriptionAction.prototype.expirationDate = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new SubscriptionAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {proto.SyncActionValue.ISubscriptionAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.SubscriptionAction} SubscriptionAction instance + */ + SubscriptionAction.create = function create(properties) { + return new SubscriptionAction(properties); + }; + + /** + * Encodes the specified SubscriptionAction message. Does not implicitly {@link proto.SyncActionValue.SubscriptionAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {proto.SyncActionValue.ISubscriptionAction} message SubscriptionAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriptionAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.isDeactivated != null && Object.hasOwnProperty.call(message, "isDeactivated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.isDeactivated); + if (message.isAutoRenewing != null && Object.hasOwnProperty.call(message, "isAutoRenewing")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isAutoRenewing); + if (message.expirationDate != null && Object.hasOwnProperty.call(message, "expirationDate")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.expirationDate); + return writer; + }; + + /** + * Encodes the specified SubscriptionAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.SubscriptionAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {proto.SyncActionValue.ISubscriptionAction} message SubscriptionAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriptionAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SubscriptionAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.SubscriptionAction} SubscriptionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriptionAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.SubscriptionAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.isDeactivated = reader.bool(); + break; + case 2: + message.isAutoRenewing = reader.bool(); + break; + case 3: + message.expirationDate = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SubscriptionAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.SubscriptionAction} SubscriptionAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriptionAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SubscriptionAction message. + * @function verify + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SubscriptionAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.isDeactivated != null && message.hasOwnProperty("isDeactivated")) + if (typeof message.isDeactivated !== "boolean") + return "isDeactivated: boolean expected"; + if (message.isAutoRenewing != null && message.hasOwnProperty("isAutoRenewing")) + if (typeof message.isAutoRenewing !== "boolean") + return "isAutoRenewing: boolean expected"; + if (message.expirationDate != null && message.hasOwnProperty("expirationDate")) + if (!$util.isInteger(message.expirationDate) && !(message.expirationDate && $util.isInteger(message.expirationDate.low) && $util.isInteger(message.expirationDate.high))) + return "expirationDate: integer|Long expected"; + return null; + }; + + /** + * Creates a SubscriptionAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.SubscriptionAction} SubscriptionAction + */ + SubscriptionAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.SubscriptionAction) + return object; + var message = new $root.proto.SyncActionValue.SubscriptionAction(); + if (object.isDeactivated != null) + message.isDeactivated = Boolean(object.isDeactivated); + if (object.isAutoRenewing != null) + message.isAutoRenewing = Boolean(object.isAutoRenewing); + if (object.expirationDate != null) + if ($util.Long) + (message.expirationDate = $util.Long.fromValue(object.expirationDate)).unsigned = false; + else if (typeof object.expirationDate === "string") + message.expirationDate = parseInt(object.expirationDate, 10); + else if (typeof object.expirationDate === "number") + message.expirationDate = object.expirationDate; + else if (typeof object.expirationDate === "object") + message.expirationDate = new $util.LongBits(object.expirationDate.low >>> 0, object.expirationDate.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a SubscriptionAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.SubscriptionAction + * @static + * @param {proto.SyncActionValue.SubscriptionAction} message SubscriptionAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SubscriptionAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.isDeactivated = false; + object.isAutoRenewing = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.expirationDate = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.expirationDate = options.longs === String ? "0" : 0; + } + if (message.isDeactivated != null && message.hasOwnProperty("isDeactivated")) + object.isDeactivated = message.isDeactivated; + if (message.isAutoRenewing != null && message.hasOwnProperty("isAutoRenewing")) + object.isAutoRenewing = message.isAutoRenewing; + if (message.expirationDate != null && message.hasOwnProperty("expirationDate")) + if (typeof message.expirationDate === "number") + object.expirationDate = options.longs === String ? String(message.expirationDate) : message.expirationDate; + else + object.expirationDate = options.longs === String ? $util.Long.prototype.toString.call(message.expirationDate) : options.longs === Number ? new $util.LongBits(message.expirationDate.low >>> 0, message.expirationDate.high >>> 0).toNumber() : message.expirationDate; + return object; + }; + + /** + * Converts this SubscriptionAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.SubscriptionAction + * @instance + * @returns {Object.} JSON object + */ + SubscriptionAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SubscriptionAction; + })(); + + SyncActionValue.SyncActionMessage = (function() { + + /** + * Properties of a SyncActionMessage. + * @memberof proto.SyncActionValue + * @interface ISyncActionMessage + * @property {proto.IMessageKey|null} [key] SyncActionMessage key + * @property {number|Long|null} [timestamp] SyncActionMessage timestamp + */ + + /** + * Constructs a new SyncActionMessage. + * @memberof proto.SyncActionValue + * @classdesc Represents a SyncActionMessage. + * @implements ISyncActionMessage + * @constructor + * @param {proto.SyncActionValue.ISyncActionMessage=} [properties] Properties to set + */ + function SyncActionMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncActionMessage key. + * @member {proto.IMessageKey|null|undefined} key + * @memberof proto.SyncActionValue.SyncActionMessage + * @instance + */ + SyncActionMessage.prototype.key = null; + + /** + * SyncActionMessage timestamp. + * @member {number|Long} timestamp + * @memberof proto.SyncActionValue.SyncActionMessage + * @instance + */ + SyncActionMessage.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new SyncActionMessage instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {proto.SyncActionValue.ISyncActionMessage=} [properties] Properties to set + * @returns {proto.SyncActionValue.SyncActionMessage} SyncActionMessage instance + */ + SyncActionMessage.create = function create(properties) { + return new SyncActionMessage(properties); + }; + + /** + * Encodes the specified SyncActionMessage message. Does not implicitly {@link proto.SyncActionValue.SyncActionMessage.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {proto.SyncActionValue.ISyncActionMessage} message SyncActionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.timestamp); + return writer; + }; + + /** + * Encodes the specified SyncActionMessage message, length delimited. Does not implicitly {@link proto.SyncActionValue.SyncActionMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {proto.SyncActionValue.ISyncActionMessage} message SyncActionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncActionMessage message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.SyncActionMessage} SyncActionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.SyncActionMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.timestamp = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncActionMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.SyncActionMessage} SyncActionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncActionMessage message. + * @function verify + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncActionMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a SyncActionMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.SyncActionMessage} SyncActionMessage + */ + SyncActionMessage.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.SyncActionMessage) + return object; + var message = new $root.proto.SyncActionValue.SyncActionMessage(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.SyncActionValue.SyncActionMessage.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a SyncActionMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.SyncActionMessage + * @static + * @param {proto.SyncActionValue.SyncActionMessage} message SyncActionMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncActionMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp; + return object; + }; + + /** + * Converts this SyncActionMessage to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.SyncActionMessage + * @instance + * @returns {Object.} JSON object + */ + SyncActionMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncActionMessage; + })(); + + SyncActionValue.SyncActionMessageRange = (function() { + + /** + * Properties of a SyncActionMessageRange. + * @memberof proto.SyncActionValue + * @interface ISyncActionMessageRange + * @property {number|Long|null} [lastMessageTimestamp] SyncActionMessageRange lastMessageTimestamp + * @property {number|Long|null} [lastSystemMessageTimestamp] SyncActionMessageRange lastSystemMessageTimestamp + * @property {Array.|null} [messages] SyncActionMessageRange messages + */ + + /** + * Constructs a new SyncActionMessageRange. + * @memberof proto.SyncActionValue + * @classdesc Represents a SyncActionMessageRange. + * @implements ISyncActionMessageRange + * @constructor + * @param {proto.SyncActionValue.ISyncActionMessageRange=} [properties] Properties to set + */ + function SyncActionMessageRange(properties) { + this.messages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncActionMessageRange lastMessageTimestamp. + * @member {number|Long} lastMessageTimestamp + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @instance + */ + SyncActionMessageRange.prototype.lastMessageTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SyncActionMessageRange lastSystemMessageTimestamp. + * @member {number|Long} lastSystemMessageTimestamp + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @instance + */ + SyncActionMessageRange.prototype.lastSystemMessageTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SyncActionMessageRange messages. + * @member {Array.} messages + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @instance + */ + SyncActionMessageRange.prototype.messages = $util.emptyArray; + + /** + * Creates a new SyncActionMessageRange instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {proto.SyncActionValue.ISyncActionMessageRange=} [properties] Properties to set + * @returns {proto.SyncActionValue.SyncActionMessageRange} SyncActionMessageRange instance + */ + SyncActionMessageRange.create = function create(properties) { + return new SyncActionMessageRange(properties); + }; + + /** + * Encodes the specified SyncActionMessageRange message. Does not implicitly {@link proto.SyncActionValue.SyncActionMessageRange.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {proto.SyncActionValue.ISyncActionMessageRange} message SyncActionMessageRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionMessageRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.lastMessageTimestamp != null && Object.hasOwnProperty.call(message, "lastMessageTimestamp")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.lastMessageTimestamp); + if (message.lastSystemMessageTimestamp != null && Object.hasOwnProperty.call(message, "lastSystemMessageTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.lastSystemMessageTimestamp); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.proto.SyncActionValue.SyncActionMessage.encode(message.messages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SyncActionMessageRange message, length delimited. Does not implicitly {@link proto.SyncActionValue.SyncActionMessageRange.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {proto.SyncActionValue.ISyncActionMessageRange} message SyncActionMessageRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncActionMessageRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncActionMessageRange message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.SyncActionMessageRange} SyncActionMessageRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionMessageRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.SyncActionMessageRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.lastMessageTimestamp = reader.int64(); + break; + case 2: + message.lastSystemMessageTimestamp = reader.int64(); + break; + case 3: + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.proto.SyncActionValue.SyncActionMessage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncActionMessageRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.SyncActionMessageRange} SyncActionMessageRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncActionMessageRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncActionMessageRange message. + * @function verify + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncActionMessageRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.lastMessageTimestamp != null && message.hasOwnProperty("lastMessageTimestamp")) + if (!$util.isInteger(message.lastMessageTimestamp) && !(message.lastMessageTimestamp && $util.isInteger(message.lastMessageTimestamp.low) && $util.isInteger(message.lastMessageTimestamp.high))) + return "lastMessageTimestamp: integer|Long expected"; + if (message.lastSystemMessageTimestamp != null && message.hasOwnProperty("lastSystemMessageTimestamp")) + if (!$util.isInteger(message.lastSystemMessageTimestamp) && !(message.lastSystemMessageTimestamp && $util.isInteger(message.lastSystemMessageTimestamp.low) && $util.isInteger(message.lastSystemMessageTimestamp.high))) + return "lastSystemMessageTimestamp: integer|Long expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.proto.SyncActionValue.SyncActionMessage.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + return null; + }; + + /** + * Creates a SyncActionMessageRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.SyncActionMessageRange} SyncActionMessageRange + */ + SyncActionMessageRange.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.SyncActionMessageRange) + return object; + var message = new $root.proto.SyncActionValue.SyncActionMessageRange(); + if (object.lastMessageTimestamp != null) + if ($util.Long) + (message.lastMessageTimestamp = $util.Long.fromValue(object.lastMessageTimestamp)).unsigned = false; + else if (typeof object.lastMessageTimestamp === "string") + message.lastMessageTimestamp = parseInt(object.lastMessageTimestamp, 10); + else if (typeof object.lastMessageTimestamp === "number") + message.lastMessageTimestamp = object.lastMessageTimestamp; + else if (typeof object.lastMessageTimestamp === "object") + message.lastMessageTimestamp = new $util.LongBits(object.lastMessageTimestamp.low >>> 0, object.lastMessageTimestamp.high >>> 0).toNumber(); + if (object.lastSystemMessageTimestamp != null) + if ($util.Long) + (message.lastSystemMessageTimestamp = $util.Long.fromValue(object.lastSystemMessageTimestamp)).unsigned = false; + else if (typeof object.lastSystemMessageTimestamp === "string") + message.lastSystemMessageTimestamp = parseInt(object.lastSystemMessageTimestamp, 10); + else if (typeof object.lastSystemMessageTimestamp === "number") + message.lastSystemMessageTimestamp = object.lastSystemMessageTimestamp; + else if (typeof object.lastSystemMessageTimestamp === "object") + message.lastSystemMessageTimestamp = new $util.LongBits(object.lastSystemMessageTimestamp.low >>> 0, object.lastSystemMessageTimestamp.high >>> 0).toNumber(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".proto.SyncActionValue.SyncActionMessageRange.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".proto.SyncActionValue.SyncActionMessageRange.messages: object expected"); + message.messages[i] = $root.proto.SyncActionValue.SyncActionMessage.fromObject(object.messages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SyncActionMessageRange message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @static + * @param {proto.SyncActionValue.SyncActionMessageRange} message SyncActionMessageRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncActionMessageRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messages = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastMessageTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastMessageTimestamp = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.lastSystemMessageTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.lastSystemMessageTimestamp = options.longs === String ? "0" : 0; + } + if (message.lastMessageTimestamp != null && message.hasOwnProperty("lastMessageTimestamp")) + if (typeof message.lastMessageTimestamp === "number") + object.lastMessageTimestamp = options.longs === String ? String(message.lastMessageTimestamp) : message.lastMessageTimestamp; + else + object.lastMessageTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.lastMessageTimestamp) : options.longs === Number ? new $util.LongBits(message.lastMessageTimestamp.low >>> 0, message.lastMessageTimestamp.high >>> 0).toNumber() : message.lastMessageTimestamp; + if (message.lastSystemMessageTimestamp != null && message.hasOwnProperty("lastSystemMessageTimestamp")) + if (typeof message.lastSystemMessageTimestamp === "number") + object.lastSystemMessageTimestamp = options.longs === String ? String(message.lastSystemMessageTimestamp) : message.lastSystemMessageTimestamp; + else + object.lastSystemMessageTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.lastSystemMessageTimestamp) : options.longs === Number ? new $util.LongBits(message.lastSystemMessageTimestamp.low >>> 0, message.lastSystemMessageTimestamp.high >>> 0).toNumber() : message.lastSystemMessageTimestamp; + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.proto.SyncActionValue.SyncActionMessage.toObject(message.messages[j], options); + } + return object; + }; + + /** + * Converts this SyncActionMessageRange to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.SyncActionMessageRange + * @instance + * @returns {Object.} JSON object + */ + SyncActionMessageRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncActionMessageRange; + })(); + + SyncActionValue.TimeFormatAction = (function() { + + /** + * Properties of a TimeFormatAction. + * @memberof proto.SyncActionValue + * @interface ITimeFormatAction + * @property {boolean|null} [isTwentyFourHourFormatEnabled] TimeFormatAction isTwentyFourHourFormatEnabled + */ + + /** + * Constructs a new TimeFormatAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a TimeFormatAction. + * @implements ITimeFormatAction + * @constructor + * @param {proto.SyncActionValue.ITimeFormatAction=} [properties] Properties to set + */ + function TimeFormatAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeFormatAction isTwentyFourHourFormatEnabled. + * @member {boolean} isTwentyFourHourFormatEnabled + * @memberof proto.SyncActionValue.TimeFormatAction + * @instance + */ + TimeFormatAction.prototype.isTwentyFourHourFormatEnabled = false; + + /** + * Creates a new TimeFormatAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {proto.SyncActionValue.ITimeFormatAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.TimeFormatAction} TimeFormatAction instance + */ + TimeFormatAction.create = function create(properties) { + return new TimeFormatAction(properties); + }; + + /** + * Encodes the specified TimeFormatAction message. Does not implicitly {@link proto.SyncActionValue.TimeFormatAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {proto.SyncActionValue.ITimeFormatAction} message TimeFormatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeFormatAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.isTwentyFourHourFormatEnabled != null && Object.hasOwnProperty.call(message, "isTwentyFourHourFormatEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.isTwentyFourHourFormatEnabled); + return writer; + }; + + /** + * Encodes the specified TimeFormatAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.TimeFormatAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {proto.SyncActionValue.ITimeFormatAction} message TimeFormatAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeFormatAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeFormatAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.TimeFormatAction} TimeFormatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeFormatAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.TimeFormatAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.isTwentyFourHourFormatEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeFormatAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.TimeFormatAction} TimeFormatAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeFormatAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeFormatAction message. + * @function verify + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeFormatAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.isTwentyFourHourFormatEnabled != null && message.hasOwnProperty("isTwentyFourHourFormatEnabled")) + if (typeof message.isTwentyFourHourFormatEnabled !== "boolean") + return "isTwentyFourHourFormatEnabled: boolean expected"; + return null; + }; + + /** + * Creates a TimeFormatAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.TimeFormatAction} TimeFormatAction + */ + TimeFormatAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.TimeFormatAction) + return object; + var message = new $root.proto.SyncActionValue.TimeFormatAction(); + if (object.isTwentyFourHourFormatEnabled != null) + message.isTwentyFourHourFormatEnabled = Boolean(object.isTwentyFourHourFormatEnabled); + return message; + }; + + /** + * Creates a plain object from a TimeFormatAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.TimeFormatAction + * @static + * @param {proto.SyncActionValue.TimeFormatAction} message TimeFormatAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeFormatAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.isTwentyFourHourFormatEnabled = false; + if (message.isTwentyFourHourFormatEnabled != null && message.hasOwnProperty("isTwentyFourHourFormatEnabled")) + object.isTwentyFourHourFormatEnabled = message.isTwentyFourHourFormatEnabled; + return object; + }; + + /** + * Converts this TimeFormatAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.TimeFormatAction + * @instance + * @returns {Object.} JSON object + */ + TimeFormatAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TimeFormatAction; + })(); + + SyncActionValue.UnarchiveChatsSetting = (function() { + + /** + * Properties of an UnarchiveChatsSetting. + * @memberof proto.SyncActionValue + * @interface IUnarchiveChatsSetting + * @property {boolean|null} [unarchiveChats] UnarchiveChatsSetting unarchiveChats + */ + + /** + * Constructs a new UnarchiveChatsSetting. + * @memberof proto.SyncActionValue + * @classdesc Represents an UnarchiveChatsSetting. + * @implements IUnarchiveChatsSetting + * @constructor + * @param {proto.SyncActionValue.IUnarchiveChatsSetting=} [properties] Properties to set + */ + function UnarchiveChatsSetting(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UnarchiveChatsSetting unarchiveChats. + * @member {boolean} unarchiveChats + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @instance + */ + UnarchiveChatsSetting.prototype.unarchiveChats = false; + + /** + * Creates a new UnarchiveChatsSetting instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {proto.SyncActionValue.IUnarchiveChatsSetting=} [properties] Properties to set + * @returns {proto.SyncActionValue.UnarchiveChatsSetting} UnarchiveChatsSetting instance + */ + UnarchiveChatsSetting.create = function create(properties) { + return new UnarchiveChatsSetting(properties); + }; + + /** + * Encodes the specified UnarchiveChatsSetting message. Does not implicitly {@link proto.SyncActionValue.UnarchiveChatsSetting.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {proto.SyncActionValue.IUnarchiveChatsSetting} message UnarchiveChatsSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnarchiveChatsSetting.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.unarchiveChats != null && Object.hasOwnProperty.call(message, "unarchiveChats")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.unarchiveChats); + return writer; + }; + + /** + * Encodes the specified UnarchiveChatsSetting message, length delimited. Does not implicitly {@link proto.SyncActionValue.UnarchiveChatsSetting.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {proto.SyncActionValue.IUnarchiveChatsSetting} message UnarchiveChatsSetting message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UnarchiveChatsSetting.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UnarchiveChatsSetting message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.UnarchiveChatsSetting} UnarchiveChatsSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnarchiveChatsSetting.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.UnarchiveChatsSetting(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unarchiveChats = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UnarchiveChatsSetting message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.UnarchiveChatsSetting} UnarchiveChatsSetting + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UnarchiveChatsSetting.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UnarchiveChatsSetting message. + * @function verify + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UnarchiveChatsSetting.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.unarchiveChats != null && message.hasOwnProperty("unarchiveChats")) + if (typeof message.unarchiveChats !== "boolean") + return "unarchiveChats: boolean expected"; + return null; + }; + + /** + * Creates an UnarchiveChatsSetting message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.UnarchiveChatsSetting} UnarchiveChatsSetting + */ + UnarchiveChatsSetting.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.UnarchiveChatsSetting) + return object; + var message = new $root.proto.SyncActionValue.UnarchiveChatsSetting(); + if (object.unarchiveChats != null) + message.unarchiveChats = Boolean(object.unarchiveChats); + return message; + }; + + /** + * Creates a plain object from an UnarchiveChatsSetting message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @static + * @param {proto.SyncActionValue.UnarchiveChatsSetting} message UnarchiveChatsSetting + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UnarchiveChatsSetting.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.unarchiveChats = false; + if (message.unarchiveChats != null && message.hasOwnProperty("unarchiveChats")) + object.unarchiveChats = message.unarchiveChats; + return object; + }; + + /** + * Converts this UnarchiveChatsSetting to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.UnarchiveChatsSetting + * @instance + * @returns {Object.} JSON object + */ + UnarchiveChatsSetting.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UnarchiveChatsSetting; + })(); + + SyncActionValue.UserStatusMuteAction = (function() { + + /** + * Properties of a UserStatusMuteAction. + * @memberof proto.SyncActionValue + * @interface IUserStatusMuteAction + * @property {boolean|null} [muted] UserStatusMuteAction muted + */ + + /** + * Constructs a new UserStatusMuteAction. + * @memberof proto.SyncActionValue + * @classdesc Represents a UserStatusMuteAction. + * @implements IUserStatusMuteAction + * @constructor + * @param {proto.SyncActionValue.IUserStatusMuteAction=} [properties] Properties to set + */ + function UserStatusMuteAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserStatusMuteAction muted. + * @member {boolean} muted + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @instance + */ + UserStatusMuteAction.prototype.muted = false; + + /** + * Creates a new UserStatusMuteAction instance using the specified properties. + * @function create + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {proto.SyncActionValue.IUserStatusMuteAction=} [properties] Properties to set + * @returns {proto.SyncActionValue.UserStatusMuteAction} UserStatusMuteAction instance + */ + UserStatusMuteAction.create = function create(properties) { + return new UserStatusMuteAction(properties); + }; + + /** + * Encodes the specified UserStatusMuteAction message. Does not implicitly {@link proto.SyncActionValue.UserStatusMuteAction.verify|verify} messages. + * @function encode + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {proto.SyncActionValue.IUserStatusMuteAction} message UserStatusMuteAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserStatusMuteAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.muted != null && Object.hasOwnProperty.call(message, "muted")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.muted); + return writer; + }; + + /** + * Encodes the specified UserStatusMuteAction message, length delimited. Does not implicitly {@link proto.SyncActionValue.UserStatusMuteAction.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {proto.SyncActionValue.IUserStatusMuteAction} message UserStatusMuteAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserStatusMuteAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserStatusMuteAction message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncActionValue.UserStatusMuteAction} UserStatusMuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserStatusMuteAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncActionValue.UserStatusMuteAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.muted = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserStatusMuteAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncActionValue.UserStatusMuteAction} UserStatusMuteAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserStatusMuteAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserStatusMuteAction message. + * @function verify + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserStatusMuteAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.muted != null && message.hasOwnProperty("muted")) + if (typeof message.muted !== "boolean") + return "muted: boolean expected"; + return null; + }; + + /** + * Creates a UserStatusMuteAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncActionValue.UserStatusMuteAction} UserStatusMuteAction + */ + UserStatusMuteAction.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncActionValue.UserStatusMuteAction) + return object; + var message = new $root.proto.SyncActionValue.UserStatusMuteAction(); + if (object.muted != null) + message.muted = Boolean(object.muted); + return message; + }; + + /** + * Creates a plain object from a UserStatusMuteAction message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @static + * @param {proto.SyncActionValue.UserStatusMuteAction} message UserStatusMuteAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserStatusMuteAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.muted = false; + if (message.muted != null && message.hasOwnProperty("muted")) + object.muted = message.muted; + return object; + }; + + /** + * Converts this UserStatusMuteAction to JSON. + * @function toJSON + * @memberof proto.SyncActionValue.UserStatusMuteAction + * @instance + * @returns {Object.} JSON object + */ + UserStatusMuteAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserStatusMuteAction; + })(); + + return SyncActionValue; + })(); + + proto.SyncdIndex = (function() { + + /** + * Properties of a SyncdIndex. + * @memberof proto + * @interface ISyncdIndex + * @property {Uint8Array|null} [blob] SyncdIndex blob + */ + + /** + * Constructs a new SyncdIndex. + * @memberof proto + * @classdesc Represents a SyncdIndex. + * @implements ISyncdIndex + * @constructor + * @param {proto.ISyncdIndex=} [properties] Properties to set + */ + function SyncdIndex(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdIndex blob. + * @member {Uint8Array} blob + * @memberof proto.SyncdIndex + * @instance + */ + SyncdIndex.prototype.blob = $util.newBuffer([]); + + /** + * Creates a new SyncdIndex instance using the specified properties. + * @function create + * @memberof proto.SyncdIndex + * @static + * @param {proto.ISyncdIndex=} [properties] Properties to set + * @returns {proto.SyncdIndex} SyncdIndex instance + */ + SyncdIndex.create = function create(properties) { + return new SyncdIndex(properties); + }; + + /** + * Encodes the specified SyncdIndex message. Does not implicitly {@link proto.SyncdIndex.verify|verify} messages. + * @function encode + * @memberof proto.SyncdIndex + * @static + * @param {proto.ISyncdIndex} message SyncdIndex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdIndex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.blob != null && Object.hasOwnProperty.call(message, "blob")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.blob); + return writer; + }; + + /** + * Encodes the specified SyncdIndex message, length delimited. Does not implicitly {@link proto.SyncdIndex.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdIndex + * @static + * @param {proto.ISyncdIndex} message SyncdIndex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdIndex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdIndex message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdIndex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdIndex} SyncdIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdIndex.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdIndex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blob = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdIndex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdIndex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdIndex} SyncdIndex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdIndex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdIndex message. + * @function verify + * @memberof proto.SyncdIndex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdIndex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.blob != null && message.hasOwnProperty("blob")) + if (!(message.blob && typeof message.blob.length === "number" || $util.isString(message.blob))) + return "blob: buffer expected"; + return null; + }; + + /** + * Creates a SyncdIndex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdIndex + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdIndex} SyncdIndex + */ + SyncdIndex.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdIndex) + return object; + var message = new $root.proto.SyncdIndex(); + if (object.blob != null) + if (typeof object.blob === "string") + $util.base64.decode(object.blob, message.blob = $util.newBuffer($util.base64.length(object.blob)), 0); + else if (object.blob.length) + message.blob = object.blob; + return message; + }; + + /** + * Creates a plain object from a SyncdIndex message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdIndex + * @static + * @param {proto.SyncdIndex} message SyncdIndex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdIndex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.blob = ""; + else { + object.blob = []; + if (options.bytes !== Array) + object.blob = $util.newBuffer(object.blob); + } + if (message.blob != null && message.hasOwnProperty("blob")) + object.blob = options.bytes === String ? $util.base64.encode(message.blob, 0, message.blob.length) : options.bytes === Array ? Array.prototype.slice.call(message.blob) : message.blob; + return object; + }; + + /** + * Converts this SyncdIndex to JSON. + * @function toJSON + * @memberof proto.SyncdIndex + * @instance + * @returns {Object.} JSON object + */ + SyncdIndex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdIndex; + })(); + + proto.SyncdMutation = (function() { + + /** + * Properties of a SyncdMutation. + * @memberof proto + * @interface ISyncdMutation + * @property {proto.SyncdMutation.SyncdOperation|null} [operation] SyncdMutation operation + * @property {proto.ISyncdRecord|null} [record] SyncdMutation record + */ + + /** + * Constructs a new SyncdMutation. + * @memberof proto + * @classdesc Represents a SyncdMutation. + * @implements ISyncdMutation + * @constructor + * @param {proto.ISyncdMutation=} [properties] Properties to set + */ + function SyncdMutation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdMutation operation. + * @member {proto.SyncdMutation.SyncdOperation} operation + * @memberof proto.SyncdMutation + * @instance + */ + SyncdMutation.prototype.operation = 0; + + /** + * SyncdMutation record. + * @member {proto.ISyncdRecord|null|undefined} record + * @memberof proto.SyncdMutation + * @instance + */ + SyncdMutation.prototype.record = null; + + /** + * Creates a new SyncdMutation instance using the specified properties. + * @function create + * @memberof proto.SyncdMutation + * @static + * @param {proto.ISyncdMutation=} [properties] Properties to set + * @returns {proto.SyncdMutation} SyncdMutation instance + */ + SyncdMutation.create = function create(properties) { + return new SyncdMutation(properties); + }; + + /** + * Encodes the specified SyncdMutation message. Does not implicitly {@link proto.SyncdMutation.verify|verify} messages. + * @function encode + * @memberof proto.SyncdMutation + * @static + * @param {proto.ISyncdMutation} message SyncdMutation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdMutation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.operation); + if (message.record != null && Object.hasOwnProperty.call(message, "record")) + $root.proto.SyncdRecord.encode(message.record, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SyncdMutation message, length delimited. Does not implicitly {@link proto.SyncdMutation.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdMutation + * @static + * @param {proto.ISyncdMutation} message SyncdMutation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdMutation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdMutation message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdMutation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdMutation} SyncdMutation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdMutation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdMutation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operation = reader.int32(); + break; + case 2: + message.record = $root.proto.SyncdRecord.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdMutation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdMutation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdMutation} SyncdMutation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdMutation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdMutation message. + * @function verify + * @memberof proto.SyncdMutation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdMutation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operation != null && message.hasOwnProperty("operation")) + switch (message.operation) { + default: + return "operation: enum value expected"; + case 0: + case 1: + break; + } + if (message.record != null && message.hasOwnProperty("record")) { + var error = $root.proto.SyncdRecord.verify(message.record); + if (error) + return "record." + error; + } + return null; + }; + + /** + * Creates a SyncdMutation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdMutation + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdMutation} SyncdMutation + */ + SyncdMutation.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdMutation) + return object; + var message = new $root.proto.SyncdMutation(); + switch (object.operation) { + case "SET": + case 0: + message.operation = 0; + break; + case "REMOVE": + case 1: + message.operation = 1; + break; + } + if (object.record != null) { + if (typeof object.record !== "object") + throw TypeError(".proto.SyncdMutation.record: object expected"); + message.record = $root.proto.SyncdRecord.fromObject(object.record); + } + return message; + }; + + /** + * Creates a plain object from a SyncdMutation message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdMutation + * @static + * @param {proto.SyncdMutation} message SyncdMutation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdMutation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.operation = options.enums === String ? "SET" : 0; + object.record = null; + } + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = options.enums === String ? $root.proto.SyncdMutation.SyncdOperation[message.operation] : message.operation; + if (message.record != null && message.hasOwnProperty("record")) + object.record = $root.proto.SyncdRecord.toObject(message.record, options); + return object; + }; + + /** + * Converts this SyncdMutation to JSON. + * @function toJSON + * @memberof proto.SyncdMutation + * @instance + * @returns {Object.} JSON object + */ + SyncdMutation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * SyncdOperation enum. + * @name proto.SyncdMutation.SyncdOperation + * @enum {number} + * @property {number} SET=0 SET value + * @property {number} REMOVE=1 REMOVE value + */ + SyncdMutation.SyncdOperation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SET"] = 0; + values[valuesById[1] = "REMOVE"] = 1; + return values; + })(); + + return SyncdMutation; + })(); + + proto.SyncdMutations = (function() { + + /** + * Properties of a SyncdMutations. + * @memberof proto + * @interface ISyncdMutations + * @property {Array.|null} [mutations] SyncdMutations mutations + */ + + /** + * Constructs a new SyncdMutations. + * @memberof proto + * @classdesc Represents a SyncdMutations. + * @implements ISyncdMutations + * @constructor + * @param {proto.ISyncdMutations=} [properties] Properties to set + */ + function SyncdMutations(properties) { + this.mutations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdMutations mutations. + * @member {Array.} mutations + * @memberof proto.SyncdMutations + * @instance + */ + SyncdMutations.prototype.mutations = $util.emptyArray; + + /** + * Creates a new SyncdMutations instance using the specified properties. + * @function create + * @memberof proto.SyncdMutations + * @static + * @param {proto.ISyncdMutations=} [properties] Properties to set + * @returns {proto.SyncdMutations} SyncdMutations instance + */ + SyncdMutations.create = function create(properties) { + return new SyncdMutations(properties); + }; + + /** + * Encodes the specified SyncdMutations message. Does not implicitly {@link proto.SyncdMutations.verify|verify} messages. + * @function encode + * @memberof proto.SyncdMutations + * @static + * @param {proto.ISyncdMutations} message SyncdMutations message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdMutations.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mutations != null && message.mutations.length) + for (var i = 0; i < message.mutations.length; ++i) + $root.proto.SyncdMutation.encode(message.mutations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SyncdMutations message, length delimited. Does not implicitly {@link proto.SyncdMutations.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdMutations + * @static + * @param {proto.ISyncdMutations} message SyncdMutations message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdMutations.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdMutations message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdMutations + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdMutations} SyncdMutations + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdMutations.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdMutations(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.mutations && message.mutations.length)) + message.mutations = []; + message.mutations.push($root.proto.SyncdMutation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdMutations message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdMutations + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdMutations} SyncdMutations + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdMutations.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdMutations message. + * @function verify + * @memberof proto.SyncdMutations + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdMutations.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mutations != null && message.hasOwnProperty("mutations")) { + if (!Array.isArray(message.mutations)) + return "mutations: array expected"; + for (var i = 0; i < message.mutations.length; ++i) { + var error = $root.proto.SyncdMutation.verify(message.mutations[i]); + if (error) + return "mutations." + error; + } + } + return null; + }; + + /** + * Creates a SyncdMutations message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdMutations + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdMutations} SyncdMutations + */ + SyncdMutations.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdMutations) + return object; + var message = new $root.proto.SyncdMutations(); + if (object.mutations) { + if (!Array.isArray(object.mutations)) + throw TypeError(".proto.SyncdMutations.mutations: array expected"); + message.mutations = []; + for (var i = 0; i < object.mutations.length; ++i) { + if (typeof object.mutations[i] !== "object") + throw TypeError(".proto.SyncdMutations.mutations: object expected"); + message.mutations[i] = $root.proto.SyncdMutation.fromObject(object.mutations[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SyncdMutations message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdMutations + * @static + * @param {proto.SyncdMutations} message SyncdMutations + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdMutations.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mutations = []; + if (message.mutations && message.mutations.length) { + object.mutations = []; + for (var j = 0; j < message.mutations.length; ++j) + object.mutations[j] = $root.proto.SyncdMutation.toObject(message.mutations[j], options); + } + return object; + }; + + /** + * Converts this SyncdMutations to JSON. + * @function toJSON + * @memberof proto.SyncdMutations + * @instance + * @returns {Object.} JSON object + */ + SyncdMutations.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdMutations; + })(); + + proto.SyncdPatch = (function() { + + /** + * Properties of a SyncdPatch. + * @memberof proto + * @interface ISyncdPatch + * @property {proto.ISyncdVersion|null} [version] SyncdPatch version + * @property {Array.|null} [mutations] SyncdPatch mutations + * @property {proto.IExternalBlobReference|null} [externalMutations] SyncdPatch externalMutations + * @property {Uint8Array|null} [snapshotMac] SyncdPatch snapshotMac + * @property {Uint8Array|null} [patchMac] SyncdPatch patchMac + * @property {proto.IKeyId|null} [keyId] SyncdPatch keyId + * @property {proto.IExitCode|null} [exitCode] SyncdPatch exitCode + * @property {number|null} [deviceIndex] SyncdPatch deviceIndex + */ + + /** + * Constructs a new SyncdPatch. + * @memberof proto + * @classdesc Represents a SyncdPatch. + * @implements ISyncdPatch + * @constructor + * @param {proto.ISyncdPatch=} [properties] Properties to set + */ + function SyncdPatch(properties) { + this.mutations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdPatch version. + * @member {proto.ISyncdVersion|null|undefined} version + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.version = null; + + /** + * SyncdPatch mutations. + * @member {Array.} mutations + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.mutations = $util.emptyArray; + + /** + * SyncdPatch externalMutations. + * @member {proto.IExternalBlobReference|null|undefined} externalMutations + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.externalMutations = null; + + /** + * SyncdPatch snapshotMac. + * @member {Uint8Array} snapshotMac + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.snapshotMac = $util.newBuffer([]); + + /** + * SyncdPatch patchMac. + * @member {Uint8Array} patchMac + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.patchMac = $util.newBuffer([]); + + /** + * SyncdPatch keyId. + * @member {proto.IKeyId|null|undefined} keyId + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.keyId = null; + + /** + * SyncdPatch exitCode. + * @member {proto.IExitCode|null|undefined} exitCode + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.exitCode = null; + + /** + * SyncdPatch deviceIndex. + * @member {number} deviceIndex + * @memberof proto.SyncdPatch + * @instance + */ + SyncdPatch.prototype.deviceIndex = 0; + + /** + * Creates a new SyncdPatch instance using the specified properties. + * @function create + * @memberof proto.SyncdPatch + * @static + * @param {proto.ISyncdPatch=} [properties] Properties to set + * @returns {proto.SyncdPatch} SyncdPatch instance + */ + SyncdPatch.create = function create(properties) { + return new SyncdPatch(properties); + }; + + /** + * Encodes the specified SyncdPatch message. Does not implicitly {@link proto.SyncdPatch.verify|verify} messages. + * @function encode + * @memberof proto.SyncdPatch + * @static + * @param {proto.ISyncdPatch} message SyncdPatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdPatch.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.proto.SyncdVersion.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mutations != null && message.mutations.length) + for (var i = 0; i < message.mutations.length; ++i) + $root.proto.SyncdMutation.encode(message.mutations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.externalMutations != null && Object.hasOwnProperty.call(message, "externalMutations")) + $root.proto.ExternalBlobReference.encode(message.externalMutations, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.snapshotMac != null && Object.hasOwnProperty.call(message, "snapshotMac")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.snapshotMac); + if (message.patchMac != null && Object.hasOwnProperty.call(message, "patchMac")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.patchMac); + if (message.keyId != null && Object.hasOwnProperty.call(message, "keyId")) + $root.proto.KeyId.encode(message.keyId, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.exitCode != null && Object.hasOwnProperty.call(message, "exitCode")) + $root.proto.ExitCode.encode(message.exitCode, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.deviceIndex != null && Object.hasOwnProperty.call(message, "deviceIndex")) + writer.uint32(/* id 8, wireType 0 =*/64).uint32(message.deviceIndex); + return writer; + }; + + /** + * Encodes the specified SyncdPatch message, length delimited. Does not implicitly {@link proto.SyncdPatch.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdPatch + * @static + * @param {proto.ISyncdPatch} message SyncdPatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdPatch.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdPatch message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdPatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdPatch} SyncdPatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdPatch.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdPatch(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = $root.proto.SyncdVersion.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.mutations && message.mutations.length)) + message.mutations = []; + message.mutations.push($root.proto.SyncdMutation.decode(reader, reader.uint32())); + break; + case 3: + message.externalMutations = $root.proto.ExternalBlobReference.decode(reader, reader.uint32()); + break; + case 4: + message.snapshotMac = reader.bytes(); + break; + case 5: + message.patchMac = reader.bytes(); + break; + case 6: + message.keyId = $root.proto.KeyId.decode(reader, reader.uint32()); + break; + case 7: + message.exitCode = $root.proto.ExitCode.decode(reader, reader.uint32()); + break; + case 8: + message.deviceIndex = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdPatch message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdPatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdPatch} SyncdPatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdPatch.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdPatch message. + * @function verify + * @memberof proto.SyncdPatch + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdPatch.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.proto.SyncdVersion.verify(message.version); + if (error) + return "version." + error; + } + if (message.mutations != null && message.hasOwnProperty("mutations")) { + if (!Array.isArray(message.mutations)) + return "mutations: array expected"; + for (var i = 0; i < message.mutations.length; ++i) { + var error = $root.proto.SyncdMutation.verify(message.mutations[i]); + if (error) + return "mutations." + error; + } + } + if (message.externalMutations != null && message.hasOwnProperty("externalMutations")) { + var error = $root.proto.ExternalBlobReference.verify(message.externalMutations); + if (error) + return "externalMutations." + error; + } + if (message.snapshotMac != null && message.hasOwnProperty("snapshotMac")) + if (!(message.snapshotMac && typeof message.snapshotMac.length === "number" || $util.isString(message.snapshotMac))) + return "snapshotMac: buffer expected"; + if (message.patchMac != null && message.hasOwnProperty("patchMac")) + if (!(message.patchMac && typeof message.patchMac.length === "number" || $util.isString(message.patchMac))) + return "patchMac: buffer expected"; + if (message.keyId != null && message.hasOwnProperty("keyId")) { + var error = $root.proto.KeyId.verify(message.keyId); + if (error) + return "keyId." + error; + } + if (message.exitCode != null && message.hasOwnProperty("exitCode")) { + var error = $root.proto.ExitCode.verify(message.exitCode); + if (error) + return "exitCode." + error; + } + if (message.deviceIndex != null && message.hasOwnProperty("deviceIndex")) + if (!$util.isInteger(message.deviceIndex)) + return "deviceIndex: integer expected"; + return null; + }; + + /** + * Creates a SyncdPatch message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdPatch + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdPatch} SyncdPatch + */ + SyncdPatch.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdPatch) + return object; + var message = new $root.proto.SyncdPatch(); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".proto.SyncdPatch.version: object expected"); + message.version = $root.proto.SyncdVersion.fromObject(object.version); + } + if (object.mutations) { + if (!Array.isArray(object.mutations)) + throw TypeError(".proto.SyncdPatch.mutations: array expected"); + message.mutations = []; + for (var i = 0; i < object.mutations.length; ++i) { + if (typeof object.mutations[i] !== "object") + throw TypeError(".proto.SyncdPatch.mutations: object expected"); + message.mutations[i] = $root.proto.SyncdMutation.fromObject(object.mutations[i]); + } + } + if (object.externalMutations != null) { + if (typeof object.externalMutations !== "object") + throw TypeError(".proto.SyncdPatch.externalMutations: object expected"); + message.externalMutations = $root.proto.ExternalBlobReference.fromObject(object.externalMutations); + } + if (object.snapshotMac != null) + if (typeof object.snapshotMac === "string") + $util.base64.decode(object.snapshotMac, message.snapshotMac = $util.newBuffer($util.base64.length(object.snapshotMac)), 0); + else if (object.snapshotMac.length) + message.snapshotMac = object.snapshotMac; + if (object.patchMac != null) + if (typeof object.patchMac === "string") + $util.base64.decode(object.patchMac, message.patchMac = $util.newBuffer($util.base64.length(object.patchMac)), 0); + else if (object.patchMac.length) + message.patchMac = object.patchMac; + if (object.keyId != null) { + if (typeof object.keyId !== "object") + throw TypeError(".proto.SyncdPatch.keyId: object expected"); + message.keyId = $root.proto.KeyId.fromObject(object.keyId); + } + if (object.exitCode != null) { + if (typeof object.exitCode !== "object") + throw TypeError(".proto.SyncdPatch.exitCode: object expected"); + message.exitCode = $root.proto.ExitCode.fromObject(object.exitCode); + } + if (object.deviceIndex != null) + message.deviceIndex = object.deviceIndex >>> 0; + return message; + }; + + /** + * Creates a plain object from a SyncdPatch message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdPatch + * @static + * @param {proto.SyncdPatch} message SyncdPatch + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdPatch.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mutations = []; + if (options.defaults) { + object.version = null; + object.externalMutations = null; + if (options.bytes === String) + object.snapshotMac = ""; + else { + object.snapshotMac = []; + if (options.bytes !== Array) + object.snapshotMac = $util.newBuffer(object.snapshotMac); + } + if (options.bytes === String) + object.patchMac = ""; + else { + object.patchMac = []; + if (options.bytes !== Array) + object.patchMac = $util.newBuffer(object.patchMac); + } + object.keyId = null; + object.exitCode = null; + object.deviceIndex = 0; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.proto.SyncdVersion.toObject(message.version, options); + if (message.mutations && message.mutations.length) { + object.mutations = []; + for (var j = 0; j < message.mutations.length; ++j) + object.mutations[j] = $root.proto.SyncdMutation.toObject(message.mutations[j], options); + } + if (message.externalMutations != null && message.hasOwnProperty("externalMutations")) + object.externalMutations = $root.proto.ExternalBlobReference.toObject(message.externalMutations, options); + if (message.snapshotMac != null && message.hasOwnProperty("snapshotMac")) + object.snapshotMac = options.bytes === String ? $util.base64.encode(message.snapshotMac, 0, message.snapshotMac.length) : options.bytes === Array ? Array.prototype.slice.call(message.snapshotMac) : message.snapshotMac; + if (message.patchMac != null && message.hasOwnProperty("patchMac")) + object.patchMac = options.bytes === String ? $util.base64.encode(message.patchMac, 0, message.patchMac.length) : options.bytes === Array ? Array.prototype.slice.call(message.patchMac) : message.patchMac; + if (message.keyId != null && message.hasOwnProperty("keyId")) + object.keyId = $root.proto.KeyId.toObject(message.keyId, options); + if (message.exitCode != null && message.hasOwnProperty("exitCode")) + object.exitCode = $root.proto.ExitCode.toObject(message.exitCode, options); + if (message.deviceIndex != null && message.hasOwnProperty("deviceIndex")) + object.deviceIndex = message.deviceIndex; + return object; + }; + + /** + * Converts this SyncdPatch to JSON. + * @function toJSON + * @memberof proto.SyncdPatch + * @instance + * @returns {Object.} JSON object + */ + SyncdPatch.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdPatch; + })(); + + proto.SyncdRecord = (function() { + + /** + * Properties of a SyncdRecord. + * @memberof proto + * @interface ISyncdRecord + * @property {proto.ISyncdIndex|null} [index] SyncdRecord index + * @property {proto.ISyncdValue|null} [value] SyncdRecord value + * @property {proto.IKeyId|null} [keyId] SyncdRecord keyId + */ + + /** + * Constructs a new SyncdRecord. + * @memberof proto + * @classdesc Represents a SyncdRecord. + * @implements ISyncdRecord + * @constructor + * @param {proto.ISyncdRecord=} [properties] Properties to set + */ + function SyncdRecord(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdRecord index. + * @member {proto.ISyncdIndex|null|undefined} index + * @memberof proto.SyncdRecord + * @instance + */ + SyncdRecord.prototype.index = null; + + /** + * SyncdRecord value. + * @member {proto.ISyncdValue|null|undefined} value + * @memberof proto.SyncdRecord + * @instance + */ + SyncdRecord.prototype.value = null; + + /** + * SyncdRecord keyId. + * @member {proto.IKeyId|null|undefined} keyId + * @memberof proto.SyncdRecord + * @instance + */ + SyncdRecord.prototype.keyId = null; + + /** + * Creates a new SyncdRecord instance using the specified properties. + * @function create + * @memberof proto.SyncdRecord + * @static + * @param {proto.ISyncdRecord=} [properties] Properties to set + * @returns {proto.SyncdRecord} SyncdRecord instance + */ + SyncdRecord.create = function create(properties) { + return new SyncdRecord(properties); + }; + + /** + * Encodes the specified SyncdRecord message. Does not implicitly {@link proto.SyncdRecord.verify|verify} messages. + * @function encode + * @memberof proto.SyncdRecord + * @static + * @param {proto.ISyncdRecord} message SyncdRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + $root.proto.SyncdIndex.encode(message.index, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.proto.SyncdValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.keyId != null && Object.hasOwnProperty.call(message, "keyId")) + $root.proto.KeyId.encode(message.keyId, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SyncdRecord message, length delimited. Does not implicitly {@link proto.SyncdRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdRecord + * @static + * @param {proto.ISyncdRecord} message SyncdRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdRecord message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdRecord} SyncdRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = $root.proto.SyncdIndex.decode(reader, reader.uint32()); + break; + case 2: + message.value = $root.proto.SyncdValue.decode(reader, reader.uint32()); + break; + case 3: + message.keyId = $root.proto.KeyId.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdRecord} SyncdRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdRecord message. + * @function verify + * @memberof proto.SyncdRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.index != null && message.hasOwnProperty("index")) { + var error = $root.proto.SyncdIndex.verify(message.index); + if (error) + return "index." + error; + } + if (message.value != null && message.hasOwnProperty("value")) { + var error = $root.proto.SyncdValue.verify(message.value); + if (error) + return "value." + error; + } + if (message.keyId != null && message.hasOwnProperty("keyId")) { + var error = $root.proto.KeyId.verify(message.keyId); + if (error) + return "keyId." + error; + } + return null; + }; + + /** + * Creates a SyncdRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdRecord + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdRecord} SyncdRecord + */ + SyncdRecord.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdRecord) + return object; + var message = new $root.proto.SyncdRecord(); + if (object.index != null) { + if (typeof object.index !== "object") + throw TypeError(".proto.SyncdRecord.index: object expected"); + message.index = $root.proto.SyncdIndex.fromObject(object.index); + } + if (object.value != null) { + if (typeof object.value !== "object") + throw TypeError(".proto.SyncdRecord.value: object expected"); + message.value = $root.proto.SyncdValue.fromObject(object.value); + } + if (object.keyId != null) { + if (typeof object.keyId !== "object") + throw TypeError(".proto.SyncdRecord.keyId: object expected"); + message.keyId = $root.proto.KeyId.fromObject(object.keyId); + } + return message; + }; + + /** + * Creates a plain object from a SyncdRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdRecord + * @static + * @param {proto.SyncdRecord} message SyncdRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.index = null; + object.value = null; + object.keyId = null; + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = $root.proto.SyncdIndex.toObject(message.index, options); + if (message.value != null && message.hasOwnProperty("value")) + object.value = $root.proto.SyncdValue.toObject(message.value, options); + if (message.keyId != null && message.hasOwnProperty("keyId")) + object.keyId = $root.proto.KeyId.toObject(message.keyId, options); + return object; + }; + + /** + * Converts this SyncdRecord to JSON. + * @function toJSON + * @memberof proto.SyncdRecord + * @instance + * @returns {Object.} JSON object + */ + SyncdRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdRecord; + })(); + + proto.SyncdSnapshot = (function() { + + /** + * Properties of a SyncdSnapshot. + * @memberof proto + * @interface ISyncdSnapshot + * @property {proto.ISyncdVersion|null} [version] SyncdSnapshot version + * @property {Array.|null} [records] SyncdSnapshot records + * @property {Uint8Array|null} [mac] SyncdSnapshot mac + * @property {proto.IKeyId|null} [keyId] SyncdSnapshot keyId + */ + + /** + * Constructs a new SyncdSnapshot. + * @memberof proto + * @classdesc Represents a SyncdSnapshot. + * @implements ISyncdSnapshot + * @constructor + * @param {proto.ISyncdSnapshot=} [properties] Properties to set + */ + function SyncdSnapshot(properties) { + this.records = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdSnapshot version. + * @member {proto.ISyncdVersion|null|undefined} version + * @memberof proto.SyncdSnapshot + * @instance + */ + SyncdSnapshot.prototype.version = null; + + /** + * SyncdSnapshot records. + * @member {Array.} records + * @memberof proto.SyncdSnapshot + * @instance + */ + SyncdSnapshot.prototype.records = $util.emptyArray; + + /** + * SyncdSnapshot mac. + * @member {Uint8Array} mac + * @memberof proto.SyncdSnapshot + * @instance + */ + SyncdSnapshot.prototype.mac = $util.newBuffer([]); + + /** + * SyncdSnapshot keyId. + * @member {proto.IKeyId|null|undefined} keyId + * @memberof proto.SyncdSnapshot + * @instance + */ + SyncdSnapshot.prototype.keyId = null; + + /** + * Creates a new SyncdSnapshot instance using the specified properties. + * @function create + * @memberof proto.SyncdSnapshot + * @static + * @param {proto.ISyncdSnapshot=} [properties] Properties to set + * @returns {proto.SyncdSnapshot} SyncdSnapshot instance + */ + SyncdSnapshot.create = function create(properties) { + return new SyncdSnapshot(properties); + }; + + /** + * Encodes the specified SyncdSnapshot message. Does not implicitly {@link proto.SyncdSnapshot.verify|verify} messages. + * @function encode + * @memberof proto.SyncdSnapshot + * @static + * @param {proto.ISyncdSnapshot} message SyncdSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdSnapshot.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.proto.SyncdVersion.encode(message.version, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.records != null && message.records.length) + for (var i = 0; i < message.records.length; ++i) + $root.proto.SyncdRecord.encode(message.records[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mac != null && Object.hasOwnProperty.call(message, "mac")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.mac); + if (message.keyId != null && Object.hasOwnProperty.call(message, "keyId")) + $root.proto.KeyId.encode(message.keyId, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SyncdSnapshot message, length delimited. Does not implicitly {@link proto.SyncdSnapshot.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdSnapshot + * @static + * @param {proto.ISyncdSnapshot} message SyncdSnapshot message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdSnapshot.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdSnapshot message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdSnapshot} SyncdSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdSnapshot.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdSnapshot(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = $root.proto.SyncdVersion.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.records && message.records.length)) + message.records = []; + message.records.push($root.proto.SyncdRecord.decode(reader, reader.uint32())); + break; + case 3: + message.mac = reader.bytes(); + break; + case 4: + message.keyId = $root.proto.KeyId.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdSnapshot message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdSnapshot + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdSnapshot} SyncdSnapshot + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdSnapshot.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdSnapshot message. + * @function verify + * @memberof proto.SyncdSnapshot + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdSnapshot.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.proto.SyncdVersion.verify(message.version); + if (error) + return "version." + error; + } + if (message.records != null && message.hasOwnProperty("records")) { + if (!Array.isArray(message.records)) + return "records: array expected"; + for (var i = 0; i < message.records.length; ++i) { + var error = $root.proto.SyncdRecord.verify(message.records[i]); + if (error) + return "records." + error; + } + } + if (message.mac != null && message.hasOwnProperty("mac")) + if (!(message.mac && typeof message.mac.length === "number" || $util.isString(message.mac))) + return "mac: buffer expected"; + if (message.keyId != null && message.hasOwnProperty("keyId")) { + var error = $root.proto.KeyId.verify(message.keyId); + if (error) + return "keyId." + error; + } + return null; + }; + + /** + * Creates a SyncdSnapshot message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdSnapshot + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdSnapshot} SyncdSnapshot + */ + SyncdSnapshot.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdSnapshot) + return object; + var message = new $root.proto.SyncdSnapshot(); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".proto.SyncdSnapshot.version: object expected"); + message.version = $root.proto.SyncdVersion.fromObject(object.version); + } + if (object.records) { + if (!Array.isArray(object.records)) + throw TypeError(".proto.SyncdSnapshot.records: array expected"); + message.records = []; + for (var i = 0; i < object.records.length; ++i) { + if (typeof object.records[i] !== "object") + throw TypeError(".proto.SyncdSnapshot.records: object expected"); + message.records[i] = $root.proto.SyncdRecord.fromObject(object.records[i]); + } + } + if (object.mac != null) + if (typeof object.mac === "string") + $util.base64.decode(object.mac, message.mac = $util.newBuffer($util.base64.length(object.mac)), 0); + else if (object.mac.length) + message.mac = object.mac; + if (object.keyId != null) { + if (typeof object.keyId !== "object") + throw TypeError(".proto.SyncdSnapshot.keyId: object expected"); + message.keyId = $root.proto.KeyId.fromObject(object.keyId); + } + return message; + }; + + /** + * Creates a plain object from a SyncdSnapshot message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdSnapshot + * @static + * @param {proto.SyncdSnapshot} message SyncdSnapshot + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdSnapshot.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.records = []; + if (options.defaults) { + object.version = null; + if (options.bytes === String) + object.mac = ""; + else { + object.mac = []; + if (options.bytes !== Array) + object.mac = $util.newBuffer(object.mac); + } + object.keyId = null; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.proto.SyncdVersion.toObject(message.version, options); + if (message.records && message.records.length) { + object.records = []; + for (var j = 0; j < message.records.length; ++j) + object.records[j] = $root.proto.SyncdRecord.toObject(message.records[j], options); + } + if (message.mac != null && message.hasOwnProperty("mac")) + object.mac = options.bytes === String ? $util.base64.encode(message.mac, 0, message.mac.length) : options.bytes === Array ? Array.prototype.slice.call(message.mac) : message.mac; + if (message.keyId != null && message.hasOwnProperty("keyId")) + object.keyId = $root.proto.KeyId.toObject(message.keyId, options); + return object; + }; + + /** + * Converts this SyncdSnapshot to JSON. + * @function toJSON + * @memberof proto.SyncdSnapshot + * @instance + * @returns {Object.} JSON object + */ + SyncdSnapshot.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdSnapshot; + })(); + + proto.SyncdValue = (function() { + + /** + * Properties of a SyncdValue. + * @memberof proto + * @interface ISyncdValue + * @property {Uint8Array|null} [blob] SyncdValue blob + */ + + /** + * Constructs a new SyncdValue. + * @memberof proto + * @classdesc Represents a SyncdValue. + * @implements ISyncdValue + * @constructor + * @param {proto.ISyncdValue=} [properties] Properties to set + */ + function SyncdValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdValue blob. + * @member {Uint8Array} blob + * @memberof proto.SyncdValue + * @instance + */ + SyncdValue.prototype.blob = $util.newBuffer([]); + + /** + * Creates a new SyncdValue instance using the specified properties. + * @function create + * @memberof proto.SyncdValue + * @static + * @param {proto.ISyncdValue=} [properties] Properties to set + * @returns {proto.SyncdValue} SyncdValue instance + */ + SyncdValue.create = function create(properties) { + return new SyncdValue(properties); + }; + + /** + * Encodes the specified SyncdValue message. Does not implicitly {@link proto.SyncdValue.verify|verify} messages. + * @function encode + * @memberof proto.SyncdValue + * @static + * @param {proto.ISyncdValue} message SyncdValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.blob != null && Object.hasOwnProperty.call(message, "blob")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.blob); + return writer; + }; + + /** + * Encodes the specified SyncdValue message, length delimited. Does not implicitly {@link proto.SyncdValue.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdValue + * @static + * @param {proto.ISyncdValue} message SyncdValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdValue message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdValue} SyncdValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blob = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdValue} SyncdValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdValue message. + * @function verify + * @memberof proto.SyncdValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.blob != null && message.hasOwnProperty("blob")) + if (!(message.blob && typeof message.blob.length === "number" || $util.isString(message.blob))) + return "blob: buffer expected"; + return null; + }; + + /** + * Creates a SyncdValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdValue + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdValue} SyncdValue + */ + SyncdValue.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdValue) + return object; + var message = new $root.proto.SyncdValue(); + if (object.blob != null) + if (typeof object.blob === "string") + $util.base64.decode(object.blob, message.blob = $util.newBuffer($util.base64.length(object.blob)), 0); + else if (object.blob.length) + message.blob = object.blob; + return message; + }; + + /** + * Creates a plain object from a SyncdValue message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdValue + * @static + * @param {proto.SyncdValue} message SyncdValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.blob = ""; + else { + object.blob = []; + if (options.bytes !== Array) + object.blob = $util.newBuffer(object.blob); + } + if (message.blob != null && message.hasOwnProperty("blob")) + object.blob = options.bytes === String ? $util.base64.encode(message.blob, 0, message.blob.length) : options.bytes === Array ? Array.prototype.slice.call(message.blob) : message.blob; + return object; + }; + + /** + * Converts this SyncdValue to JSON. + * @function toJSON + * @memberof proto.SyncdValue + * @instance + * @returns {Object.} JSON object + */ + SyncdValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdValue; + })(); + + proto.SyncdVersion = (function() { + + /** + * Properties of a SyncdVersion. + * @memberof proto + * @interface ISyncdVersion + * @property {number|Long|null} [version] SyncdVersion version + */ + + /** + * Constructs a new SyncdVersion. + * @memberof proto + * @classdesc Represents a SyncdVersion. + * @implements ISyncdVersion + * @constructor + * @param {proto.ISyncdVersion=} [properties] Properties to set + */ + function SyncdVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncdVersion version. + * @member {number|Long} version + * @memberof proto.SyncdVersion + * @instance + */ + SyncdVersion.prototype.version = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new SyncdVersion instance using the specified properties. + * @function create + * @memberof proto.SyncdVersion + * @static + * @param {proto.ISyncdVersion=} [properties] Properties to set + * @returns {proto.SyncdVersion} SyncdVersion instance + */ + SyncdVersion.create = function create(properties) { + return new SyncdVersion(properties); + }; + + /** + * Encodes the specified SyncdVersion message. Does not implicitly {@link proto.SyncdVersion.verify|verify} messages. + * @function encode + * @memberof proto.SyncdVersion + * @static + * @param {proto.ISyncdVersion} message SyncdVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.version); + return writer; + }; + + /** + * Encodes the specified SyncdVersion message, length delimited. Does not implicitly {@link proto.SyncdVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.SyncdVersion + * @static + * @param {proto.ISyncdVersion} message SyncdVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncdVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncdVersion message from the specified reader or buffer. + * @function decode + * @memberof proto.SyncdVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.SyncdVersion} SyncdVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.SyncdVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncdVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.SyncdVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.SyncdVersion} SyncdVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncdVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncdVersion message. + * @function verify + * @memberof proto.SyncdVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncdVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high))) + return "version: integer|Long expected"; + return null; + }; + + /** + * Creates a SyncdVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.SyncdVersion + * @static + * @param {Object.} object Plain object + * @returns {proto.SyncdVersion} SyncdVersion + */ + SyncdVersion.fromObject = function fromObject(object) { + if (object instanceof $root.proto.SyncdVersion) + return object; + var message = new $root.proto.SyncdVersion(); + if (object.version != null) + if ($util.Long) + (message.version = $util.Long.fromValue(object.version)).unsigned = true; + else if (typeof object.version === "string") + message.version = parseInt(object.version, 10); + else if (typeof object.version === "number") + message.version = object.version; + else if (typeof object.version === "object") + message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a SyncdVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.SyncdVersion + * @static + * @param {proto.SyncdVersion} message SyncdVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncdVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.version = options.longs === String ? "0" : 0; + if (message.version != null && message.hasOwnProperty("version")) + if (typeof message.version === "number") + object.version = options.longs === String ? String(message.version) : message.version; + else + object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber(true) : message.version; + return object; + }; + + /** + * Converts this SyncdVersion to JSON. + * @function toJSON + * @memberof proto.SyncdVersion + * @instance + * @returns {Object.} JSON object + */ + SyncdVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SyncdVersion; + })(); + + proto.TemplateButton = (function() { + + /** + * Properties of a TemplateButton. + * @memberof proto + * @interface ITemplateButton + * @property {number|null} [index] TemplateButton index + * @property {proto.TemplateButton.IQuickReplyButton|null} [quickReplyButton] TemplateButton quickReplyButton + * @property {proto.TemplateButton.IURLButton|null} [urlButton] TemplateButton urlButton + * @property {proto.TemplateButton.ICallButton|null} [callButton] TemplateButton callButton + */ + + /** + * Constructs a new TemplateButton. + * @memberof proto + * @classdesc Represents a TemplateButton. + * @implements ITemplateButton + * @constructor + * @param {proto.ITemplateButton=} [properties] Properties to set + */ + function TemplateButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TemplateButton index. + * @member {number} index + * @memberof proto.TemplateButton + * @instance + */ + TemplateButton.prototype.index = 0; + + /** + * TemplateButton quickReplyButton. + * @member {proto.TemplateButton.IQuickReplyButton|null|undefined} quickReplyButton + * @memberof proto.TemplateButton + * @instance + */ + TemplateButton.prototype.quickReplyButton = null; + + /** + * TemplateButton urlButton. + * @member {proto.TemplateButton.IURLButton|null|undefined} urlButton + * @memberof proto.TemplateButton + * @instance + */ + TemplateButton.prototype.urlButton = null; + + /** + * TemplateButton callButton. + * @member {proto.TemplateButton.ICallButton|null|undefined} callButton + * @memberof proto.TemplateButton + * @instance + */ + TemplateButton.prototype.callButton = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TemplateButton button. + * @member {"quickReplyButton"|"urlButton"|"callButton"|undefined} button + * @memberof proto.TemplateButton + * @instance + */ + Object.defineProperty(TemplateButton.prototype, "button", { + get: $util.oneOfGetter($oneOfFields = ["quickReplyButton", "urlButton", "callButton"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TemplateButton instance using the specified properties. + * @function create + * @memberof proto.TemplateButton + * @static + * @param {proto.ITemplateButton=} [properties] Properties to set + * @returns {proto.TemplateButton} TemplateButton instance + */ + TemplateButton.create = function create(properties) { + return new TemplateButton(properties); + }; + + /** + * Encodes the specified TemplateButton message. Does not implicitly {@link proto.TemplateButton.verify|verify} messages. + * @function encode + * @memberof proto.TemplateButton + * @static + * @param {proto.ITemplateButton} message TemplateButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemplateButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.quickReplyButton != null && Object.hasOwnProperty.call(message, "quickReplyButton")) + $root.proto.TemplateButton.QuickReplyButton.encode(message.quickReplyButton, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.urlButton != null && Object.hasOwnProperty.call(message, "urlButton")) + $root.proto.TemplateButton.URLButton.encode(message.urlButton, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.callButton != null && Object.hasOwnProperty.call(message, "callButton")) + $root.proto.TemplateButton.CallButton.encode(message.callButton, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.index); + return writer; + }; + + /** + * Encodes the specified TemplateButton message, length delimited. Does not implicitly {@link proto.TemplateButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.TemplateButton + * @static + * @param {proto.ITemplateButton} message TemplateButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TemplateButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TemplateButton message from the specified reader or buffer. + * @function decode + * @memberof proto.TemplateButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.TemplateButton} TemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemplateButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.TemplateButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.index = reader.uint32(); + break; + case 1: + message.quickReplyButton = $root.proto.TemplateButton.QuickReplyButton.decode(reader, reader.uint32()); + break; + case 2: + message.urlButton = $root.proto.TemplateButton.URLButton.decode(reader, reader.uint32()); + break; + case 3: + message.callButton = $root.proto.TemplateButton.CallButton.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TemplateButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.TemplateButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.TemplateButton} TemplateButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TemplateButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TemplateButton message. + * @function verify + * @memberof proto.TemplateButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TemplateButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.quickReplyButton != null && message.hasOwnProperty("quickReplyButton")) { + properties.button = 1; + { + var error = $root.proto.TemplateButton.QuickReplyButton.verify(message.quickReplyButton); + if (error) + return "quickReplyButton." + error; + } + } + if (message.urlButton != null && message.hasOwnProperty("urlButton")) { + if (properties.button === 1) + return "button: multiple values"; + properties.button = 1; + { + var error = $root.proto.TemplateButton.URLButton.verify(message.urlButton); + if (error) + return "urlButton." + error; + } + } + if (message.callButton != null && message.hasOwnProperty("callButton")) { + if (properties.button === 1) + return "button: multiple values"; + properties.button = 1; + { + var error = $root.proto.TemplateButton.CallButton.verify(message.callButton); + if (error) + return "callButton." + error; + } + } + return null; + }; + + /** + * Creates a TemplateButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.TemplateButton + * @static + * @param {Object.} object Plain object + * @returns {proto.TemplateButton} TemplateButton + */ + TemplateButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.TemplateButton) + return object; + var message = new $root.proto.TemplateButton(); + if (object.index != null) + message.index = object.index >>> 0; + if (object.quickReplyButton != null) { + if (typeof object.quickReplyButton !== "object") + throw TypeError(".proto.TemplateButton.quickReplyButton: object expected"); + message.quickReplyButton = $root.proto.TemplateButton.QuickReplyButton.fromObject(object.quickReplyButton); + } + if (object.urlButton != null) { + if (typeof object.urlButton !== "object") + throw TypeError(".proto.TemplateButton.urlButton: object expected"); + message.urlButton = $root.proto.TemplateButton.URLButton.fromObject(object.urlButton); + } + if (object.callButton != null) { + if (typeof object.callButton !== "object") + throw TypeError(".proto.TemplateButton.callButton: object expected"); + message.callButton = $root.proto.TemplateButton.CallButton.fromObject(object.callButton); + } + return message; + }; + + /** + * Creates a plain object from a TemplateButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.TemplateButton + * @static + * @param {proto.TemplateButton} message TemplateButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TemplateButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.index = 0; + if (message.quickReplyButton != null && message.hasOwnProperty("quickReplyButton")) { + object.quickReplyButton = $root.proto.TemplateButton.QuickReplyButton.toObject(message.quickReplyButton, options); + if (options.oneofs) + object.button = "quickReplyButton"; + } + if (message.urlButton != null && message.hasOwnProperty("urlButton")) { + object.urlButton = $root.proto.TemplateButton.URLButton.toObject(message.urlButton, options); + if (options.oneofs) + object.button = "urlButton"; + } + if (message.callButton != null && message.hasOwnProperty("callButton")) { + object.callButton = $root.proto.TemplateButton.CallButton.toObject(message.callButton, options); + if (options.oneofs) + object.button = "callButton"; + } + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + return object; + }; + + /** + * Converts this TemplateButton to JSON. + * @function toJSON + * @memberof proto.TemplateButton + * @instance + * @returns {Object.} JSON object + */ + TemplateButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TemplateButton.CallButton = (function() { + + /** + * Properties of a CallButton. + * @memberof proto.TemplateButton + * @interface ICallButton + * @property {proto.Message.IHighlyStructuredMessage|null} [displayText] CallButton displayText + * @property {proto.Message.IHighlyStructuredMessage|null} [phoneNumber] CallButton phoneNumber + */ + + /** + * Constructs a new CallButton. + * @memberof proto.TemplateButton + * @classdesc Represents a CallButton. + * @implements ICallButton + * @constructor + * @param {proto.TemplateButton.ICallButton=} [properties] Properties to set + */ + function CallButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CallButton displayText. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} displayText + * @memberof proto.TemplateButton.CallButton + * @instance + */ + CallButton.prototype.displayText = null; + + /** + * CallButton phoneNumber. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} phoneNumber + * @memberof proto.TemplateButton.CallButton + * @instance + */ + CallButton.prototype.phoneNumber = null; + + /** + * Creates a new CallButton instance using the specified properties. + * @function create + * @memberof proto.TemplateButton.CallButton + * @static + * @param {proto.TemplateButton.ICallButton=} [properties] Properties to set + * @returns {proto.TemplateButton.CallButton} CallButton instance + */ + CallButton.create = function create(properties) { + return new CallButton(properties); + }; + + /** + * Encodes the specified CallButton message. Does not implicitly {@link proto.TemplateButton.CallButton.verify|verify} messages. + * @function encode + * @memberof proto.TemplateButton.CallButton + * @static + * @param {proto.TemplateButton.ICallButton} message CallButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CallButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + $root.proto.Message.HighlyStructuredMessage.encode(message.displayText, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + $root.proto.Message.HighlyStructuredMessage.encode(message.phoneNumber, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CallButton message, length delimited. Does not implicitly {@link proto.TemplateButton.CallButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.TemplateButton.CallButton + * @static + * @param {proto.TemplateButton.ICallButton} message CallButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CallButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CallButton message from the specified reader or buffer. + * @function decode + * @memberof proto.TemplateButton.CallButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.TemplateButton.CallButton} CallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CallButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.TemplateButton.CallButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 2: + message.phoneNumber = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CallButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.TemplateButton.CallButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.TemplateButton.CallButton} CallButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CallButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CallButton message. + * @function verify + * @memberof proto.TemplateButton.CallButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CallButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.displayText); + if (error) + return "displayText." + error; + } + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.phoneNumber); + if (error) + return "phoneNumber." + error; + } + return null; + }; + + /** + * Creates a CallButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.TemplateButton.CallButton + * @static + * @param {Object.} object Plain object + * @returns {proto.TemplateButton.CallButton} CallButton + */ + CallButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.TemplateButton.CallButton) + return object; + var message = new $root.proto.TemplateButton.CallButton(); + if (object.displayText != null) { + if (typeof object.displayText !== "object") + throw TypeError(".proto.TemplateButton.CallButton.displayText: object expected"); + message.displayText = $root.proto.Message.HighlyStructuredMessage.fromObject(object.displayText); + } + if (object.phoneNumber != null) { + if (typeof object.phoneNumber !== "object") + throw TypeError(".proto.TemplateButton.CallButton.phoneNumber: object expected"); + message.phoneNumber = $root.proto.Message.HighlyStructuredMessage.fromObject(object.phoneNumber); + } + return message; + }; + + /** + * Creates a plain object from a CallButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.TemplateButton.CallButton + * @static + * @param {proto.TemplateButton.CallButton} message CallButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CallButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayText = null; + object.phoneNumber = null; + } + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = $root.proto.Message.HighlyStructuredMessage.toObject(message.displayText, options); + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = $root.proto.Message.HighlyStructuredMessage.toObject(message.phoneNumber, options); + return object; + }; + + /** + * Converts this CallButton to JSON. + * @function toJSON + * @memberof proto.TemplateButton.CallButton + * @instance + * @returns {Object.} JSON object + */ + CallButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CallButton; + })(); + + TemplateButton.QuickReplyButton = (function() { + + /** + * Properties of a QuickReplyButton. + * @memberof proto.TemplateButton + * @interface IQuickReplyButton + * @property {proto.Message.IHighlyStructuredMessage|null} [displayText] QuickReplyButton displayText + * @property {string|null} [id] QuickReplyButton id + */ + + /** + * Constructs a new QuickReplyButton. + * @memberof proto.TemplateButton + * @classdesc Represents a QuickReplyButton. + * @implements IQuickReplyButton + * @constructor + * @param {proto.TemplateButton.IQuickReplyButton=} [properties] Properties to set + */ + function QuickReplyButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuickReplyButton displayText. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} displayText + * @memberof proto.TemplateButton.QuickReplyButton + * @instance + */ + QuickReplyButton.prototype.displayText = null; + + /** + * QuickReplyButton id. + * @member {string} id + * @memberof proto.TemplateButton.QuickReplyButton + * @instance + */ + QuickReplyButton.prototype.id = ""; + + /** + * Creates a new QuickReplyButton instance using the specified properties. + * @function create + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {proto.TemplateButton.IQuickReplyButton=} [properties] Properties to set + * @returns {proto.TemplateButton.QuickReplyButton} QuickReplyButton instance + */ + QuickReplyButton.create = function create(properties) { + return new QuickReplyButton(properties); + }; + + /** + * Encodes the specified QuickReplyButton message. Does not implicitly {@link proto.TemplateButton.QuickReplyButton.verify|verify} messages. + * @function encode + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {proto.TemplateButton.IQuickReplyButton} message QuickReplyButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplyButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + $root.proto.Message.HighlyStructuredMessage.encode(message.displayText, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.id); + return writer; + }; + + /** + * Encodes the specified QuickReplyButton message, length delimited. Does not implicitly {@link proto.TemplateButton.QuickReplyButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {proto.TemplateButton.IQuickReplyButton} message QuickReplyButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplyButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuickReplyButton message from the specified reader or buffer. + * @function decode + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.TemplateButton.QuickReplyButton} QuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplyButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.TemplateButton.QuickReplyButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 2: + message.id = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuickReplyButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.TemplateButton.QuickReplyButton} QuickReplyButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplyButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuickReplyButton message. + * @function verify + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuickReplyButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.displayText); + if (error) + return "displayText." + error; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + return null; + }; + + /** + * Creates a QuickReplyButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {Object.} object Plain object + * @returns {proto.TemplateButton.QuickReplyButton} QuickReplyButton + */ + QuickReplyButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.TemplateButton.QuickReplyButton) + return object; + var message = new $root.proto.TemplateButton.QuickReplyButton(); + if (object.displayText != null) { + if (typeof object.displayText !== "object") + throw TypeError(".proto.TemplateButton.QuickReplyButton.displayText: object expected"); + message.displayText = $root.proto.Message.HighlyStructuredMessage.fromObject(object.displayText); + } + if (object.id != null) + message.id = String(object.id); + return message; + }; + + /** + * Creates a plain object from a QuickReplyButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.TemplateButton.QuickReplyButton + * @static + * @param {proto.TemplateButton.QuickReplyButton} message QuickReplyButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuickReplyButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayText = null; + object.id = ""; + } + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = $root.proto.Message.HighlyStructuredMessage.toObject(message.displayText, options); + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + return object; + }; + + /** + * Converts this QuickReplyButton to JSON. + * @function toJSON + * @memberof proto.TemplateButton.QuickReplyButton + * @instance + * @returns {Object.} JSON object + */ + QuickReplyButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return QuickReplyButton; + })(); + + TemplateButton.URLButton = (function() { + + /** + * Properties of a URLButton. + * @memberof proto.TemplateButton + * @interface IURLButton + * @property {proto.Message.IHighlyStructuredMessage|null} [displayText] URLButton displayText + * @property {proto.Message.IHighlyStructuredMessage|null} [url] URLButton url + */ + + /** + * Constructs a new URLButton. + * @memberof proto.TemplateButton + * @classdesc Represents a URLButton. + * @implements IURLButton + * @constructor + * @param {proto.TemplateButton.IURLButton=} [properties] Properties to set + */ + function URLButton(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * URLButton displayText. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} displayText + * @memberof proto.TemplateButton.URLButton + * @instance + */ + URLButton.prototype.displayText = null; + + /** + * URLButton url. + * @member {proto.Message.IHighlyStructuredMessage|null|undefined} url + * @memberof proto.TemplateButton.URLButton + * @instance + */ + URLButton.prototype.url = null; + + /** + * Creates a new URLButton instance using the specified properties. + * @function create + * @memberof proto.TemplateButton.URLButton + * @static + * @param {proto.TemplateButton.IURLButton=} [properties] Properties to set + * @returns {proto.TemplateButton.URLButton} URLButton instance + */ + URLButton.create = function create(properties) { + return new URLButton(properties); + }; + + /** + * Encodes the specified URLButton message. Does not implicitly {@link proto.TemplateButton.URLButton.verify|verify} messages. + * @function encode + * @memberof proto.TemplateButton.URLButton + * @static + * @param {proto.TemplateButton.IURLButton} message URLButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + URLButton.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + $root.proto.Message.HighlyStructuredMessage.encode(message.displayText, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.url != null && Object.hasOwnProperty.call(message, "url")) + $root.proto.Message.HighlyStructuredMessage.encode(message.url, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified URLButton message, length delimited. Does not implicitly {@link proto.TemplateButton.URLButton.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.TemplateButton.URLButton + * @static + * @param {proto.TemplateButton.IURLButton} message URLButton message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + URLButton.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a URLButton message from the specified reader or buffer. + * @function decode + * @memberof proto.TemplateButton.URLButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.TemplateButton.URLButton} URLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + URLButton.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.TemplateButton.URLButton(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.displayText = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + case 2: + message.url = $root.proto.Message.HighlyStructuredMessage.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a URLButton message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.TemplateButton.URLButton + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.TemplateButton.URLButton} URLButton + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + URLButton.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a URLButton message. + * @function verify + * @memberof proto.TemplateButton.URLButton + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + URLButton.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.displayText); + if (error) + return "displayText." + error; + } + if (message.url != null && message.hasOwnProperty("url")) { + var error = $root.proto.Message.HighlyStructuredMessage.verify(message.url); + if (error) + return "url." + error; + } + return null; + }; + + /** + * Creates a URLButton message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.TemplateButton.URLButton + * @static + * @param {Object.} object Plain object + * @returns {proto.TemplateButton.URLButton} URLButton + */ + URLButton.fromObject = function fromObject(object) { + if (object instanceof $root.proto.TemplateButton.URLButton) + return object; + var message = new $root.proto.TemplateButton.URLButton(); + if (object.displayText != null) { + if (typeof object.displayText !== "object") + throw TypeError(".proto.TemplateButton.URLButton.displayText: object expected"); + message.displayText = $root.proto.Message.HighlyStructuredMessage.fromObject(object.displayText); + } + if (object.url != null) { + if (typeof object.url !== "object") + throw TypeError(".proto.TemplateButton.URLButton.url: object expected"); + message.url = $root.proto.Message.HighlyStructuredMessage.fromObject(object.url); + } + return message; + }; + + /** + * Creates a plain object from a URLButton message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.TemplateButton.URLButton + * @static + * @param {proto.TemplateButton.URLButton} message URLButton + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + URLButton.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayText = null; + object.url = null; + } + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = $root.proto.Message.HighlyStructuredMessage.toObject(message.displayText, options); + if (message.url != null && message.hasOwnProperty("url")) + object.url = $root.proto.Message.HighlyStructuredMessage.toObject(message.url, options); + return object; + }; + + /** + * Converts this URLButton to JSON. + * @function toJSON + * @memberof proto.TemplateButton.URLButton + * @instance + * @returns {Object.} JSON object + */ + URLButton.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return URLButton; + })(); + + return TemplateButton; + })(); + + proto.UserReceipt = (function() { + + /** + * Properties of a UserReceipt. + * @memberof proto + * @interface IUserReceipt + * @property {string} userJid UserReceipt userJid + * @property {number|Long|null} [receiptTimestamp] UserReceipt receiptTimestamp + * @property {number|Long|null} [readTimestamp] UserReceipt readTimestamp + * @property {number|Long|null} [playedTimestamp] UserReceipt playedTimestamp + * @property {Array.|null} [pendingDeviceJid] UserReceipt pendingDeviceJid + * @property {Array.|null} [deliveredDeviceJid] UserReceipt deliveredDeviceJid + */ + + /** + * Constructs a new UserReceipt. + * @memberof proto + * @classdesc Represents a UserReceipt. + * @implements IUserReceipt + * @constructor + * @param {proto.IUserReceipt=} [properties] Properties to set + */ + function UserReceipt(properties) { + this.pendingDeviceJid = []; + this.deliveredDeviceJid = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserReceipt userJid. + * @member {string} userJid + * @memberof proto.UserReceipt + * @instance + */ + UserReceipt.prototype.userJid = ""; + + /** + * UserReceipt receiptTimestamp. + * @member {number|Long} receiptTimestamp + * @memberof proto.UserReceipt + * @instance + */ + UserReceipt.prototype.receiptTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserReceipt readTimestamp. + * @member {number|Long} readTimestamp + * @memberof proto.UserReceipt + * @instance + */ + UserReceipt.prototype.readTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserReceipt playedTimestamp. + * @member {number|Long} playedTimestamp + * @memberof proto.UserReceipt + * @instance + */ + UserReceipt.prototype.playedTimestamp = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UserReceipt pendingDeviceJid. + * @member {Array.} pendingDeviceJid + * @memberof proto.UserReceipt + * @instance + */ + UserReceipt.prototype.pendingDeviceJid = $util.emptyArray; + + /** + * UserReceipt deliveredDeviceJid. + * @member {Array.} deliveredDeviceJid + * @memberof proto.UserReceipt + * @instance + */ + UserReceipt.prototype.deliveredDeviceJid = $util.emptyArray; + + /** + * Creates a new UserReceipt instance using the specified properties. + * @function create + * @memberof proto.UserReceipt + * @static + * @param {proto.IUserReceipt=} [properties] Properties to set + * @returns {proto.UserReceipt} UserReceipt instance + */ + UserReceipt.create = function create(properties) { + return new UserReceipt(properties); + }; + + /** + * Encodes the specified UserReceipt message. Does not implicitly {@link proto.UserReceipt.verify|verify} messages. + * @function encode + * @memberof proto.UserReceipt + * @static + * @param {proto.IUserReceipt} message UserReceipt message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserReceipt.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.userJid); + if (message.receiptTimestamp != null && Object.hasOwnProperty.call(message, "receiptTimestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.receiptTimestamp); + if (message.readTimestamp != null && Object.hasOwnProperty.call(message, "readTimestamp")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.readTimestamp); + if (message.playedTimestamp != null && Object.hasOwnProperty.call(message, "playedTimestamp")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.playedTimestamp); + if (message.pendingDeviceJid != null && message.pendingDeviceJid.length) + for (var i = 0; i < message.pendingDeviceJid.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pendingDeviceJid[i]); + if (message.deliveredDeviceJid != null && message.deliveredDeviceJid.length) + for (var i = 0; i < message.deliveredDeviceJid.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.deliveredDeviceJid[i]); + return writer; + }; + + /** + * Encodes the specified UserReceipt message, length delimited. Does not implicitly {@link proto.UserReceipt.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.UserReceipt + * @static + * @param {proto.IUserReceipt} message UserReceipt message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserReceipt.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserReceipt message from the specified reader or buffer. + * @function decode + * @memberof proto.UserReceipt + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.UserReceipt} UserReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserReceipt.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.UserReceipt(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.userJid = reader.string(); + break; + case 2: + message.receiptTimestamp = reader.int64(); + break; + case 3: + message.readTimestamp = reader.int64(); + break; + case 4: + message.playedTimestamp = reader.int64(); + break; + case 5: + if (!(message.pendingDeviceJid && message.pendingDeviceJid.length)) + message.pendingDeviceJid = []; + message.pendingDeviceJid.push(reader.string()); + break; + case 6: + if (!(message.deliveredDeviceJid && message.deliveredDeviceJid.length)) + message.deliveredDeviceJid = []; + message.deliveredDeviceJid.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("userJid")) + throw $util.ProtocolError("missing required 'userJid'", { instance: message }); + return message; + }; + + /** + * Decodes a UserReceipt message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.UserReceipt + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.UserReceipt} UserReceipt + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserReceipt.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserReceipt message. + * @function verify + * @memberof proto.UserReceipt + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserReceipt.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.userJid)) + return "userJid: string expected"; + if (message.receiptTimestamp != null && message.hasOwnProperty("receiptTimestamp")) + if (!$util.isInteger(message.receiptTimestamp) && !(message.receiptTimestamp && $util.isInteger(message.receiptTimestamp.low) && $util.isInteger(message.receiptTimestamp.high))) + return "receiptTimestamp: integer|Long expected"; + if (message.readTimestamp != null && message.hasOwnProperty("readTimestamp")) + if (!$util.isInteger(message.readTimestamp) && !(message.readTimestamp && $util.isInteger(message.readTimestamp.low) && $util.isInteger(message.readTimestamp.high))) + return "readTimestamp: integer|Long expected"; + if (message.playedTimestamp != null && message.hasOwnProperty("playedTimestamp")) + if (!$util.isInteger(message.playedTimestamp) && !(message.playedTimestamp && $util.isInteger(message.playedTimestamp.low) && $util.isInteger(message.playedTimestamp.high))) + return "playedTimestamp: integer|Long expected"; + if (message.pendingDeviceJid != null && message.hasOwnProperty("pendingDeviceJid")) { + if (!Array.isArray(message.pendingDeviceJid)) + return "pendingDeviceJid: array expected"; + for (var i = 0; i < message.pendingDeviceJid.length; ++i) + if (!$util.isString(message.pendingDeviceJid[i])) + return "pendingDeviceJid: string[] expected"; + } + if (message.deliveredDeviceJid != null && message.hasOwnProperty("deliveredDeviceJid")) { + if (!Array.isArray(message.deliveredDeviceJid)) + return "deliveredDeviceJid: array expected"; + for (var i = 0; i < message.deliveredDeviceJid.length; ++i) + if (!$util.isString(message.deliveredDeviceJid[i])) + return "deliveredDeviceJid: string[] expected"; + } + return null; + }; + + /** + * Creates a UserReceipt message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.UserReceipt + * @static + * @param {Object.} object Plain object + * @returns {proto.UserReceipt} UserReceipt + */ + UserReceipt.fromObject = function fromObject(object) { + if (object instanceof $root.proto.UserReceipt) + return object; + var message = new $root.proto.UserReceipt(); + if (object.userJid != null) + message.userJid = String(object.userJid); + if (object.receiptTimestamp != null) + if ($util.Long) + (message.receiptTimestamp = $util.Long.fromValue(object.receiptTimestamp)).unsigned = false; + else if (typeof object.receiptTimestamp === "string") + message.receiptTimestamp = parseInt(object.receiptTimestamp, 10); + else if (typeof object.receiptTimestamp === "number") + message.receiptTimestamp = object.receiptTimestamp; + else if (typeof object.receiptTimestamp === "object") + message.receiptTimestamp = new $util.LongBits(object.receiptTimestamp.low >>> 0, object.receiptTimestamp.high >>> 0).toNumber(); + if (object.readTimestamp != null) + if ($util.Long) + (message.readTimestamp = $util.Long.fromValue(object.readTimestamp)).unsigned = false; + else if (typeof object.readTimestamp === "string") + message.readTimestamp = parseInt(object.readTimestamp, 10); + else if (typeof object.readTimestamp === "number") + message.readTimestamp = object.readTimestamp; + else if (typeof object.readTimestamp === "object") + message.readTimestamp = new $util.LongBits(object.readTimestamp.low >>> 0, object.readTimestamp.high >>> 0).toNumber(); + if (object.playedTimestamp != null) + if ($util.Long) + (message.playedTimestamp = $util.Long.fromValue(object.playedTimestamp)).unsigned = false; + else if (typeof object.playedTimestamp === "string") + message.playedTimestamp = parseInt(object.playedTimestamp, 10); + else if (typeof object.playedTimestamp === "number") + message.playedTimestamp = object.playedTimestamp; + else if (typeof object.playedTimestamp === "object") + message.playedTimestamp = new $util.LongBits(object.playedTimestamp.low >>> 0, object.playedTimestamp.high >>> 0).toNumber(); + if (object.pendingDeviceJid) { + if (!Array.isArray(object.pendingDeviceJid)) + throw TypeError(".proto.UserReceipt.pendingDeviceJid: array expected"); + message.pendingDeviceJid = []; + for (var i = 0; i < object.pendingDeviceJid.length; ++i) + message.pendingDeviceJid[i] = String(object.pendingDeviceJid[i]); + } + if (object.deliveredDeviceJid) { + if (!Array.isArray(object.deliveredDeviceJid)) + throw TypeError(".proto.UserReceipt.deliveredDeviceJid: array expected"); + message.deliveredDeviceJid = []; + for (var i = 0; i < object.deliveredDeviceJid.length; ++i) + message.deliveredDeviceJid[i] = String(object.deliveredDeviceJid[i]); + } + return message; + }; + + /** + * Creates a plain object from a UserReceipt message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.UserReceipt + * @static + * @param {proto.UserReceipt} message UserReceipt + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserReceipt.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pendingDeviceJid = []; + object.deliveredDeviceJid = []; + } + if (options.defaults) { + object.userJid = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.receiptTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.receiptTimestamp = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.readTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.readTimestamp = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.playedTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.playedTimestamp = options.longs === String ? "0" : 0; + } + if (message.userJid != null && message.hasOwnProperty("userJid")) + object.userJid = message.userJid; + if (message.receiptTimestamp != null && message.hasOwnProperty("receiptTimestamp")) + if (typeof message.receiptTimestamp === "number") + object.receiptTimestamp = options.longs === String ? String(message.receiptTimestamp) : message.receiptTimestamp; + else + object.receiptTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.receiptTimestamp) : options.longs === Number ? new $util.LongBits(message.receiptTimestamp.low >>> 0, message.receiptTimestamp.high >>> 0).toNumber() : message.receiptTimestamp; + if (message.readTimestamp != null && message.hasOwnProperty("readTimestamp")) + if (typeof message.readTimestamp === "number") + object.readTimestamp = options.longs === String ? String(message.readTimestamp) : message.readTimestamp; + else + object.readTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.readTimestamp) : options.longs === Number ? new $util.LongBits(message.readTimestamp.low >>> 0, message.readTimestamp.high >>> 0).toNumber() : message.readTimestamp; + if (message.playedTimestamp != null && message.hasOwnProperty("playedTimestamp")) + if (typeof message.playedTimestamp === "number") + object.playedTimestamp = options.longs === String ? String(message.playedTimestamp) : message.playedTimestamp; + else + object.playedTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.playedTimestamp) : options.longs === Number ? new $util.LongBits(message.playedTimestamp.low >>> 0, message.playedTimestamp.high >>> 0).toNumber() : message.playedTimestamp; + if (message.pendingDeviceJid && message.pendingDeviceJid.length) { + object.pendingDeviceJid = []; + for (var j = 0; j < message.pendingDeviceJid.length; ++j) + object.pendingDeviceJid[j] = message.pendingDeviceJid[j]; + } + if (message.deliveredDeviceJid && message.deliveredDeviceJid.length) { + object.deliveredDeviceJid = []; + for (var j = 0; j < message.deliveredDeviceJid.length; ++j) + object.deliveredDeviceJid[j] = message.deliveredDeviceJid[j]; + } + return object; + }; + + /** + * Converts this UserReceipt to JSON. + * @function toJSON + * @memberof proto.UserReceipt + * @instance + * @returns {Object.} JSON object + */ + UserReceipt.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UserReceipt; + })(); + + proto.VerifiedNameCertificate = (function() { + + /** + * Properties of a VerifiedNameCertificate. + * @memberof proto + * @interface IVerifiedNameCertificate + * @property {Uint8Array|null} [details] VerifiedNameCertificate details + * @property {Uint8Array|null} [signature] VerifiedNameCertificate signature + * @property {Uint8Array|null} [serverSignature] VerifiedNameCertificate serverSignature + */ + + /** + * Constructs a new VerifiedNameCertificate. + * @memberof proto + * @classdesc Represents a VerifiedNameCertificate. + * @implements IVerifiedNameCertificate + * @constructor + * @param {proto.IVerifiedNameCertificate=} [properties] Properties to set + */ + function VerifiedNameCertificate(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VerifiedNameCertificate details. + * @member {Uint8Array} details + * @memberof proto.VerifiedNameCertificate + * @instance + */ + VerifiedNameCertificate.prototype.details = $util.newBuffer([]); + + /** + * VerifiedNameCertificate signature. + * @member {Uint8Array} signature + * @memberof proto.VerifiedNameCertificate + * @instance + */ + VerifiedNameCertificate.prototype.signature = $util.newBuffer([]); + + /** + * VerifiedNameCertificate serverSignature. + * @member {Uint8Array} serverSignature + * @memberof proto.VerifiedNameCertificate + * @instance + */ + VerifiedNameCertificate.prototype.serverSignature = $util.newBuffer([]); + + /** + * Creates a new VerifiedNameCertificate instance using the specified properties. + * @function create + * @memberof proto.VerifiedNameCertificate + * @static + * @param {proto.IVerifiedNameCertificate=} [properties] Properties to set + * @returns {proto.VerifiedNameCertificate} VerifiedNameCertificate instance + */ + VerifiedNameCertificate.create = function create(properties) { + return new VerifiedNameCertificate(properties); + }; + + /** + * Encodes the specified VerifiedNameCertificate message. Does not implicitly {@link proto.VerifiedNameCertificate.verify|verify} messages. + * @function encode + * @memberof proto.VerifiedNameCertificate + * @static + * @param {proto.IVerifiedNameCertificate} message VerifiedNameCertificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifiedNameCertificate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.details); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature); + if (message.serverSignature != null && Object.hasOwnProperty.call(message, "serverSignature")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.serverSignature); + return writer; + }; + + /** + * Encodes the specified VerifiedNameCertificate message, length delimited. Does not implicitly {@link proto.VerifiedNameCertificate.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.VerifiedNameCertificate + * @static + * @param {proto.IVerifiedNameCertificate} message VerifiedNameCertificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifiedNameCertificate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VerifiedNameCertificate message from the specified reader or buffer. + * @function decode + * @memberof proto.VerifiedNameCertificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.VerifiedNameCertificate} VerifiedNameCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifiedNameCertificate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.VerifiedNameCertificate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.details = reader.bytes(); + break; + case 2: + message.signature = reader.bytes(); + break; + case 3: + message.serverSignature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VerifiedNameCertificate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.VerifiedNameCertificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.VerifiedNameCertificate} VerifiedNameCertificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifiedNameCertificate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VerifiedNameCertificate message. + * @function verify + * @memberof proto.VerifiedNameCertificate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VerifiedNameCertificate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!(message.details && typeof message.details.length === "number" || $util.isString(message.details))) + return "details: buffer expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + if (message.serverSignature != null && message.hasOwnProperty("serverSignature")) + if (!(message.serverSignature && typeof message.serverSignature.length === "number" || $util.isString(message.serverSignature))) + return "serverSignature: buffer expected"; + return null; + }; + + /** + * Creates a VerifiedNameCertificate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.VerifiedNameCertificate + * @static + * @param {Object.} object Plain object + * @returns {proto.VerifiedNameCertificate} VerifiedNameCertificate + */ + VerifiedNameCertificate.fromObject = function fromObject(object) { + if (object instanceof $root.proto.VerifiedNameCertificate) + return object; + var message = new $root.proto.VerifiedNameCertificate(); + if (object.details != null) + if (typeof object.details === "string") + $util.base64.decode(object.details, message.details = $util.newBuffer($util.base64.length(object.details)), 0); + else if (object.details.length) + message.details = object.details; + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length) + message.signature = object.signature; + if (object.serverSignature != null) + if (typeof object.serverSignature === "string") + $util.base64.decode(object.serverSignature, message.serverSignature = $util.newBuffer($util.base64.length(object.serverSignature)), 0); + else if (object.serverSignature.length) + message.serverSignature = object.serverSignature; + return message; + }; + + /** + * Creates a plain object from a VerifiedNameCertificate message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.VerifiedNameCertificate + * @static + * @param {proto.VerifiedNameCertificate} message VerifiedNameCertificate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VerifiedNameCertificate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.details = ""; + else { + object.details = []; + if (options.bytes !== Array) + object.details = $util.newBuffer(object.details); + } + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + if (options.bytes === String) + object.serverSignature = ""; + else { + object.serverSignature = []; + if (options.bytes !== Array) + object.serverSignature = $util.newBuffer(object.serverSignature); + } + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = options.bytes === String ? $util.base64.encode(message.details, 0, message.details.length) : options.bytes === Array ? Array.prototype.slice.call(message.details) : message.details; + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + if (message.serverSignature != null && message.hasOwnProperty("serverSignature")) + object.serverSignature = options.bytes === String ? $util.base64.encode(message.serverSignature, 0, message.serverSignature.length) : options.bytes === Array ? Array.prototype.slice.call(message.serverSignature) : message.serverSignature; + return object; + }; + + /** + * Converts this VerifiedNameCertificate to JSON. + * @function toJSON + * @memberof proto.VerifiedNameCertificate + * @instance + * @returns {Object.} JSON object + */ + VerifiedNameCertificate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + VerifiedNameCertificate.Details = (function() { + + /** + * Properties of a Details. + * @memberof proto.VerifiedNameCertificate + * @interface IDetails + * @property {number|Long|null} [serial] Details serial + * @property {string|null} [issuer] Details issuer + * @property {string|null} [verifiedName] Details verifiedName + * @property {Array.|null} [localizedNames] Details localizedNames + * @property {number|Long|null} [issueTime] Details issueTime + */ + + /** + * Constructs a new Details. + * @memberof proto.VerifiedNameCertificate + * @classdesc Represents a Details. + * @implements IDetails + * @constructor + * @param {proto.VerifiedNameCertificate.IDetails=} [properties] Properties to set + */ + function Details(properties) { + this.localizedNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Details serial. + * @member {number|Long} serial + * @memberof proto.VerifiedNameCertificate.Details + * @instance + */ + Details.prototype.serial = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Details issuer. + * @member {string} issuer + * @memberof proto.VerifiedNameCertificate.Details + * @instance + */ + Details.prototype.issuer = ""; + + /** + * Details verifiedName. + * @member {string} verifiedName + * @memberof proto.VerifiedNameCertificate.Details + * @instance + */ + Details.prototype.verifiedName = ""; + + /** + * Details localizedNames. + * @member {Array.} localizedNames + * @memberof proto.VerifiedNameCertificate.Details + * @instance + */ + Details.prototype.localizedNames = $util.emptyArray; + + /** + * Details issueTime. + * @member {number|Long} issueTime + * @memberof proto.VerifiedNameCertificate.Details + * @instance + */ + Details.prototype.issueTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new Details instance using the specified properties. + * @function create + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {proto.VerifiedNameCertificate.IDetails=} [properties] Properties to set + * @returns {proto.VerifiedNameCertificate.Details} Details instance + */ + Details.create = function create(properties) { + return new Details(properties); + }; + + /** + * Encodes the specified Details message. Does not implicitly {@link proto.VerifiedNameCertificate.Details.verify|verify} messages. + * @function encode + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {proto.VerifiedNameCertificate.IDetails} message Details message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Details.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serial != null && Object.hasOwnProperty.call(message, "serial")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.serial); + if (message.issuer != null && Object.hasOwnProperty.call(message, "issuer")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.issuer); + if (message.verifiedName != null && Object.hasOwnProperty.call(message, "verifiedName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verifiedName); + if (message.localizedNames != null && message.localizedNames.length) + for (var i = 0; i < message.localizedNames.length; ++i) + $root.proto.LocalizedName.encode(message.localizedNames[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.issueTime != null && Object.hasOwnProperty.call(message, "issueTime")) + writer.uint32(/* id 10, wireType 0 =*/80).uint64(message.issueTime); + return writer; + }; + + /** + * Encodes the specified Details message, length delimited. Does not implicitly {@link proto.VerifiedNameCertificate.Details.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {proto.VerifiedNameCertificate.IDetails} message Details message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Details.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Details message from the specified reader or buffer. + * @function decode + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.VerifiedNameCertificate.Details} Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Details.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.VerifiedNameCertificate.Details(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.serial = reader.uint64(); + break; + case 2: + message.issuer = reader.string(); + break; + case 4: + message.verifiedName = reader.string(); + break; + case 8: + if (!(message.localizedNames && message.localizedNames.length)) + message.localizedNames = []; + message.localizedNames.push($root.proto.LocalizedName.decode(reader, reader.uint32())); + break; + case 10: + message.issueTime = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Details message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.VerifiedNameCertificate.Details} Details + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Details.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Details message. + * @function verify + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Details.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serial != null && message.hasOwnProperty("serial")) + if (!$util.isInteger(message.serial) && !(message.serial && $util.isInteger(message.serial.low) && $util.isInteger(message.serial.high))) + return "serial: integer|Long expected"; + if (message.issuer != null && message.hasOwnProperty("issuer")) + if (!$util.isString(message.issuer)) + return "issuer: string expected"; + if (message.verifiedName != null && message.hasOwnProperty("verifiedName")) + if (!$util.isString(message.verifiedName)) + return "verifiedName: string expected"; + if (message.localizedNames != null && message.hasOwnProperty("localizedNames")) { + if (!Array.isArray(message.localizedNames)) + return "localizedNames: array expected"; + for (var i = 0; i < message.localizedNames.length; ++i) { + var error = $root.proto.LocalizedName.verify(message.localizedNames[i]); + if (error) + return "localizedNames." + error; + } + } + if (message.issueTime != null && message.hasOwnProperty("issueTime")) + if (!$util.isInteger(message.issueTime) && !(message.issueTime && $util.isInteger(message.issueTime.low) && $util.isInteger(message.issueTime.high))) + return "issueTime: integer|Long expected"; + return null; + }; + + /** + * Creates a Details message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {Object.} object Plain object + * @returns {proto.VerifiedNameCertificate.Details} Details + */ + Details.fromObject = function fromObject(object) { + if (object instanceof $root.proto.VerifiedNameCertificate.Details) + return object; + var message = new $root.proto.VerifiedNameCertificate.Details(); + if (object.serial != null) + if ($util.Long) + (message.serial = $util.Long.fromValue(object.serial)).unsigned = true; + else if (typeof object.serial === "string") + message.serial = parseInt(object.serial, 10); + else if (typeof object.serial === "number") + message.serial = object.serial; + else if (typeof object.serial === "object") + message.serial = new $util.LongBits(object.serial.low >>> 0, object.serial.high >>> 0).toNumber(true); + if (object.issuer != null) + message.issuer = String(object.issuer); + if (object.verifiedName != null) + message.verifiedName = String(object.verifiedName); + if (object.localizedNames) { + if (!Array.isArray(object.localizedNames)) + throw TypeError(".proto.VerifiedNameCertificate.Details.localizedNames: array expected"); + message.localizedNames = []; + for (var i = 0; i < object.localizedNames.length; ++i) { + if (typeof object.localizedNames[i] !== "object") + throw TypeError(".proto.VerifiedNameCertificate.Details.localizedNames: object expected"); + message.localizedNames[i] = $root.proto.LocalizedName.fromObject(object.localizedNames[i]); + } + } + if (object.issueTime != null) + if ($util.Long) + (message.issueTime = $util.Long.fromValue(object.issueTime)).unsigned = true; + else if (typeof object.issueTime === "string") + message.issueTime = parseInt(object.issueTime, 10); + else if (typeof object.issueTime === "number") + message.issueTime = object.issueTime; + else if (typeof object.issueTime === "object") + message.issueTime = new $util.LongBits(object.issueTime.low >>> 0, object.issueTime.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a Details message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.VerifiedNameCertificate.Details + * @static + * @param {proto.VerifiedNameCertificate.Details} message Details + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Details.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.localizedNames = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.serial = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.serial = options.longs === String ? "0" : 0; + object.issuer = ""; + object.verifiedName = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.issueTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.issueTime = options.longs === String ? "0" : 0; + } + if (message.serial != null && message.hasOwnProperty("serial")) + if (typeof message.serial === "number") + object.serial = options.longs === String ? String(message.serial) : message.serial; + else + object.serial = options.longs === String ? $util.Long.prototype.toString.call(message.serial) : options.longs === Number ? new $util.LongBits(message.serial.low >>> 0, message.serial.high >>> 0).toNumber(true) : message.serial; + if (message.issuer != null && message.hasOwnProperty("issuer")) + object.issuer = message.issuer; + if (message.verifiedName != null && message.hasOwnProperty("verifiedName")) + object.verifiedName = message.verifiedName; + if (message.localizedNames && message.localizedNames.length) { + object.localizedNames = []; + for (var j = 0; j < message.localizedNames.length; ++j) + object.localizedNames[j] = $root.proto.LocalizedName.toObject(message.localizedNames[j], options); + } + if (message.issueTime != null && message.hasOwnProperty("issueTime")) + if (typeof message.issueTime === "number") + object.issueTime = options.longs === String ? String(message.issueTime) : message.issueTime; + else + object.issueTime = options.longs === String ? $util.Long.prototype.toString.call(message.issueTime) : options.longs === Number ? new $util.LongBits(message.issueTime.low >>> 0, message.issueTime.high >>> 0).toNumber(true) : message.issueTime; + return object; + }; + + /** + * Converts this Details to JSON. + * @function toJSON + * @memberof proto.VerifiedNameCertificate.Details + * @instance + * @returns {Object.} JSON object + */ + Details.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Details; + })(); + + return VerifiedNameCertificate; + })(); + + proto.WallpaperSettings = (function() { + + /** + * Properties of a WallpaperSettings. + * @memberof proto + * @interface IWallpaperSettings + * @property {string|null} [filename] WallpaperSettings filename + * @property {number|null} [opacity] WallpaperSettings opacity + */ + + /** + * Constructs a new WallpaperSettings. + * @memberof proto + * @classdesc Represents a WallpaperSettings. + * @implements IWallpaperSettings + * @constructor + * @param {proto.IWallpaperSettings=} [properties] Properties to set + */ + function WallpaperSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WallpaperSettings filename. + * @member {string} filename + * @memberof proto.WallpaperSettings + * @instance + */ + WallpaperSettings.prototype.filename = ""; + + /** + * WallpaperSettings opacity. + * @member {number} opacity + * @memberof proto.WallpaperSettings + * @instance + */ + WallpaperSettings.prototype.opacity = 0; + + /** + * Creates a new WallpaperSettings instance using the specified properties. + * @function create + * @memberof proto.WallpaperSettings + * @static + * @param {proto.IWallpaperSettings=} [properties] Properties to set + * @returns {proto.WallpaperSettings} WallpaperSettings instance + */ + WallpaperSettings.create = function create(properties) { + return new WallpaperSettings(properties); + }; + + /** + * Encodes the specified WallpaperSettings message. Does not implicitly {@link proto.WallpaperSettings.verify|verify} messages. + * @function encode + * @memberof proto.WallpaperSettings + * @static + * @param {proto.IWallpaperSettings} message WallpaperSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WallpaperSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filename != null && Object.hasOwnProperty.call(message, "filename")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filename); + if (message.opacity != null && Object.hasOwnProperty.call(message, "opacity")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.opacity); + return writer; + }; + + /** + * Encodes the specified WallpaperSettings message, length delimited. Does not implicitly {@link proto.WallpaperSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.WallpaperSettings + * @static + * @param {proto.IWallpaperSettings} message WallpaperSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WallpaperSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WallpaperSettings message from the specified reader or buffer. + * @function decode + * @memberof proto.WallpaperSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.WallpaperSettings} WallpaperSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WallpaperSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.WallpaperSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.filename = reader.string(); + break; + case 2: + message.opacity = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WallpaperSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.WallpaperSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.WallpaperSettings} WallpaperSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WallpaperSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WallpaperSettings message. + * @function verify + * @memberof proto.WallpaperSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WallpaperSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filename != null && message.hasOwnProperty("filename")) + if (!$util.isString(message.filename)) + return "filename: string expected"; + if (message.opacity != null && message.hasOwnProperty("opacity")) + if (!$util.isInteger(message.opacity)) + return "opacity: integer expected"; + return null; + }; + + /** + * Creates a WallpaperSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.WallpaperSettings + * @static + * @param {Object.} object Plain object + * @returns {proto.WallpaperSettings} WallpaperSettings + */ + WallpaperSettings.fromObject = function fromObject(object) { + if (object instanceof $root.proto.WallpaperSettings) + return object; + var message = new $root.proto.WallpaperSettings(); + if (object.filename != null) + message.filename = String(object.filename); + if (object.opacity != null) + message.opacity = object.opacity >>> 0; + return message; + }; + + /** + * Creates a plain object from a WallpaperSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.WallpaperSettings + * @static + * @param {proto.WallpaperSettings} message WallpaperSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WallpaperSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filename = ""; + object.opacity = 0; + } + if (message.filename != null && message.hasOwnProperty("filename")) + object.filename = message.filename; + if (message.opacity != null && message.hasOwnProperty("opacity")) + object.opacity = message.opacity; + return object; + }; + + /** + * Converts this WallpaperSettings to JSON. + * @function toJSON + * @memberof proto.WallpaperSettings + * @instance + * @returns {Object.} JSON object + */ + WallpaperSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WallpaperSettings; + })(); + + proto.WebFeatures = (function() { + + /** + * Properties of a WebFeatures. + * @memberof proto + * @interface IWebFeatures + * @property {proto.WebFeatures.Flag|null} [labelsDisplay] WebFeatures labelsDisplay + * @property {proto.WebFeatures.Flag|null} [voipIndividualOutgoing] WebFeatures voipIndividualOutgoing + * @property {proto.WebFeatures.Flag|null} [groupsV3] WebFeatures groupsV3 + * @property {proto.WebFeatures.Flag|null} [groupsV3Create] WebFeatures groupsV3Create + * @property {proto.WebFeatures.Flag|null} [changeNumberV2] WebFeatures changeNumberV2 + * @property {proto.WebFeatures.Flag|null} [queryStatusV3Thumbnail] WebFeatures queryStatusV3Thumbnail + * @property {proto.WebFeatures.Flag|null} [liveLocations] WebFeatures liveLocations + * @property {proto.WebFeatures.Flag|null} [queryVname] WebFeatures queryVname + * @property {proto.WebFeatures.Flag|null} [voipIndividualIncoming] WebFeatures voipIndividualIncoming + * @property {proto.WebFeatures.Flag|null} [quickRepliesQuery] WebFeatures quickRepliesQuery + * @property {proto.WebFeatures.Flag|null} [payments] WebFeatures payments + * @property {proto.WebFeatures.Flag|null} [stickerPackQuery] WebFeatures stickerPackQuery + * @property {proto.WebFeatures.Flag|null} [liveLocationsFinal] WebFeatures liveLocationsFinal + * @property {proto.WebFeatures.Flag|null} [labelsEdit] WebFeatures labelsEdit + * @property {proto.WebFeatures.Flag|null} [mediaUpload] WebFeatures mediaUpload + * @property {proto.WebFeatures.Flag|null} [mediaUploadRichQuickReplies] WebFeatures mediaUploadRichQuickReplies + * @property {proto.WebFeatures.Flag|null} [vnameV2] WebFeatures vnameV2 + * @property {proto.WebFeatures.Flag|null} [videoPlaybackUrl] WebFeatures videoPlaybackUrl + * @property {proto.WebFeatures.Flag|null} [statusRanking] WebFeatures statusRanking + * @property {proto.WebFeatures.Flag|null} [voipIndividualVideo] WebFeatures voipIndividualVideo + * @property {proto.WebFeatures.Flag|null} [thirdPartyStickers] WebFeatures thirdPartyStickers + * @property {proto.WebFeatures.Flag|null} [frequentlyForwardedSetting] WebFeatures frequentlyForwardedSetting + * @property {proto.WebFeatures.Flag|null} [groupsV4JoinPermission] WebFeatures groupsV4JoinPermission + * @property {proto.WebFeatures.Flag|null} [recentStickers] WebFeatures recentStickers + * @property {proto.WebFeatures.Flag|null} [catalog] WebFeatures catalog + * @property {proto.WebFeatures.Flag|null} [starredStickers] WebFeatures starredStickers + * @property {proto.WebFeatures.Flag|null} [voipGroupCall] WebFeatures voipGroupCall + * @property {proto.WebFeatures.Flag|null} [templateMessage] WebFeatures templateMessage + * @property {proto.WebFeatures.Flag|null} [templateMessageInteractivity] WebFeatures templateMessageInteractivity + * @property {proto.WebFeatures.Flag|null} [ephemeralMessages] WebFeatures ephemeralMessages + * @property {proto.WebFeatures.Flag|null} [e2ENotificationSync] WebFeatures e2ENotificationSync + * @property {proto.WebFeatures.Flag|null} [recentStickersV2] WebFeatures recentStickersV2 + * @property {proto.WebFeatures.Flag|null} [recentStickersV3] WebFeatures recentStickersV3 + * @property {proto.WebFeatures.Flag|null} [userNotice] WebFeatures userNotice + * @property {proto.WebFeatures.Flag|null} [support] WebFeatures support + * @property {proto.WebFeatures.Flag|null} [groupUiiCleanup] WebFeatures groupUiiCleanup + * @property {proto.WebFeatures.Flag|null} [groupDogfoodingInternalOnly] WebFeatures groupDogfoodingInternalOnly + * @property {proto.WebFeatures.Flag|null} [settingsSync] WebFeatures settingsSync + * @property {proto.WebFeatures.Flag|null} [archiveV2] WebFeatures archiveV2 + * @property {proto.WebFeatures.Flag|null} [ephemeralAllowGroupMembers] WebFeatures ephemeralAllowGroupMembers + * @property {proto.WebFeatures.Flag|null} [ephemeral24HDuration] WebFeatures ephemeral24HDuration + * @property {proto.WebFeatures.Flag|null} [mdForceUpgrade] WebFeatures mdForceUpgrade + * @property {proto.WebFeatures.Flag|null} [disappearingMode] WebFeatures disappearingMode + * @property {proto.WebFeatures.Flag|null} [externalMdOptInAvailable] WebFeatures externalMdOptInAvailable + * @property {proto.WebFeatures.Flag|null} [noDeleteMessageTimeLimit] WebFeatures noDeleteMessageTimeLimit + */ + + /** + * Constructs a new WebFeatures. + * @memberof proto + * @classdesc Represents a WebFeatures. + * @implements IWebFeatures + * @constructor + * @param {proto.IWebFeatures=} [properties] Properties to set + */ + function WebFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebFeatures labelsDisplay. + * @member {proto.WebFeatures.Flag} labelsDisplay + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.labelsDisplay = 0; + + /** + * WebFeatures voipIndividualOutgoing. + * @member {proto.WebFeatures.Flag} voipIndividualOutgoing + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.voipIndividualOutgoing = 0; + + /** + * WebFeatures groupsV3. + * @member {proto.WebFeatures.Flag} groupsV3 + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.groupsV3 = 0; + + /** + * WebFeatures groupsV3Create. + * @member {proto.WebFeatures.Flag} groupsV3Create + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.groupsV3Create = 0; + + /** + * WebFeatures changeNumberV2. + * @member {proto.WebFeatures.Flag} changeNumberV2 + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.changeNumberV2 = 0; + + /** + * WebFeatures queryStatusV3Thumbnail. + * @member {proto.WebFeatures.Flag} queryStatusV3Thumbnail + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.queryStatusV3Thumbnail = 0; + + /** + * WebFeatures liveLocations. + * @member {proto.WebFeatures.Flag} liveLocations + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.liveLocations = 0; + + /** + * WebFeatures queryVname. + * @member {proto.WebFeatures.Flag} queryVname + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.queryVname = 0; + + /** + * WebFeatures voipIndividualIncoming. + * @member {proto.WebFeatures.Flag} voipIndividualIncoming + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.voipIndividualIncoming = 0; + + /** + * WebFeatures quickRepliesQuery. + * @member {proto.WebFeatures.Flag} quickRepliesQuery + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.quickRepliesQuery = 0; + + /** + * WebFeatures payments. + * @member {proto.WebFeatures.Flag} payments + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.payments = 0; + + /** + * WebFeatures stickerPackQuery. + * @member {proto.WebFeatures.Flag} stickerPackQuery + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.stickerPackQuery = 0; + + /** + * WebFeatures liveLocationsFinal. + * @member {proto.WebFeatures.Flag} liveLocationsFinal + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.liveLocationsFinal = 0; + + /** + * WebFeatures labelsEdit. + * @member {proto.WebFeatures.Flag} labelsEdit + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.labelsEdit = 0; + + /** + * WebFeatures mediaUpload. + * @member {proto.WebFeatures.Flag} mediaUpload + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.mediaUpload = 0; + + /** + * WebFeatures mediaUploadRichQuickReplies. + * @member {proto.WebFeatures.Flag} mediaUploadRichQuickReplies + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.mediaUploadRichQuickReplies = 0; + + /** + * WebFeatures vnameV2. + * @member {proto.WebFeatures.Flag} vnameV2 + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.vnameV2 = 0; + + /** + * WebFeatures videoPlaybackUrl. + * @member {proto.WebFeatures.Flag} videoPlaybackUrl + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.videoPlaybackUrl = 0; + + /** + * WebFeatures statusRanking. + * @member {proto.WebFeatures.Flag} statusRanking + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.statusRanking = 0; + + /** + * WebFeatures voipIndividualVideo. + * @member {proto.WebFeatures.Flag} voipIndividualVideo + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.voipIndividualVideo = 0; + + /** + * WebFeatures thirdPartyStickers. + * @member {proto.WebFeatures.Flag} thirdPartyStickers + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.thirdPartyStickers = 0; + + /** + * WebFeatures frequentlyForwardedSetting. + * @member {proto.WebFeatures.Flag} frequentlyForwardedSetting + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.frequentlyForwardedSetting = 0; + + /** + * WebFeatures groupsV4JoinPermission. + * @member {proto.WebFeatures.Flag} groupsV4JoinPermission + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.groupsV4JoinPermission = 0; + + /** + * WebFeatures recentStickers. + * @member {proto.WebFeatures.Flag} recentStickers + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.recentStickers = 0; + + /** + * WebFeatures catalog. + * @member {proto.WebFeatures.Flag} catalog + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.catalog = 0; + + /** + * WebFeatures starredStickers. + * @member {proto.WebFeatures.Flag} starredStickers + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.starredStickers = 0; + + /** + * WebFeatures voipGroupCall. + * @member {proto.WebFeatures.Flag} voipGroupCall + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.voipGroupCall = 0; + + /** + * WebFeatures templateMessage. + * @member {proto.WebFeatures.Flag} templateMessage + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.templateMessage = 0; + + /** + * WebFeatures templateMessageInteractivity. + * @member {proto.WebFeatures.Flag} templateMessageInteractivity + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.templateMessageInteractivity = 0; + + /** + * WebFeatures ephemeralMessages. + * @member {proto.WebFeatures.Flag} ephemeralMessages + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.ephemeralMessages = 0; + + /** + * WebFeatures e2ENotificationSync. + * @member {proto.WebFeatures.Flag} e2ENotificationSync + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.e2ENotificationSync = 0; + + /** + * WebFeatures recentStickersV2. + * @member {proto.WebFeatures.Flag} recentStickersV2 + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.recentStickersV2 = 0; + + /** + * WebFeatures recentStickersV3. + * @member {proto.WebFeatures.Flag} recentStickersV3 + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.recentStickersV3 = 0; + + /** + * WebFeatures userNotice. + * @member {proto.WebFeatures.Flag} userNotice + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.userNotice = 0; + + /** + * WebFeatures support. + * @member {proto.WebFeatures.Flag} support + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.support = 0; + + /** + * WebFeatures groupUiiCleanup. + * @member {proto.WebFeatures.Flag} groupUiiCleanup + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.groupUiiCleanup = 0; + + /** + * WebFeatures groupDogfoodingInternalOnly. + * @member {proto.WebFeatures.Flag} groupDogfoodingInternalOnly + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.groupDogfoodingInternalOnly = 0; + + /** + * WebFeatures settingsSync. + * @member {proto.WebFeatures.Flag} settingsSync + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.settingsSync = 0; + + /** + * WebFeatures archiveV2. + * @member {proto.WebFeatures.Flag} archiveV2 + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.archiveV2 = 0; + + /** + * WebFeatures ephemeralAllowGroupMembers. + * @member {proto.WebFeatures.Flag} ephemeralAllowGroupMembers + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.ephemeralAllowGroupMembers = 0; + + /** + * WebFeatures ephemeral24HDuration. + * @member {proto.WebFeatures.Flag} ephemeral24HDuration + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.ephemeral24HDuration = 0; + + /** + * WebFeatures mdForceUpgrade. + * @member {proto.WebFeatures.Flag} mdForceUpgrade + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.mdForceUpgrade = 0; + + /** + * WebFeatures disappearingMode. + * @member {proto.WebFeatures.Flag} disappearingMode + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.disappearingMode = 0; + + /** + * WebFeatures externalMdOptInAvailable. + * @member {proto.WebFeatures.Flag} externalMdOptInAvailable + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.externalMdOptInAvailable = 0; + + /** + * WebFeatures noDeleteMessageTimeLimit. + * @member {proto.WebFeatures.Flag} noDeleteMessageTimeLimit + * @memberof proto.WebFeatures + * @instance + */ + WebFeatures.prototype.noDeleteMessageTimeLimit = 0; + + /** + * Creates a new WebFeatures instance using the specified properties. + * @function create + * @memberof proto.WebFeatures + * @static + * @param {proto.IWebFeatures=} [properties] Properties to set + * @returns {proto.WebFeatures} WebFeatures instance + */ + WebFeatures.create = function create(properties) { + return new WebFeatures(properties); + }; + + /** + * Encodes the specified WebFeatures message. Does not implicitly {@link proto.WebFeatures.verify|verify} messages. + * @function encode + * @memberof proto.WebFeatures + * @static + * @param {proto.IWebFeatures} message WebFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labelsDisplay != null && Object.hasOwnProperty.call(message, "labelsDisplay")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.labelsDisplay); + if (message.voipIndividualOutgoing != null && Object.hasOwnProperty.call(message, "voipIndividualOutgoing")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.voipIndividualOutgoing); + if (message.groupsV3 != null && Object.hasOwnProperty.call(message, "groupsV3")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.groupsV3); + if (message.groupsV3Create != null && Object.hasOwnProperty.call(message, "groupsV3Create")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.groupsV3Create); + if (message.changeNumberV2 != null && Object.hasOwnProperty.call(message, "changeNumberV2")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.changeNumberV2); + if (message.queryStatusV3Thumbnail != null && Object.hasOwnProperty.call(message, "queryStatusV3Thumbnail")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.queryStatusV3Thumbnail); + if (message.liveLocations != null && Object.hasOwnProperty.call(message, "liveLocations")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.liveLocations); + if (message.queryVname != null && Object.hasOwnProperty.call(message, "queryVname")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.queryVname); + if (message.voipIndividualIncoming != null && Object.hasOwnProperty.call(message, "voipIndividualIncoming")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.voipIndividualIncoming); + if (message.quickRepliesQuery != null && Object.hasOwnProperty.call(message, "quickRepliesQuery")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.quickRepliesQuery); + if (message.payments != null && Object.hasOwnProperty.call(message, "payments")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.payments); + if (message.stickerPackQuery != null && Object.hasOwnProperty.call(message, "stickerPackQuery")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.stickerPackQuery); + if (message.liveLocationsFinal != null && Object.hasOwnProperty.call(message, "liveLocationsFinal")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.liveLocationsFinal); + if (message.labelsEdit != null && Object.hasOwnProperty.call(message, "labelsEdit")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.labelsEdit); + if (message.mediaUpload != null && Object.hasOwnProperty.call(message, "mediaUpload")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.mediaUpload); + if (message.mediaUploadRichQuickReplies != null && Object.hasOwnProperty.call(message, "mediaUploadRichQuickReplies")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.mediaUploadRichQuickReplies); + if (message.vnameV2 != null && Object.hasOwnProperty.call(message, "vnameV2")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.vnameV2); + if (message.videoPlaybackUrl != null && Object.hasOwnProperty.call(message, "videoPlaybackUrl")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.videoPlaybackUrl); + if (message.statusRanking != null && Object.hasOwnProperty.call(message, "statusRanking")) + writer.uint32(/* id 21, wireType 0 =*/168).int32(message.statusRanking); + if (message.voipIndividualVideo != null && Object.hasOwnProperty.call(message, "voipIndividualVideo")) + writer.uint32(/* id 22, wireType 0 =*/176).int32(message.voipIndividualVideo); + if (message.thirdPartyStickers != null && Object.hasOwnProperty.call(message, "thirdPartyStickers")) + writer.uint32(/* id 23, wireType 0 =*/184).int32(message.thirdPartyStickers); + if (message.frequentlyForwardedSetting != null && Object.hasOwnProperty.call(message, "frequentlyForwardedSetting")) + writer.uint32(/* id 24, wireType 0 =*/192).int32(message.frequentlyForwardedSetting); + if (message.groupsV4JoinPermission != null && Object.hasOwnProperty.call(message, "groupsV4JoinPermission")) + writer.uint32(/* id 25, wireType 0 =*/200).int32(message.groupsV4JoinPermission); + if (message.recentStickers != null && Object.hasOwnProperty.call(message, "recentStickers")) + writer.uint32(/* id 26, wireType 0 =*/208).int32(message.recentStickers); + if (message.catalog != null && Object.hasOwnProperty.call(message, "catalog")) + writer.uint32(/* id 27, wireType 0 =*/216).int32(message.catalog); + if (message.starredStickers != null && Object.hasOwnProperty.call(message, "starredStickers")) + writer.uint32(/* id 28, wireType 0 =*/224).int32(message.starredStickers); + if (message.voipGroupCall != null && Object.hasOwnProperty.call(message, "voipGroupCall")) + writer.uint32(/* id 29, wireType 0 =*/232).int32(message.voipGroupCall); + if (message.templateMessage != null && Object.hasOwnProperty.call(message, "templateMessage")) + writer.uint32(/* id 30, wireType 0 =*/240).int32(message.templateMessage); + if (message.templateMessageInteractivity != null && Object.hasOwnProperty.call(message, "templateMessageInteractivity")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.templateMessageInteractivity); + if (message.ephemeralMessages != null && Object.hasOwnProperty.call(message, "ephemeralMessages")) + writer.uint32(/* id 32, wireType 0 =*/256).int32(message.ephemeralMessages); + if (message.e2ENotificationSync != null && Object.hasOwnProperty.call(message, "e2ENotificationSync")) + writer.uint32(/* id 33, wireType 0 =*/264).int32(message.e2ENotificationSync); + if (message.recentStickersV2 != null && Object.hasOwnProperty.call(message, "recentStickersV2")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.recentStickersV2); + if (message.recentStickersV3 != null && Object.hasOwnProperty.call(message, "recentStickersV3")) + writer.uint32(/* id 36, wireType 0 =*/288).int32(message.recentStickersV3); + if (message.userNotice != null && Object.hasOwnProperty.call(message, "userNotice")) + writer.uint32(/* id 37, wireType 0 =*/296).int32(message.userNotice); + if (message.support != null && Object.hasOwnProperty.call(message, "support")) + writer.uint32(/* id 39, wireType 0 =*/312).int32(message.support); + if (message.groupUiiCleanup != null && Object.hasOwnProperty.call(message, "groupUiiCleanup")) + writer.uint32(/* id 40, wireType 0 =*/320).int32(message.groupUiiCleanup); + if (message.groupDogfoodingInternalOnly != null && Object.hasOwnProperty.call(message, "groupDogfoodingInternalOnly")) + writer.uint32(/* id 41, wireType 0 =*/328).int32(message.groupDogfoodingInternalOnly); + if (message.settingsSync != null && Object.hasOwnProperty.call(message, "settingsSync")) + writer.uint32(/* id 42, wireType 0 =*/336).int32(message.settingsSync); + if (message.archiveV2 != null && Object.hasOwnProperty.call(message, "archiveV2")) + writer.uint32(/* id 43, wireType 0 =*/344).int32(message.archiveV2); + if (message.ephemeralAllowGroupMembers != null && Object.hasOwnProperty.call(message, "ephemeralAllowGroupMembers")) + writer.uint32(/* id 44, wireType 0 =*/352).int32(message.ephemeralAllowGroupMembers); + if (message.ephemeral24HDuration != null && Object.hasOwnProperty.call(message, "ephemeral24HDuration")) + writer.uint32(/* id 45, wireType 0 =*/360).int32(message.ephemeral24HDuration); + if (message.mdForceUpgrade != null && Object.hasOwnProperty.call(message, "mdForceUpgrade")) + writer.uint32(/* id 46, wireType 0 =*/368).int32(message.mdForceUpgrade); + if (message.disappearingMode != null && Object.hasOwnProperty.call(message, "disappearingMode")) + writer.uint32(/* id 47, wireType 0 =*/376).int32(message.disappearingMode); + if (message.externalMdOptInAvailable != null && Object.hasOwnProperty.call(message, "externalMdOptInAvailable")) + writer.uint32(/* id 48, wireType 0 =*/384).int32(message.externalMdOptInAvailable); + if (message.noDeleteMessageTimeLimit != null && Object.hasOwnProperty.call(message, "noDeleteMessageTimeLimit")) + writer.uint32(/* id 49, wireType 0 =*/392).int32(message.noDeleteMessageTimeLimit); + return writer; + }; + + /** + * Encodes the specified WebFeatures message, length delimited. Does not implicitly {@link proto.WebFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.WebFeatures + * @static + * @param {proto.IWebFeatures} message WebFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebFeatures message from the specified reader or buffer. + * @function decode + * @memberof proto.WebFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.WebFeatures} WebFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebFeatures.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.WebFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.labelsDisplay = reader.int32(); + break; + case 2: + message.voipIndividualOutgoing = reader.int32(); + break; + case 3: + message.groupsV3 = reader.int32(); + break; + case 4: + message.groupsV3Create = reader.int32(); + break; + case 5: + message.changeNumberV2 = reader.int32(); + break; + case 6: + message.queryStatusV3Thumbnail = reader.int32(); + break; + case 7: + message.liveLocations = reader.int32(); + break; + case 8: + message.queryVname = reader.int32(); + break; + case 9: + message.voipIndividualIncoming = reader.int32(); + break; + case 10: + message.quickRepliesQuery = reader.int32(); + break; + case 11: + message.payments = reader.int32(); + break; + case 12: + message.stickerPackQuery = reader.int32(); + break; + case 13: + message.liveLocationsFinal = reader.int32(); + break; + case 14: + message.labelsEdit = reader.int32(); + break; + case 15: + message.mediaUpload = reader.int32(); + break; + case 18: + message.mediaUploadRichQuickReplies = reader.int32(); + break; + case 19: + message.vnameV2 = reader.int32(); + break; + case 20: + message.videoPlaybackUrl = reader.int32(); + break; + case 21: + message.statusRanking = reader.int32(); + break; + case 22: + message.voipIndividualVideo = reader.int32(); + break; + case 23: + message.thirdPartyStickers = reader.int32(); + break; + case 24: + message.frequentlyForwardedSetting = reader.int32(); + break; + case 25: + message.groupsV4JoinPermission = reader.int32(); + break; + case 26: + message.recentStickers = reader.int32(); + break; + case 27: + message.catalog = reader.int32(); + break; + case 28: + message.starredStickers = reader.int32(); + break; + case 29: + message.voipGroupCall = reader.int32(); + break; + case 30: + message.templateMessage = reader.int32(); + break; + case 31: + message.templateMessageInteractivity = reader.int32(); + break; + case 32: + message.ephemeralMessages = reader.int32(); + break; + case 33: + message.e2ENotificationSync = reader.int32(); + break; + case 34: + message.recentStickersV2 = reader.int32(); + break; + case 36: + message.recentStickersV3 = reader.int32(); + break; + case 37: + message.userNotice = reader.int32(); + break; + case 39: + message.support = reader.int32(); + break; + case 40: + message.groupUiiCleanup = reader.int32(); + break; + case 41: + message.groupDogfoodingInternalOnly = reader.int32(); + break; + case 42: + message.settingsSync = reader.int32(); + break; + case 43: + message.archiveV2 = reader.int32(); + break; + case 44: + message.ephemeralAllowGroupMembers = reader.int32(); + break; + case 45: + message.ephemeral24HDuration = reader.int32(); + break; + case 46: + message.mdForceUpgrade = reader.int32(); + break; + case 47: + message.disappearingMode = reader.int32(); + break; + case 48: + message.externalMdOptInAvailable = reader.int32(); + break; + case 49: + message.noDeleteMessageTimeLimit = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.WebFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.WebFeatures} WebFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebFeatures message. + * @function verify + * @memberof proto.WebFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.labelsDisplay != null && message.hasOwnProperty("labelsDisplay")) + switch (message.labelsDisplay) { + default: + return "labelsDisplay: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.voipIndividualOutgoing != null && message.hasOwnProperty("voipIndividualOutgoing")) + switch (message.voipIndividualOutgoing) { + default: + return "voipIndividualOutgoing: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.groupsV3 != null && message.hasOwnProperty("groupsV3")) + switch (message.groupsV3) { + default: + return "groupsV3: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.groupsV3Create != null && message.hasOwnProperty("groupsV3Create")) + switch (message.groupsV3Create) { + default: + return "groupsV3Create: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.changeNumberV2 != null && message.hasOwnProperty("changeNumberV2")) + switch (message.changeNumberV2) { + default: + return "changeNumberV2: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.queryStatusV3Thumbnail != null && message.hasOwnProperty("queryStatusV3Thumbnail")) + switch (message.queryStatusV3Thumbnail) { + default: + return "queryStatusV3Thumbnail: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.liveLocations != null && message.hasOwnProperty("liveLocations")) + switch (message.liveLocations) { + default: + return "liveLocations: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.queryVname != null && message.hasOwnProperty("queryVname")) + switch (message.queryVname) { + default: + return "queryVname: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.voipIndividualIncoming != null && message.hasOwnProperty("voipIndividualIncoming")) + switch (message.voipIndividualIncoming) { + default: + return "voipIndividualIncoming: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.quickRepliesQuery != null && message.hasOwnProperty("quickRepliesQuery")) + switch (message.quickRepliesQuery) { + default: + return "quickRepliesQuery: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.payments != null && message.hasOwnProperty("payments")) + switch (message.payments) { + default: + return "payments: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.stickerPackQuery != null && message.hasOwnProperty("stickerPackQuery")) + switch (message.stickerPackQuery) { + default: + return "stickerPackQuery: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.liveLocationsFinal != null && message.hasOwnProperty("liveLocationsFinal")) + switch (message.liveLocationsFinal) { + default: + return "liveLocationsFinal: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.labelsEdit != null && message.hasOwnProperty("labelsEdit")) + switch (message.labelsEdit) { + default: + return "labelsEdit: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.mediaUpload != null && message.hasOwnProperty("mediaUpload")) + switch (message.mediaUpload) { + default: + return "mediaUpload: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.mediaUploadRichQuickReplies != null && message.hasOwnProperty("mediaUploadRichQuickReplies")) + switch (message.mediaUploadRichQuickReplies) { + default: + return "mediaUploadRichQuickReplies: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.vnameV2 != null && message.hasOwnProperty("vnameV2")) + switch (message.vnameV2) { + default: + return "vnameV2: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.videoPlaybackUrl != null && message.hasOwnProperty("videoPlaybackUrl")) + switch (message.videoPlaybackUrl) { + default: + return "videoPlaybackUrl: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.statusRanking != null && message.hasOwnProperty("statusRanking")) + switch (message.statusRanking) { + default: + return "statusRanking: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.voipIndividualVideo != null && message.hasOwnProperty("voipIndividualVideo")) + switch (message.voipIndividualVideo) { + default: + return "voipIndividualVideo: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.thirdPartyStickers != null && message.hasOwnProperty("thirdPartyStickers")) + switch (message.thirdPartyStickers) { + default: + return "thirdPartyStickers: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.frequentlyForwardedSetting != null && message.hasOwnProperty("frequentlyForwardedSetting")) + switch (message.frequentlyForwardedSetting) { + default: + return "frequentlyForwardedSetting: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.groupsV4JoinPermission != null && message.hasOwnProperty("groupsV4JoinPermission")) + switch (message.groupsV4JoinPermission) { + default: + return "groupsV4JoinPermission: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.recentStickers != null && message.hasOwnProperty("recentStickers")) + switch (message.recentStickers) { + default: + return "recentStickers: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.catalog != null && message.hasOwnProperty("catalog")) + switch (message.catalog) { + default: + return "catalog: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.starredStickers != null && message.hasOwnProperty("starredStickers")) + switch (message.starredStickers) { + default: + return "starredStickers: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.voipGroupCall != null && message.hasOwnProperty("voipGroupCall")) + switch (message.voipGroupCall) { + default: + return "voipGroupCall: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.templateMessage != null && message.hasOwnProperty("templateMessage")) + switch (message.templateMessage) { + default: + return "templateMessage: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.templateMessageInteractivity != null && message.hasOwnProperty("templateMessageInteractivity")) + switch (message.templateMessageInteractivity) { + default: + return "templateMessageInteractivity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.ephemeralMessages != null && message.hasOwnProperty("ephemeralMessages")) + switch (message.ephemeralMessages) { + default: + return "ephemeralMessages: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.e2ENotificationSync != null && message.hasOwnProperty("e2ENotificationSync")) + switch (message.e2ENotificationSync) { + default: + return "e2ENotificationSync: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.recentStickersV2 != null && message.hasOwnProperty("recentStickersV2")) + switch (message.recentStickersV2) { + default: + return "recentStickersV2: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.recentStickersV3 != null && message.hasOwnProperty("recentStickersV3")) + switch (message.recentStickersV3) { + default: + return "recentStickersV3: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.userNotice != null && message.hasOwnProperty("userNotice")) + switch (message.userNotice) { + default: + return "userNotice: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.support != null && message.hasOwnProperty("support")) + switch (message.support) { + default: + return "support: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.groupUiiCleanup != null && message.hasOwnProperty("groupUiiCleanup")) + switch (message.groupUiiCleanup) { + default: + return "groupUiiCleanup: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.groupDogfoodingInternalOnly != null && message.hasOwnProperty("groupDogfoodingInternalOnly")) + switch (message.groupDogfoodingInternalOnly) { + default: + return "groupDogfoodingInternalOnly: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.settingsSync != null && message.hasOwnProperty("settingsSync")) + switch (message.settingsSync) { + default: + return "settingsSync: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.archiveV2 != null && message.hasOwnProperty("archiveV2")) + switch (message.archiveV2) { + default: + return "archiveV2: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.ephemeralAllowGroupMembers != null && message.hasOwnProperty("ephemeralAllowGroupMembers")) + switch (message.ephemeralAllowGroupMembers) { + default: + return "ephemeralAllowGroupMembers: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.ephemeral24HDuration != null && message.hasOwnProperty("ephemeral24HDuration")) + switch (message.ephemeral24HDuration) { + default: + return "ephemeral24HDuration: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.mdForceUpgrade != null && message.hasOwnProperty("mdForceUpgrade")) + switch (message.mdForceUpgrade) { + default: + return "mdForceUpgrade: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) + switch (message.disappearingMode) { + default: + return "disappearingMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.externalMdOptInAvailable != null && message.hasOwnProperty("externalMdOptInAvailable")) + switch (message.externalMdOptInAvailable) { + default: + return "externalMdOptInAvailable: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.noDeleteMessageTimeLimit != null && message.hasOwnProperty("noDeleteMessageTimeLimit")) + switch (message.noDeleteMessageTimeLimit) { + default: + return "noDeleteMessageTimeLimit: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a WebFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.WebFeatures + * @static + * @param {Object.} object Plain object + * @returns {proto.WebFeatures} WebFeatures + */ + WebFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.proto.WebFeatures) + return object; + var message = new $root.proto.WebFeatures(); + switch (object.labelsDisplay) { + case "NOT_STARTED": + case 0: + message.labelsDisplay = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.labelsDisplay = 1; + break; + case "DEVELOPMENT": + case 2: + message.labelsDisplay = 2; + break; + case "PRODUCTION": + case 3: + message.labelsDisplay = 3; + break; + } + switch (object.voipIndividualOutgoing) { + case "NOT_STARTED": + case 0: + message.voipIndividualOutgoing = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.voipIndividualOutgoing = 1; + break; + case "DEVELOPMENT": + case 2: + message.voipIndividualOutgoing = 2; + break; + case "PRODUCTION": + case 3: + message.voipIndividualOutgoing = 3; + break; + } + switch (object.groupsV3) { + case "NOT_STARTED": + case 0: + message.groupsV3 = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.groupsV3 = 1; + break; + case "DEVELOPMENT": + case 2: + message.groupsV3 = 2; + break; + case "PRODUCTION": + case 3: + message.groupsV3 = 3; + break; + } + switch (object.groupsV3Create) { + case "NOT_STARTED": + case 0: + message.groupsV3Create = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.groupsV3Create = 1; + break; + case "DEVELOPMENT": + case 2: + message.groupsV3Create = 2; + break; + case "PRODUCTION": + case 3: + message.groupsV3Create = 3; + break; + } + switch (object.changeNumberV2) { + case "NOT_STARTED": + case 0: + message.changeNumberV2 = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.changeNumberV2 = 1; + break; + case "DEVELOPMENT": + case 2: + message.changeNumberV2 = 2; + break; + case "PRODUCTION": + case 3: + message.changeNumberV2 = 3; + break; + } + switch (object.queryStatusV3Thumbnail) { + case "NOT_STARTED": + case 0: + message.queryStatusV3Thumbnail = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.queryStatusV3Thumbnail = 1; + break; + case "DEVELOPMENT": + case 2: + message.queryStatusV3Thumbnail = 2; + break; + case "PRODUCTION": + case 3: + message.queryStatusV3Thumbnail = 3; + break; + } + switch (object.liveLocations) { + case "NOT_STARTED": + case 0: + message.liveLocations = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.liveLocations = 1; + break; + case "DEVELOPMENT": + case 2: + message.liveLocations = 2; + break; + case "PRODUCTION": + case 3: + message.liveLocations = 3; + break; + } + switch (object.queryVname) { + case "NOT_STARTED": + case 0: + message.queryVname = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.queryVname = 1; + break; + case "DEVELOPMENT": + case 2: + message.queryVname = 2; + break; + case "PRODUCTION": + case 3: + message.queryVname = 3; + break; + } + switch (object.voipIndividualIncoming) { + case "NOT_STARTED": + case 0: + message.voipIndividualIncoming = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.voipIndividualIncoming = 1; + break; + case "DEVELOPMENT": + case 2: + message.voipIndividualIncoming = 2; + break; + case "PRODUCTION": + case 3: + message.voipIndividualIncoming = 3; + break; + } + switch (object.quickRepliesQuery) { + case "NOT_STARTED": + case 0: + message.quickRepliesQuery = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.quickRepliesQuery = 1; + break; + case "DEVELOPMENT": + case 2: + message.quickRepliesQuery = 2; + break; + case "PRODUCTION": + case 3: + message.quickRepliesQuery = 3; + break; + } + switch (object.payments) { + case "NOT_STARTED": + case 0: + message.payments = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.payments = 1; + break; + case "DEVELOPMENT": + case 2: + message.payments = 2; + break; + case "PRODUCTION": + case 3: + message.payments = 3; + break; + } + switch (object.stickerPackQuery) { + case "NOT_STARTED": + case 0: + message.stickerPackQuery = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.stickerPackQuery = 1; + break; + case "DEVELOPMENT": + case 2: + message.stickerPackQuery = 2; + break; + case "PRODUCTION": + case 3: + message.stickerPackQuery = 3; + break; + } + switch (object.liveLocationsFinal) { + case "NOT_STARTED": + case 0: + message.liveLocationsFinal = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.liveLocationsFinal = 1; + break; + case "DEVELOPMENT": + case 2: + message.liveLocationsFinal = 2; + break; + case "PRODUCTION": + case 3: + message.liveLocationsFinal = 3; + break; + } + switch (object.labelsEdit) { + case "NOT_STARTED": + case 0: + message.labelsEdit = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.labelsEdit = 1; + break; + case "DEVELOPMENT": + case 2: + message.labelsEdit = 2; + break; + case "PRODUCTION": + case 3: + message.labelsEdit = 3; + break; + } + switch (object.mediaUpload) { + case "NOT_STARTED": + case 0: + message.mediaUpload = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.mediaUpload = 1; + break; + case "DEVELOPMENT": + case 2: + message.mediaUpload = 2; + break; + case "PRODUCTION": + case 3: + message.mediaUpload = 3; + break; + } + switch (object.mediaUploadRichQuickReplies) { + case "NOT_STARTED": + case 0: + message.mediaUploadRichQuickReplies = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.mediaUploadRichQuickReplies = 1; + break; + case "DEVELOPMENT": + case 2: + message.mediaUploadRichQuickReplies = 2; + break; + case "PRODUCTION": + case 3: + message.mediaUploadRichQuickReplies = 3; + break; + } + switch (object.vnameV2) { + case "NOT_STARTED": + case 0: + message.vnameV2 = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.vnameV2 = 1; + break; + case "DEVELOPMENT": + case 2: + message.vnameV2 = 2; + break; + case "PRODUCTION": + case 3: + message.vnameV2 = 3; + break; + } + switch (object.videoPlaybackUrl) { + case "NOT_STARTED": + case 0: + message.videoPlaybackUrl = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.videoPlaybackUrl = 1; + break; + case "DEVELOPMENT": + case 2: + message.videoPlaybackUrl = 2; + break; + case "PRODUCTION": + case 3: + message.videoPlaybackUrl = 3; + break; + } + switch (object.statusRanking) { + case "NOT_STARTED": + case 0: + message.statusRanking = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.statusRanking = 1; + break; + case "DEVELOPMENT": + case 2: + message.statusRanking = 2; + break; + case "PRODUCTION": + case 3: + message.statusRanking = 3; + break; + } + switch (object.voipIndividualVideo) { + case "NOT_STARTED": + case 0: + message.voipIndividualVideo = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.voipIndividualVideo = 1; + break; + case "DEVELOPMENT": + case 2: + message.voipIndividualVideo = 2; + break; + case "PRODUCTION": + case 3: + message.voipIndividualVideo = 3; + break; + } + switch (object.thirdPartyStickers) { + case "NOT_STARTED": + case 0: + message.thirdPartyStickers = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.thirdPartyStickers = 1; + break; + case "DEVELOPMENT": + case 2: + message.thirdPartyStickers = 2; + break; + case "PRODUCTION": + case 3: + message.thirdPartyStickers = 3; + break; + } + switch (object.frequentlyForwardedSetting) { + case "NOT_STARTED": + case 0: + message.frequentlyForwardedSetting = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.frequentlyForwardedSetting = 1; + break; + case "DEVELOPMENT": + case 2: + message.frequentlyForwardedSetting = 2; + break; + case "PRODUCTION": + case 3: + message.frequentlyForwardedSetting = 3; + break; + } + switch (object.groupsV4JoinPermission) { + case "NOT_STARTED": + case 0: + message.groupsV4JoinPermission = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.groupsV4JoinPermission = 1; + break; + case "DEVELOPMENT": + case 2: + message.groupsV4JoinPermission = 2; + break; + case "PRODUCTION": + case 3: + message.groupsV4JoinPermission = 3; + break; + } + switch (object.recentStickers) { + case "NOT_STARTED": + case 0: + message.recentStickers = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.recentStickers = 1; + break; + case "DEVELOPMENT": + case 2: + message.recentStickers = 2; + break; + case "PRODUCTION": + case 3: + message.recentStickers = 3; + break; + } + switch (object.catalog) { + case "NOT_STARTED": + case 0: + message.catalog = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.catalog = 1; + break; + case "DEVELOPMENT": + case 2: + message.catalog = 2; + break; + case "PRODUCTION": + case 3: + message.catalog = 3; + break; + } + switch (object.starredStickers) { + case "NOT_STARTED": + case 0: + message.starredStickers = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.starredStickers = 1; + break; + case "DEVELOPMENT": + case 2: + message.starredStickers = 2; + break; + case "PRODUCTION": + case 3: + message.starredStickers = 3; + break; + } + switch (object.voipGroupCall) { + case "NOT_STARTED": + case 0: + message.voipGroupCall = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.voipGroupCall = 1; + break; + case "DEVELOPMENT": + case 2: + message.voipGroupCall = 2; + break; + case "PRODUCTION": + case 3: + message.voipGroupCall = 3; + break; + } + switch (object.templateMessage) { + case "NOT_STARTED": + case 0: + message.templateMessage = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.templateMessage = 1; + break; + case "DEVELOPMENT": + case 2: + message.templateMessage = 2; + break; + case "PRODUCTION": + case 3: + message.templateMessage = 3; + break; + } + switch (object.templateMessageInteractivity) { + case "NOT_STARTED": + case 0: + message.templateMessageInteractivity = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.templateMessageInteractivity = 1; + break; + case "DEVELOPMENT": + case 2: + message.templateMessageInteractivity = 2; + break; + case "PRODUCTION": + case 3: + message.templateMessageInteractivity = 3; + break; + } + switch (object.ephemeralMessages) { + case "NOT_STARTED": + case 0: + message.ephemeralMessages = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.ephemeralMessages = 1; + break; + case "DEVELOPMENT": + case 2: + message.ephemeralMessages = 2; + break; + case "PRODUCTION": + case 3: + message.ephemeralMessages = 3; + break; + } + switch (object.e2ENotificationSync) { + case "NOT_STARTED": + case 0: + message.e2ENotificationSync = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.e2ENotificationSync = 1; + break; + case "DEVELOPMENT": + case 2: + message.e2ENotificationSync = 2; + break; + case "PRODUCTION": + case 3: + message.e2ENotificationSync = 3; + break; + } + switch (object.recentStickersV2) { + case "NOT_STARTED": + case 0: + message.recentStickersV2 = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.recentStickersV2 = 1; + break; + case "DEVELOPMENT": + case 2: + message.recentStickersV2 = 2; + break; + case "PRODUCTION": + case 3: + message.recentStickersV2 = 3; + break; + } + switch (object.recentStickersV3) { + case "NOT_STARTED": + case 0: + message.recentStickersV3 = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.recentStickersV3 = 1; + break; + case "DEVELOPMENT": + case 2: + message.recentStickersV3 = 2; + break; + case "PRODUCTION": + case 3: + message.recentStickersV3 = 3; + break; + } + switch (object.userNotice) { + case "NOT_STARTED": + case 0: + message.userNotice = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.userNotice = 1; + break; + case "DEVELOPMENT": + case 2: + message.userNotice = 2; + break; + case "PRODUCTION": + case 3: + message.userNotice = 3; + break; + } + switch (object.support) { + case "NOT_STARTED": + case 0: + message.support = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.support = 1; + break; + case "DEVELOPMENT": + case 2: + message.support = 2; + break; + case "PRODUCTION": + case 3: + message.support = 3; + break; + } + switch (object.groupUiiCleanup) { + case "NOT_STARTED": + case 0: + message.groupUiiCleanup = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.groupUiiCleanup = 1; + break; + case "DEVELOPMENT": + case 2: + message.groupUiiCleanup = 2; + break; + case "PRODUCTION": + case 3: + message.groupUiiCleanup = 3; + break; + } + switch (object.groupDogfoodingInternalOnly) { + case "NOT_STARTED": + case 0: + message.groupDogfoodingInternalOnly = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.groupDogfoodingInternalOnly = 1; + break; + case "DEVELOPMENT": + case 2: + message.groupDogfoodingInternalOnly = 2; + break; + case "PRODUCTION": + case 3: + message.groupDogfoodingInternalOnly = 3; + break; + } + switch (object.settingsSync) { + case "NOT_STARTED": + case 0: + message.settingsSync = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.settingsSync = 1; + break; + case "DEVELOPMENT": + case 2: + message.settingsSync = 2; + break; + case "PRODUCTION": + case 3: + message.settingsSync = 3; + break; + } + switch (object.archiveV2) { + case "NOT_STARTED": + case 0: + message.archiveV2 = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.archiveV2 = 1; + break; + case "DEVELOPMENT": + case 2: + message.archiveV2 = 2; + break; + case "PRODUCTION": + case 3: + message.archiveV2 = 3; + break; + } + switch (object.ephemeralAllowGroupMembers) { + case "NOT_STARTED": + case 0: + message.ephemeralAllowGroupMembers = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.ephemeralAllowGroupMembers = 1; + break; + case "DEVELOPMENT": + case 2: + message.ephemeralAllowGroupMembers = 2; + break; + case "PRODUCTION": + case 3: + message.ephemeralAllowGroupMembers = 3; + break; + } + switch (object.ephemeral24HDuration) { + case "NOT_STARTED": + case 0: + message.ephemeral24HDuration = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.ephemeral24HDuration = 1; + break; + case "DEVELOPMENT": + case 2: + message.ephemeral24HDuration = 2; + break; + case "PRODUCTION": + case 3: + message.ephemeral24HDuration = 3; + break; + } + switch (object.mdForceUpgrade) { + case "NOT_STARTED": + case 0: + message.mdForceUpgrade = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.mdForceUpgrade = 1; + break; + case "DEVELOPMENT": + case 2: + message.mdForceUpgrade = 2; + break; + case "PRODUCTION": + case 3: + message.mdForceUpgrade = 3; + break; + } + switch (object.disappearingMode) { + case "NOT_STARTED": + case 0: + message.disappearingMode = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.disappearingMode = 1; + break; + case "DEVELOPMENT": + case 2: + message.disappearingMode = 2; + break; + case "PRODUCTION": + case 3: + message.disappearingMode = 3; + break; + } + switch (object.externalMdOptInAvailable) { + case "NOT_STARTED": + case 0: + message.externalMdOptInAvailable = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.externalMdOptInAvailable = 1; + break; + case "DEVELOPMENT": + case 2: + message.externalMdOptInAvailable = 2; + break; + case "PRODUCTION": + case 3: + message.externalMdOptInAvailable = 3; + break; + } + switch (object.noDeleteMessageTimeLimit) { + case "NOT_STARTED": + case 0: + message.noDeleteMessageTimeLimit = 0; + break; + case "FORCE_UPGRADE": + case 1: + message.noDeleteMessageTimeLimit = 1; + break; + case "DEVELOPMENT": + case 2: + message.noDeleteMessageTimeLimit = 2; + break; + case "PRODUCTION": + case 3: + message.noDeleteMessageTimeLimit = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a WebFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.WebFeatures + * @static + * @param {proto.WebFeatures} message WebFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.labelsDisplay = options.enums === String ? "NOT_STARTED" : 0; + object.voipIndividualOutgoing = options.enums === String ? "NOT_STARTED" : 0; + object.groupsV3 = options.enums === String ? "NOT_STARTED" : 0; + object.groupsV3Create = options.enums === String ? "NOT_STARTED" : 0; + object.changeNumberV2 = options.enums === String ? "NOT_STARTED" : 0; + object.queryStatusV3Thumbnail = options.enums === String ? "NOT_STARTED" : 0; + object.liveLocations = options.enums === String ? "NOT_STARTED" : 0; + object.queryVname = options.enums === String ? "NOT_STARTED" : 0; + object.voipIndividualIncoming = options.enums === String ? "NOT_STARTED" : 0; + object.quickRepliesQuery = options.enums === String ? "NOT_STARTED" : 0; + object.payments = options.enums === String ? "NOT_STARTED" : 0; + object.stickerPackQuery = options.enums === String ? "NOT_STARTED" : 0; + object.liveLocationsFinal = options.enums === String ? "NOT_STARTED" : 0; + object.labelsEdit = options.enums === String ? "NOT_STARTED" : 0; + object.mediaUpload = options.enums === String ? "NOT_STARTED" : 0; + object.mediaUploadRichQuickReplies = options.enums === String ? "NOT_STARTED" : 0; + object.vnameV2 = options.enums === String ? "NOT_STARTED" : 0; + object.videoPlaybackUrl = options.enums === String ? "NOT_STARTED" : 0; + object.statusRanking = options.enums === String ? "NOT_STARTED" : 0; + object.voipIndividualVideo = options.enums === String ? "NOT_STARTED" : 0; + object.thirdPartyStickers = options.enums === String ? "NOT_STARTED" : 0; + object.frequentlyForwardedSetting = options.enums === String ? "NOT_STARTED" : 0; + object.groupsV4JoinPermission = options.enums === String ? "NOT_STARTED" : 0; + object.recentStickers = options.enums === String ? "NOT_STARTED" : 0; + object.catalog = options.enums === String ? "NOT_STARTED" : 0; + object.starredStickers = options.enums === String ? "NOT_STARTED" : 0; + object.voipGroupCall = options.enums === String ? "NOT_STARTED" : 0; + object.templateMessage = options.enums === String ? "NOT_STARTED" : 0; + object.templateMessageInteractivity = options.enums === String ? "NOT_STARTED" : 0; + object.ephemeralMessages = options.enums === String ? "NOT_STARTED" : 0; + object.e2ENotificationSync = options.enums === String ? "NOT_STARTED" : 0; + object.recentStickersV2 = options.enums === String ? "NOT_STARTED" : 0; + object.recentStickersV3 = options.enums === String ? "NOT_STARTED" : 0; + object.userNotice = options.enums === String ? "NOT_STARTED" : 0; + object.support = options.enums === String ? "NOT_STARTED" : 0; + object.groupUiiCleanup = options.enums === String ? "NOT_STARTED" : 0; + object.groupDogfoodingInternalOnly = options.enums === String ? "NOT_STARTED" : 0; + object.settingsSync = options.enums === String ? "NOT_STARTED" : 0; + object.archiveV2 = options.enums === String ? "NOT_STARTED" : 0; + object.ephemeralAllowGroupMembers = options.enums === String ? "NOT_STARTED" : 0; + object.ephemeral24HDuration = options.enums === String ? "NOT_STARTED" : 0; + object.mdForceUpgrade = options.enums === String ? "NOT_STARTED" : 0; + object.disappearingMode = options.enums === String ? "NOT_STARTED" : 0; + object.externalMdOptInAvailable = options.enums === String ? "NOT_STARTED" : 0; + object.noDeleteMessageTimeLimit = options.enums === String ? "NOT_STARTED" : 0; + } + if (message.labelsDisplay != null && message.hasOwnProperty("labelsDisplay")) + object.labelsDisplay = options.enums === String ? $root.proto.WebFeatures.Flag[message.labelsDisplay] : message.labelsDisplay; + if (message.voipIndividualOutgoing != null && message.hasOwnProperty("voipIndividualOutgoing")) + object.voipIndividualOutgoing = options.enums === String ? $root.proto.WebFeatures.Flag[message.voipIndividualOutgoing] : message.voipIndividualOutgoing; + if (message.groupsV3 != null && message.hasOwnProperty("groupsV3")) + object.groupsV3 = options.enums === String ? $root.proto.WebFeatures.Flag[message.groupsV3] : message.groupsV3; + if (message.groupsV3Create != null && message.hasOwnProperty("groupsV3Create")) + object.groupsV3Create = options.enums === String ? $root.proto.WebFeatures.Flag[message.groupsV3Create] : message.groupsV3Create; + if (message.changeNumberV2 != null && message.hasOwnProperty("changeNumberV2")) + object.changeNumberV2 = options.enums === String ? $root.proto.WebFeatures.Flag[message.changeNumberV2] : message.changeNumberV2; + if (message.queryStatusV3Thumbnail != null && message.hasOwnProperty("queryStatusV3Thumbnail")) + object.queryStatusV3Thumbnail = options.enums === String ? $root.proto.WebFeatures.Flag[message.queryStatusV3Thumbnail] : message.queryStatusV3Thumbnail; + if (message.liveLocations != null && message.hasOwnProperty("liveLocations")) + object.liveLocations = options.enums === String ? $root.proto.WebFeatures.Flag[message.liveLocations] : message.liveLocations; + if (message.queryVname != null && message.hasOwnProperty("queryVname")) + object.queryVname = options.enums === String ? $root.proto.WebFeatures.Flag[message.queryVname] : message.queryVname; + if (message.voipIndividualIncoming != null && message.hasOwnProperty("voipIndividualIncoming")) + object.voipIndividualIncoming = options.enums === String ? $root.proto.WebFeatures.Flag[message.voipIndividualIncoming] : message.voipIndividualIncoming; + if (message.quickRepliesQuery != null && message.hasOwnProperty("quickRepliesQuery")) + object.quickRepliesQuery = options.enums === String ? $root.proto.WebFeatures.Flag[message.quickRepliesQuery] : message.quickRepliesQuery; + if (message.payments != null && message.hasOwnProperty("payments")) + object.payments = options.enums === String ? $root.proto.WebFeatures.Flag[message.payments] : message.payments; + if (message.stickerPackQuery != null && message.hasOwnProperty("stickerPackQuery")) + object.stickerPackQuery = options.enums === String ? $root.proto.WebFeatures.Flag[message.stickerPackQuery] : message.stickerPackQuery; + if (message.liveLocationsFinal != null && message.hasOwnProperty("liveLocationsFinal")) + object.liveLocationsFinal = options.enums === String ? $root.proto.WebFeatures.Flag[message.liveLocationsFinal] : message.liveLocationsFinal; + if (message.labelsEdit != null && message.hasOwnProperty("labelsEdit")) + object.labelsEdit = options.enums === String ? $root.proto.WebFeatures.Flag[message.labelsEdit] : message.labelsEdit; + if (message.mediaUpload != null && message.hasOwnProperty("mediaUpload")) + object.mediaUpload = options.enums === String ? $root.proto.WebFeatures.Flag[message.mediaUpload] : message.mediaUpload; + if (message.mediaUploadRichQuickReplies != null && message.hasOwnProperty("mediaUploadRichQuickReplies")) + object.mediaUploadRichQuickReplies = options.enums === String ? $root.proto.WebFeatures.Flag[message.mediaUploadRichQuickReplies] : message.mediaUploadRichQuickReplies; + if (message.vnameV2 != null && message.hasOwnProperty("vnameV2")) + object.vnameV2 = options.enums === String ? $root.proto.WebFeatures.Flag[message.vnameV2] : message.vnameV2; + if (message.videoPlaybackUrl != null && message.hasOwnProperty("videoPlaybackUrl")) + object.videoPlaybackUrl = options.enums === String ? $root.proto.WebFeatures.Flag[message.videoPlaybackUrl] : message.videoPlaybackUrl; + if (message.statusRanking != null && message.hasOwnProperty("statusRanking")) + object.statusRanking = options.enums === String ? $root.proto.WebFeatures.Flag[message.statusRanking] : message.statusRanking; + if (message.voipIndividualVideo != null && message.hasOwnProperty("voipIndividualVideo")) + object.voipIndividualVideo = options.enums === String ? $root.proto.WebFeatures.Flag[message.voipIndividualVideo] : message.voipIndividualVideo; + if (message.thirdPartyStickers != null && message.hasOwnProperty("thirdPartyStickers")) + object.thirdPartyStickers = options.enums === String ? $root.proto.WebFeatures.Flag[message.thirdPartyStickers] : message.thirdPartyStickers; + if (message.frequentlyForwardedSetting != null && message.hasOwnProperty("frequentlyForwardedSetting")) + object.frequentlyForwardedSetting = options.enums === String ? $root.proto.WebFeatures.Flag[message.frequentlyForwardedSetting] : message.frequentlyForwardedSetting; + if (message.groupsV4JoinPermission != null && message.hasOwnProperty("groupsV4JoinPermission")) + object.groupsV4JoinPermission = options.enums === String ? $root.proto.WebFeatures.Flag[message.groupsV4JoinPermission] : message.groupsV4JoinPermission; + if (message.recentStickers != null && message.hasOwnProperty("recentStickers")) + object.recentStickers = options.enums === String ? $root.proto.WebFeatures.Flag[message.recentStickers] : message.recentStickers; + if (message.catalog != null && message.hasOwnProperty("catalog")) + object.catalog = options.enums === String ? $root.proto.WebFeatures.Flag[message.catalog] : message.catalog; + if (message.starredStickers != null && message.hasOwnProperty("starredStickers")) + object.starredStickers = options.enums === String ? $root.proto.WebFeatures.Flag[message.starredStickers] : message.starredStickers; + if (message.voipGroupCall != null && message.hasOwnProperty("voipGroupCall")) + object.voipGroupCall = options.enums === String ? $root.proto.WebFeatures.Flag[message.voipGroupCall] : message.voipGroupCall; + if (message.templateMessage != null && message.hasOwnProperty("templateMessage")) + object.templateMessage = options.enums === String ? $root.proto.WebFeatures.Flag[message.templateMessage] : message.templateMessage; + if (message.templateMessageInteractivity != null && message.hasOwnProperty("templateMessageInteractivity")) + object.templateMessageInteractivity = options.enums === String ? $root.proto.WebFeatures.Flag[message.templateMessageInteractivity] : message.templateMessageInteractivity; + if (message.ephemeralMessages != null && message.hasOwnProperty("ephemeralMessages")) + object.ephemeralMessages = options.enums === String ? $root.proto.WebFeatures.Flag[message.ephemeralMessages] : message.ephemeralMessages; + if (message.e2ENotificationSync != null && message.hasOwnProperty("e2ENotificationSync")) + object.e2ENotificationSync = options.enums === String ? $root.proto.WebFeatures.Flag[message.e2ENotificationSync] : message.e2ENotificationSync; + if (message.recentStickersV2 != null && message.hasOwnProperty("recentStickersV2")) + object.recentStickersV2 = options.enums === String ? $root.proto.WebFeatures.Flag[message.recentStickersV2] : message.recentStickersV2; + if (message.recentStickersV3 != null && message.hasOwnProperty("recentStickersV3")) + object.recentStickersV3 = options.enums === String ? $root.proto.WebFeatures.Flag[message.recentStickersV3] : message.recentStickersV3; + if (message.userNotice != null && message.hasOwnProperty("userNotice")) + object.userNotice = options.enums === String ? $root.proto.WebFeatures.Flag[message.userNotice] : message.userNotice; + if (message.support != null && message.hasOwnProperty("support")) + object.support = options.enums === String ? $root.proto.WebFeatures.Flag[message.support] : message.support; + if (message.groupUiiCleanup != null && message.hasOwnProperty("groupUiiCleanup")) + object.groupUiiCleanup = options.enums === String ? $root.proto.WebFeatures.Flag[message.groupUiiCleanup] : message.groupUiiCleanup; + if (message.groupDogfoodingInternalOnly != null && message.hasOwnProperty("groupDogfoodingInternalOnly")) + object.groupDogfoodingInternalOnly = options.enums === String ? $root.proto.WebFeatures.Flag[message.groupDogfoodingInternalOnly] : message.groupDogfoodingInternalOnly; + if (message.settingsSync != null && message.hasOwnProperty("settingsSync")) + object.settingsSync = options.enums === String ? $root.proto.WebFeatures.Flag[message.settingsSync] : message.settingsSync; + if (message.archiveV2 != null && message.hasOwnProperty("archiveV2")) + object.archiveV2 = options.enums === String ? $root.proto.WebFeatures.Flag[message.archiveV2] : message.archiveV2; + if (message.ephemeralAllowGroupMembers != null && message.hasOwnProperty("ephemeralAllowGroupMembers")) + object.ephemeralAllowGroupMembers = options.enums === String ? $root.proto.WebFeatures.Flag[message.ephemeralAllowGroupMembers] : message.ephemeralAllowGroupMembers; + if (message.ephemeral24HDuration != null && message.hasOwnProperty("ephemeral24HDuration")) + object.ephemeral24HDuration = options.enums === String ? $root.proto.WebFeatures.Flag[message.ephemeral24HDuration] : message.ephemeral24HDuration; + if (message.mdForceUpgrade != null && message.hasOwnProperty("mdForceUpgrade")) + object.mdForceUpgrade = options.enums === String ? $root.proto.WebFeatures.Flag[message.mdForceUpgrade] : message.mdForceUpgrade; + if (message.disappearingMode != null && message.hasOwnProperty("disappearingMode")) + object.disappearingMode = options.enums === String ? $root.proto.WebFeatures.Flag[message.disappearingMode] : message.disappearingMode; + if (message.externalMdOptInAvailable != null && message.hasOwnProperty("externalMdOptInAvailable")) + object.externalMdOptInAvailable = options.enums === String ? $root.proto.WebFeatures.Flag[message.externalMdOptInAvailable] : message.externalMdOptInAvailable; + if (message.noDeleteMessageTimeLimit != null && message.hasOwnProperty("noDeleteMessageTimeLimit")) + object.noDeleteMessageTimeLimit = options.enums === String ? $root.proto.WebFeatures.Flag[message.noDeleteMessageTimeLimit] : message.noDeleteMessageTimeLimit; + return object; + }; + + /** + * Converts this WebFeatures to JSON. + * @function toJSON + * @memberof proto.WebFeatures + * @instance + * @returns {Object.} JSON object + */ + WebFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Flag enum. + * @name proto.WebFeatures.Flag + * @enum {number} + * @property {number} NOT_STARTED=0 NOT_STARTED value + * @property {number} FORCE_UPGRADE=1 FORCE_UPGRADE value + * @property {number} DEVELOPMENT=2 DEVELOPMENT value + * @property {number} PRODUCTION=3 PRODUCTION value + */ + WebFeatures.Flag = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NOT_STARTED"] = 0; + values[valuesById[1] = "FORCE_UPGRADE"] = 1; + values[valuesById[2] = "DEVELOPMENT"] = 2; + values[valuesById[3] = "PRODUCTION"] = 3; + return values; + })(); + + return WebFeatures; + })(); + + proto.WebMessageInfo = (function() { + + /** + * Properties of a WebMessageInfo. + * @memberof proto + * @interface IWebMessageInfo + * @property {proto.IMessageKey} key WebMessageInfo key + * @property {proto.IMessage|null} [message] WebMessageInfo message + * @property {number|Long|null} [messageTimestamp] WebMessageInfo messageTimestamp + * @property {proto.WebMessageInfo.Status|null} [status] WebMessageInfo status + * @property {string|null} [participant] WebMessageInfo participant + * @property {number|Long|null} [messageC2STimestamp] WebMessageInfo messageC2STimestamp + * @property {boolean|null} [ignore] WebMessageInfo ignore + * @property {boolean|null} [starred] WebMessageInfo starred + * @property {boolean|null} [broadcast] WebMessageInfo broadcast + * @property {string|null} [pushName] WebMessageInfo pushName + * @property {Uint8Array|null} [mediaCiphertextSha256] WebMessageInfo mediaCiphertextSha256 + * @property {boolean|null} [multicast] WebMessageInfo multicast + * @property {boolean|null} [urlText] WebMessageInfo urlText + * @property {boolean|null} [urlNumber] WebMessageInfo urlNumber + * @property {proto.WebMessageInfo.StubType|null} [messageStubType] WebMessageInfo messageStubType + * @property {boolean|null} [clearMedia] WebMessageInfo clearMedia + * @property {Array.|null} [messageStubParameters] WebMessageInfo messageStubParameters + * @property {number|null} [duration] WebMessageInfo duration + * @property {Array.|null} [labels] WebMessageInfo labels + * @property {proto.IPaymentInfo|null} [paymentInfo] WebMessageInfo paymentInfo + * @property {proto.Message.ILiveLocationMessage|null} [finalLiveLocation] WebMessageInfo finalLiveLocation + * @property {proto.IPaymentInfo|null} [quotedPaymentInfo] WebMessageInfo quotedPaymentInfo + * @property {number|Long|null} [ephemeralStartTimestamp] WebMessageInfo ephemeralStartTimestamp + * @property {number|null} [ephemeralDuration] WebMessageInfo ephemeralDuration + * @property {boolean|null} [ephemeralOffToOn] WebMessageInfo ephemeralOffToOn + * @property {boolean|null} [ephemeralOutOfSync] WebMessageInfo ephemeralOutOfSync + * @property {proto.WebMessageInfo.BizPrivacyStatus|null} [bizPrivacyStatus] WebMessageInfo bizPrivacyStatus + * @property {string|null} [verifiedBizName] WebMessageInfo verifiedBizName + * @property {proto.IMediaData|null} [mediaData] WebMessageInfo mediaData + * @property {proto.IPhotoChange|null} [photoChange] WebMessageInfo photoChange + * @property {Array.|null} [userReceipt] WebMessageInfo userReceipt + * @property {Array.|null} [reactions] WebMessageInfo reactions + * @property {proto.IMediaData|null} [quotedStickerData] WebMessageInfo quotedStickerData + * @property {Uint8Array|null} [futureproofData] WebMessageInfo futureproofData + * @property {proto.IStatusPSA|null} [statusPsa] WebMessageInfo statusPsa + * @property {Array.|null} [pollUpdates] WebMessageInfo pollUpdates + * @property {proto.IPollAdditionalMetadata|null} [pollAdditionalMetadata] WebMessageInfo pollAdditionalMetadata + * @property {string|null} [agentId] WebMessageInfo agentId + * @property {boolean|null} [statusAlreadyViewed] WebMessageInfo statusAlreadyViewed + * @property {Uint8Array|null} [messageSecret] WebMessageInfo messageSecret + * @property {proto.IKeepInChat|null} [keepInChat] WebMessageInfo keepInChat + * @property {string|null} [originalSelfAuthorUserJidString] WebMessageInfo originalSelfAuthorUserJidString + * @property {number|Long|null} [revokeMessageTimestamp] WebMessageInfo revokeMessageTimestamp + */ + + /** + * Constructs a new WebMessageInfo. + * @memberof proto + * @classdesc Represents a WebMessageInfo. + * @implements IWebMessageInfo + * @constructor + * @param {proto.IWebMessageInfo=} [properties] Properties to set + */ + function WebMessageInfo(properties) { + this.messageStubParameters = []; + this.labels = []; + this.userReceipt = []; + this.reactions = []; + this.pollUpdates = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebMessageInfo key. + * @member {proto.IMessageKey} key + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.key = null; + + /** + * WebMessageInfo message. + * @member {proto.IMessage|null|undefined} message + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.message = null; + + /** + * WebMessageInfo messageTimestamp. + * @member {number|Long} messageTimestamp + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.messageTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * WebMessageInfo status. + * @member {proto.WebMessageInfo.Status} status + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.status = 0; + + /** + * WebMessageInfo participant. + * @member {string} participant + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.participant = ""; + + /** + * WebMessageInfo messageC2STimestamp. + * @member {number|Long} messageC2STimestamp + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.messageC2STimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * WebMessageInfo ignore. + * @member {boolean} ignore + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.ignore = false; + + /** + * WebMessageInfo starred. + * @member {boolean} starred + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.starred = false; + + /** + * WebMessageInfo broadcast. + * @member {boolean} broadcast + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.broadcast = false; + + /** + * WebMessageInfo pushName. + * @member {string} pushName + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.pushName = ""; + + /** + * WebMessageInfo mediaCiphertextSha256. + * @member {Uint8Array} mediaCiphertextSha256 + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.mediaCiphertextSha256 = $util.newBuffer([]); + + /** + * WebMessageInfo multicast. + * @member {boolean} multicast + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.multicast = false; + + /** + * WebMessageInfo urlText. + * @member {boolean} urlText + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.urlText = false; + + /** + * WebMessageInfo urlNumber. + * @member {boolean} urlNumber + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.urlNumber = false; + + /** + * WebMessageInfo messageStubType. + * @member {proto.WebMessageInfo.StubType} messageStubType + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.messageStubType = 0; + + /** + * WebMessageInfo clearMedia. + * @member {boolean} clearMedia + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.clearMedia = false; + + /** + * WebMessageInfo messageStubParameters. + * @member {Array.} messageStubParameters + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.messageStubParameters = $util.emptyArray; + + /** + * WebMessageInfo duration. + * @member {number} duration + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.duration = 0; + + /** + * WebMessageInfo labels. + * @member {Array.} labels + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.labels = $util.emptyArray; + + /** + * WebMessageInfo paymentInfo. + * @member {proto.IPaymentInfo|null|undefined} paymentInfo + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.paymentInfo = null; + + /** + * WebMessageInfo finalLiveLocation. + * @member {proto.Message.ILiveLocationMessage|null|undefined} finalLiveLocation + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.finalLiveLocation = null; + + /** + * WebMessageInfo quotedPaymentInfo. + * @member {proto.IPaymentInfo|null|undefined} quotedPaymentInfo + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.quotedPaymentInfo = null; + + /** + * WebMessageInfo ephemeralStartTimestamp. + * @member {number|Long} ephemeralStartTimestamp + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.ephemeralStartTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * WebMessageInfo ephemeralDuration. + * @member {number} ephemeralDuration + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.ephemeralDuration = 0; + + /** + * WebMessageInfo ephemeralOffToOn. + * @member {boolean} ephemeralOffToOn + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.ephemeralOffToOn = false; + + /** + * WebMessageInfo ephemeralOutOfSync. + * @member {boolean} ephemeralOutOfSync + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.ephemeralOutOfSync = false; + + /** + * WebMessageInfo bizPrivacyStatus. + * @member {proto.WebMessageInfo.BizPrivacyStatus} bizPrivacyStatus + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.bizPrivacyStatus = 0; + + /** + * WebMessageInfo verifiedBizName. + * @member {string} verifiedBizName + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.verifiedBizName = ""; + + /** + * WebMessageInfo mediaData. + * @member {proto.IMediaData|null|undefined} mediaData + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.mediaData = null; + + /** + * WebMessageInfo photoChange. + * @member {proto.IPhotoChange|null|undefined} photoChange + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.photoChange = null; + + /** + * WebMessageInfo userReceipt. + * @member {Array.} userReceipt + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.userReceipt = $util.emptyArray; + + /** + * WebMessageInfo reactions. + * @member {Array.} reactions + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.reactions = $util.emptyArray; + + /** + * WebMessageInfo quotedStickerData. + * @member {proto.IMediaData|null|undefined} quotedStickerData + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.quotedStickerData = null; + + /** + * WebMessageInfo futureproofData. + * @member {Uint8Array} futureproofData + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.futureproofData = $util.newBuffer([]); + + /** + * WebMessageInfo statusPsa. + * @member {proto.IStatusPSA|null|undefined} statusPsa + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.statusPsa = null; + + /** + * WebMessageInfo pollUpdates. + * @member {Array.} pollUpdates + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.pollUpdates = $util.emptyArray; + + /** + * WebMessageInfo pollAdditionalMetadata. + * @member {proto.IPollAdditionalMetadata|null|undefined} pollAdditionalMetadata + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.pollAdditionalMetadata = null; + + /** + * WebMessageInfo agentId. + * @member {string} agentId + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.agentId = ""; + + /** + * WebMessageInfo statusAlreadyViewed. + * @member {boolean} statusAlreadyViewed + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.statusAlreadyViewed = false; + + /** + * WebMessageInfo messageSecret. + * @member {Uint8Array} messageSecret + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.messageSecret = $util.newBuffer([]); + + /** + * WebMessageInfo keepInChat. + * @member {proto.IKeepInChat|null|undefined} keepInChat + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.keepInChat = null; + + /** + * WebMessageInfo originalSelfAuthorUserJidString. + * @member {string} originalSelfAuthorUserJidString + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.originalSelfAuthorUserJidString = ""; + + /** + * WebMessageInfo revokeMessageTimestamp. + * @member {number|Long} revokeMessageTimestamp + * @memberof proto.WebMessageInfo + * @instance + */ + WebMessageInfo.prototype.revokeMessageTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new WebMessageInfo instance using the specified properties. + * @function create + * @memberof proto.WebMessageInfo + * @static + * @param {proto.IWebMessageInfo=} [properties] Properties to set + * @returns {proto.WebMessageInfo} WebMessageInfo instance + */ + WebMessageInfo.create = function create(properties) { + return new WebMessageInfo(properties); + }; + + /** + * Encodes the specified WebMessageInfo message. Does not implicitly {@link proto.WebMessageInfo.verify|verify} messages. + * @function encode + * @memberof proto.WebMessageInfo + * @static + * @param {proto.IWebMessageInfo} message WebMessageInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebMessageInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + $root.proto.MessageKey.encode(message.key, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.proto.Message.encode(message.message, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.messageTimestamp != null && Object.hasOwnProperty.call(message, "messageTimestamp")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.messageTimestamp); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.status); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.participant); + if (message.messageC2STimestamp != null && Object.hasOwnProperty.call(message, "messageC2STimestamp")) + writer.uint32(/* id 6, wireType 0 =*/48).uint64(message.messageC2STimestamp); + if (message.ignore != null && Object.hasOwnProperty.call(message, "ignore")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ignore); + if (message.starred != null && Object.hasOwnProperty.call(message, "starred")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.starred); + if (message.broadcast != null && Object.hasOwnProperty.call(message, "broadcast")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.broadcast); + if (message.pushName != null && Object.hasOwnProperty.call(message, "pushName")) + writer.uint32(/* id 19, wireType 2 =*/154).string(message.pushName); + if (message.mediaCiphertextSha256 != null && Object.hasOwnProperty.call(message, "mediaCiphertextSha256")) + writer.uint32(/* id 20, wireType 2 =*/162).bytes(message.mediaCiphertextSha256); + if (message.multicast != null && Object.hasOwnProperty.call(message, "multicast")) + writer.uint32(/* id 21, wireType 0 =*/168).bool(message.multicast); + if (message.urlText != null && Object.hasOwnProperty.call(message, "urlText")) + writer.uint32(/* id 22, wireType 0 =*/176).bool(message.urlText); + if (message.urlNumber != null && Object.hasOwnProperty.call(message, "urlNumber")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.urlNumber); + if (message.messageStubType != null && Object.hasOwnProperty.call(message, "messageStubType")) + writer.uint32(/* id 24, wireType 0 =*/192).int32(message.messageStubType); + if (message.clearMedia != null && Object.hasOwnProperty.call(message, "clearMedia")) + writer.uint32(/* id 25, wireType 0 =*/200).bool(message.clearMedia); + if (message.messageStubParameters != null && message.messageStubParameters.length) + for (var i = 0; i < message.messageStubParameters.length; ++i) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.messageStubParameters[i]); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + writer.uint32(/* id 27, wireType 0 =*/216).uint32(message.duration); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + writer.uint32(/* id 28, wireType 2 =*/226).string(message.labels[i]); + if (message.paymentInfo != null && Object.hasOwnProperty.call(message, "paymentInfo")) + $root.proto.PaymentInfo.encode(message.paymentInfo, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.finalLiveLocation != null && Object.hasOwnProperty.call(message, "finalLiveLocation")) + $root.proto.Message.LiveLocationMessage.encode(message.finalLiveLocation, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.quotedPaymentInfo != null && Object.hasOwnProperty.call(message, "quotedPaymentInfo")) + $root.proto.PaymentInfo.encode(message.quotedPaymentInfo, writer.uint32(/* id 31, wireType 2 =*/250).fork()).ldelim(); + if (message.ephemeralStartTimestamp != null && Object.hasOwnProperty.call(message, "ephemeralStartTimestamp")) + writer.uint32(/* id 32, wireType 0 =*/256).uint64(message.ephemeralStartTimestamp); + if (message.ephemeralDuration != null && Object.hasOwnProperty.call(message, "ephemeralDuration")) + writer.uint32(/* id 33, wireType 0 =*/264).uint32(message.ephemeralDuration); + if (message.ephemeralOffToOn != null && Object.hasOwnProperty.call(message, "ephemeralOffToOn")) + writer.uint32(/* id 34, wireType 0 =*/272).bool(message.ephemeralOffToOn); + if (message.ephemeralOutOfSync != null && Object.hasOwnProperty.call(message, "ephemeralOutOfSync")) + writer.uint32(/* id 35, wireType 0 =*/280).bool(message.ephemeralOutOfSync); + if (message.bizPrivacyStatus != null && Object.hasOwnProperty.call(message, "bizPrivacyStatus")) + writer.uint32(/* id 36, wireType 0 =*/288).int32(message.bizPrivacyStatus); + if (message.verifiedBizName != null && Object.hasOwnProperty.call(message, "verifiedBizName")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.verifiedBizName); + if (message.mediaData != null && Object.hasOwnProperty.call(message, "mediaData")) + $root.proto.MediaData.encode(message.mediaData, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); + if (message.photoChange != null && Object.hasOwnProperty.call(message, "photoChange")) + $root.proto.PhotoChange.encode(message.photoChange, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.userReceipt != null && message.userReceipt.length) + for (var i = 0; i < message.userReceipt.length; ++i) + $root.proto.UserReceipt.encode(message.userReceipt[i], writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); + if (message.reactions != null && message.reactions.length) + for (var i = 0; i < message.reactions.length; ++i) + $root.proto.Reaction.encode(message.reactions[i], writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + if (message.quotedStickerData != null && Object.hasOwnProperty.call(message, "quotedStickerData")) + $root.proto.MediaData.encode(message.quotedStickerData, writer.uint32(/* id 42, wireType 2 =*/338).fork()).ldelim(); + if (message.futureproofData != null && Object.hasOwnProperty.call(message, "futureproofData")) + writer.uint32(/* id 43, wireType 2 =*/346).bytes(message.futureproofData); + if (message.statusPsa != null && Object.hasOwnProperty.call(message, "statusPsa")) + $root.proto.StatusPSA.encode(message.statusPsa, writer.uint32(/* id 44, wireType 2 =*/354).fork()).ldelim(); + if (message.pollUpdates != null && message.pollUpdates.length) + for (var i = 0; i < message.pollUpdates.length; ++i) + $root.proto.PollUpdate.encode(message.pollUpdates[i], writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + if (message.pollAdditionalMetadata != null && Object.hasOwnProperty.call(message, "pollAdditionalMetadata")) + $root.proto.PollAdditionalMetadata.encode(message.pollAdditionalMetadata, writer.uint32(/* id 46, wireType 2 =*/370).fork()).ldelim(); + if (message.agentId != null && Object.hasOwnProperty.call(message, "agentId")) + writer.uint32(/* id 47, wireType 2 =*/378).string(message.agentId); + if (message.statusAlreadyViewed != null && Object.hasOwnProperty.call(message, "statusAlreadyViewed")) + writer.uint32(/* id 48, wireType 0 =*/384).bool(message.statusAlreadyViewed); + if (message.messageSecret != null && Object.hasOwnProperty.call(message, "messageSecret")) + writer.uint32(/* id 49, wireType 2 =*/394).bytes(message.messageSecret); + if (message.keepInChat != null && Object.hasOwnProperty.call(message, "keepInChat")) + $root.proto.KeepInChat.encode(message.keepInChat, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.originalSelfAuthorUserJidString != null && Object.hasOwnProperty.call(message, "originalSelfAuthorUserJidString")) + writer.uint32(/* id 51, wireType 2 =*/410).string(message.originalSelfAuthorUserJidString); + if (message.revokeMessageTimestamp != null && Object.hasOwnProperty.call(message, "revokeMessageTimestamp")) + writer.uint32(/* id 52, wireType 0 =*/416).uint64(message.revokeMessageTimestamp); + return writer; + }; + + /** + * Encodes the specified WebMessageInfo message, length delimited. Does not implicitly {@link proto.WebMessageInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.WebMessageInfo + * @static + * @param {proto.IWebMessageInfo} message WebMessageInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebMessageInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebMessageInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.WebMessageInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.WebMessageInfo} WebMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebMessageInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.WebMessageInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = $root.proto.MessageKey.decode(reader, reader.uint32()); + break; + case 2: + message.message = $root.proto.Message.decode(reader, reader.uint32()); + break; + case 3: + message.messageTimestamp = reader.uint64(); + break; + case 4: + message.status = reader.int32(); + break; + case 5: + message.participant = reader.string(); + break; + case 6: + message.messageC2STimestamp = reader.uint64(); + break; + case 16: + message.ignore = reader.bool(); + break; + case 17: + message.starred = reader.bool(); + break; + case 18: + message.broadcast = reader.bool(); + break; + case 19: + message.pushName = reader.string(); + break; + case 20: + message.mediaCiphertextSha256 = reader.bytes(); + break; + case 21: + message.multicast = reader.bool(); + break; + case 22: + message.urlText = reader.bool(); + break; + case 23: + message.urlNumber = reader.bool(); + break; + case 24: + message.messageStubType = reader.int32(); + break; + case 25: + message.clearMedia = reader.bool(); + break; + case 26: + if (!(message.messageStubParameters && message.messageStubParameters.length)) + message.messageStubParameters = []; + message.messageStubParameters.push(reader.string()); + break; + case 27: + message.duration = reader.uint32(); + break; + case 28: + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push(reader.string()); + break; + case 29: + message.paymentInfo = $root.proto.PaymentInfo.decode(reader, reader.uint32()); + break; + case 30: + message.finalLiveLocation = $root.proto.Message.LiveLocationMessage.decode(reader, reader.uint32()); + break; + case 31: + message.quotedPaymentInfo = $root.proto.PaymentInfo.decode(reader, reader.uint32()); + break; + case 32: + message.ephemeralStartTimestamp = reader.uint64(); + break; + case 33: + message.ephemeralDuration = reader.uint32(); + break; + case 34: + message.ephemeralOffToOn = reader.bool(); + break; + case 35: + message.ephemeralOutOfSync = reader.bool(); + break; + case 36: + message.bizPrivacyStatus = reader.int32(); + break; + case 37: + message.verifiedBizName = reader.string(); + break; + case 38: + message.mediaData = $root.proto.MediaData.decode(reader, reader.uint32()); + break; + case 39: + message.photoChange = $root.proto.PhotoChange.decode(reader, reader.uint32()); + break; + case 40: + if (!(message.userReceipt && message.userReceipt.length)) + message.userReceipt = []; + message.userReceipt.push($root.proto.UserReceipt.decode(reader, reader.uint32())); + break; + case 41: + if (!(message.reactions && message.reactions.length)) + message.reactions = []; + message.reactions.push($root.proto.Reaction.decode(reader, reader.uint32())); + break; + case 42: + message.quotedStickerData = $root.proto.MediaData.decode(reader, reader.uint32()); + break; + case 43: + message.futureproofData = reader.bytes(); + break; + case 44: + message.statusPsa = $root.proto.StatusPSA.decode(reader, reader.uint32()); + break; + case 45: + if (!(message.pollUpdates && message.pollUpdates.length)) + message.pollUpdates = []; + message.pollUpdates.push($root.proto.PollUpdate.decode(reader, reader.uint32())); + break; + case 46: + message.pollAdditionalMetadata = $root.proto.PollAdditionalMetadata.decode(reader, reader.uint32()); + break; + case 47: + message.agentId = reader.string(); + break; + case 48: + message.statusAlreadyViewed = reader.bool(); + break; + case 49: + message.messageSecret = reader.bytes(); + break; + case 50: + message.keepInChat = $root.proto.KeepInChat.decode(reader, reader.uint32()); + break; + case 51: + message.originalSelfAuthorUserJidString = reader.string(); + break; + case 52: + message.revokeMessageTimestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("key")) + throw $util.ProtocolError("missing required 'key'", { instance: message }); + return message; + }; + + /** + * Decodes a WebMessageInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.WebMessageInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.WebMessageInfo} WebMessageInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebMessageInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebMessageInfo message. + * @function verify + * @memberof proto.WebMessageInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebMessageInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + { + var error = $root.proto.MessageKey.verify(message.key); + if (error) + return "key." + error; + } + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.proto.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.messageTimestamp != null && message.hasOwnProperty("messageTimestamp")) + if (!$util.isInteger(message.messageTimestamp) && !(message.messageTimestamp && $util.isInteger(message.messageTimestamp.low) && $util.isInteger(message.messageTimestamp.high))) + return "messageTimestamp: integer|Long expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.messageC2STimestamp != null && message.hasOwnProperty("messageC2STimestamp")) + if (!$util.isInteger(message.messageC2STimestamp) && !(message.messageC2STimestamp && $util.isInteger(message.messageC2STimestamp.low) && $util.isInteger(message.messageC2STimestamp.high))) + return "messageC2STimestamp: integer|Long expected"; + if (message.ignore != null && message.hasOwnProperty("ignore")) + if (typeof message.ignore !== "boolean") + return "ignore: boolean expected"; + if (message.starred != null && message.hasOwnProperty("starred")) + if (typeof message.starred !== "boolean") + return "starred: boolean expected"; + if (message.broadcast != null && message.hasOwnProperty("broadcast")) + if (typeof message.broadcast !== "boolean") + return "broadcast: boolean expected"; + if (message.pushName != null && message.hasOwnProperty("pushName")) + if (!$util.isString(message.pushName)) + return "pushName: string expected"; + if (message.mediaCiphertextSha256 != null && message.hasOwnProperty("mediaCiphertextSha256")) + if (!(message.mediaCiphertextSha256 && typeof message.mediaCiphertextSha256.length === "number" || $util.isString(message.mediaCiphertextSha256))) + return "mediaCiphertextSha256: buffer expected"; + if (message.multicast != null && message.hasOwnProperty("multicast")) + if (typeof message.multicast !== "boolean") + return "multicast: boolean expected"; + if (message.urlText != null && message.hasOwnProperty("urlText")) + if (typeof message.urlText !== "boolean") + return "urlText: boolean expected"; + if (message.urlNumber != null && message.hasOwnProperty("urlNumber")) + if (typeof message.urlNumber !== "boolean") + return "urlNumber: boolean expected"; + if (message.messageStubType != null && message.hasOwnProperty("messageStubType")) + switch (message.messageStubType) { + default: + return "messageStubType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + break; + } + if (message.clearMedia != null && message.hasOwnProperty("clearMedia")) + if (typeof message.clearMedia !== "boolean") + return "clearMedia: boolean expected"; + if (message.messageStubParameters != null && message.hasOwnProperty("messageStubParameters")) { + if (!Array.isArray(message.messageStubParameters)) + return "messageStubParameters: array expected"; + for (var i = 0; i < message.messageStubParameters.length; ++i) + if (!$util.isString(message.messageStubParameters[i])) + return "messageStubParameters: string[] expected"; + } + if (message.duration != null && message.hasOwnProperty("duration")) + if (!$util.isInteger(message.duration)) + return "duration: integer expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) + if (!$util.isString(message.labels[i])) + return "labels: string[] expected"; + } + if (message.paymentInfo != null && message.hasOwnProperty("paymentInfo")) { + var error = $root.proto.PaymentInfo.verify(message.paymentInfo); + if (error) + return "paymentInfo." + error; + } + if (message.finalLiveLocation != null && message.hasOwnProperty("finalLiveLocation")) { + var error = $root.proto.Message.LiveLocationMessage.verify(message.finalLiveLocation); + if (error) + return "finalLiveLocation." + error; + } + if (message.quotedPaymentInfo != null && message.hasOwnProperty("quotedPaymentInfo")) { + var error = $root.proto.PaymentInfo.verify(message.quotedPaymentInfo); + if (error) + return "quotedPaymentInfo." + error; + } + if (message.ephemeralStartTimestamp != null && message.hasOwnProperty("ephemeralStartTimestamp")) + if (!$util.isInteger(message.ephemeralStartTimestamp) && !(message.ephemeralStartTimestamp && $util.isInteger(message.ephemeralStartTimestamp.low) && $util.isInteger(message.ephemeralStartTimestamp.high))) + return "ephemeralStartTimestamp: integer|Long expected"; + if (message.ephemeralDuration != null && message.hasOwnProperty("ephemeralDuration")) + if (!$util.isInteger(message.ephemeralDuration)) + return "ephemeralDuration: integer expected"; + if (message.ephemeralOffToOn != null && message.hasOwnProperty("ephemeralOffToOn")) + if (typeof message.ephemeralOffToOn !== "boolean") + return "ephemeralOffToOn: boolean expected"; + if (message.ephemeralOutOfSync != null && message.hasOwnProperty("ephemeralOutOfSync")) + if (typeof message.ephemeralOutOfSync !== "boolean") + return "ephemeralOutOfSync: boolean expected"; + if (message.bizPrivacyStatus != null && message.hasOwnProperty("bizPrivacyStatus")) + switch (message.bizPrivacyStatus) { + default: + return "bizPrivacyStatus: enum value expected"; + case 0: + case 2: + case 1: + case 3: + break; + } + if (message.verifiedBizName != null && message.hasOwnProperty("verifiedBizName")) + if (!$util.isString(message.verifiedBizName)) + return "verifiedBizName: string expected"; + if (message.mediaData != null && message.hasOwnProperty("mediaData")) { + var error = $root.proto.MediaData.verify(message.mediaData); + if (error) + return "mediaData." + error; + } + if (message.photoChange != null && message.hasOwnProperty("photoChange")) { + var error = $root.proto.PhotoChange.verify(message.photoChange); + if (error) + return "photoChange." + error; + } + if (message.userReceipt != null && message.hasOwnProperty("userReceipt")) { + if (!Array.isArray(message.userReceipt)) + return "userReceipt: array expected"; + for (var i = 0; i < message.userReceipt.length; ++i) { + var error = $root.proto.UserReceipt.verify(message.userReceipt[i]); + if (error) + return "userReceipt." + error; + } + } + if (message.reactions != null && message.hasOwnProperty("reactions")) { + if (!Array.isArray(message.reactions)) + return "reactions: array expected"; + for (var i = 0; i < message.reactions.length; ++i) { + var error = $root.proto.Reaction.verify(message.reactions[i]); + if (error) + return "reactions." + error; + } + } + if (message.quotedStickerData != null && message.hasOwnProperty("quotedStickerData")) { + var error = $root.proto.MediaData.verify(message.quotedStickerData); + if (error) + return "quotedStickerData." + error; + } + if (message.futureproofData != null && message.hasOwnProperty("futureproofData")) + if (!(message.futureproofData && typeof message.futureproofData.length === "number" || $util.isString(message.futureproofData))) + return "futureproofData: buffer expected"; + if (message.statusPsa != null && message.hasOwnProperty("statusPsa")) { + var error = $root.proto.StatusPSA.verify(message.statusPsa); + if (error) + return "statusPsa." + error; + } + if (message.pollUpdates != null && message.hasOwnProperty("pollUpdates")) { + if (!Array.isArray(message.pollUpdates)) + return "pollUpdates: array expected"; + for (var i = 0; i < message.pollUpdates.length; ++i) { + var error = $root.proto.PollUpdate.verify(message.pollUpdates[i]); + if (error) + return "pollUpdates." + error; + } + } + if (message.pollAdditionalMetadata != null && message.hasOwnProperty("pollAdditionalMetadata")) { + var error = $root.proto.PollAdditionalMetadata.verify(message.pollAdditionalMetadata); + if (error) + return "pollAdditionalMetadata." + error; + } + if (message.agentId != null && message.hasOwnProperty("agentId")) + if (!$util.isString(message.agentId)) + return "agentId: string expected"; + if (message.statusAlreadyViewed != null && message.hasOwnProperty("statusAlreadyViewed")) + if (typeof message.statusAlreadyViewed !== "boolean") + return "statusAlreadyViewed: boolean expected"; + if (message.messageSecret != null && message.hasOwnProperty("messageSecret")) + if (!(message.messageSecret && typeof message.messageSecret.length === "number" || $util.isString(message.messageSecret))) + return "messageSecret: buffer expected"; + if (message.keepInChat != null && message.hasOwnProperty("keepInChat")) { + var error = $root.proto.KeepInChat.verify(message.keepInChat); + if (error) + return "keepInChat." + error; + } + if (message.originalSelfAuthorUserJidString != null && message.hasOwnProperty("originalSelfAuthorUserJidString")) + if (!$util.isString(message.originalSelfAuthorUserJidString)) + return "originalSelfAuthorUserJidString: string expected"; + if (message.revokeMessageTimestamp != null && message.hasOwnProperty("revokeMessageTimestamp")) + if (!$util.isInteger(message.revokeMessageTimestamp) && !(message.revokeMessageTimestamp && $util.isInteger(message.revokeMessageTimestamp.low) && $util.isInteger(message.revokeMessageTimestamp.high))) + return "revokeMessageTimestamp: integer|Long expected"; + return null; + }; + + /** + * Creates a WebMessageInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.WebMessageInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.WebMessageInfo} WebMessageInfo + */ + WebMessageInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.WebMessageInfo) + return object; + var message = new $root.proto.WebMessageInfo(); + if (object.key != null) { + if (typeof object.key !== "object") + throw TypeError(".proto.WebMessageInfo.key: object expected"); + message.key = $root.proto.MessageKey.fromObject(object.key); + } + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".proto.WebMessageInfo.message: object expected"); + message.message = $root.proto.Message.fromObject(object.message); + } + if (object.messageTimestamp != null) + if ($util.Long) + (message.messageTimestamp = $util.Long.fromValue(object.messageTimestamp)).unsigned = true; + else if (typeof object.messageTimestamp === "string") + message.messageTimestamp = parseInt(object.messageTimestamp, 10); + else if (typeof object.messageTimestamp === "number") + message.messageTimestamp = object.messageTimestamp; + else if (typeof object.messageTimestamp === "object") + message.messageTimestamp = new $util.LongBits(object.messageTimestamp.low >>> 0, object.messageTimestamp.high >>> 0).toNumber(true); + switch (object.status) { + case "ERROR": + case 0: + message.status = 0; + break; + case "PENDING": + case 1: + message.status = 1; + break; + case "SERVER_ACK": + case 2: + message.status = 2; + break; + case "DELIVERY_ACK": + case 3: + message.status = 3; + break; + case "READ": + case 4: + message.status = 4; + break; + case "PLAYED": + case 5: + message.status = 5; + break; + } + if (object.participant != null) + message.participant = String(object.participant); + if (object.messageC2STimestamp != null) + if ($util.Long) + (message.messageC2STimestamp = $util.Long.fromValue(object.messageC2STimestamp)).unsigned = true; + else if (typeof object.messageC2STimestamp === "string") + message.messageC2STimestamp = parseInt(object.messageC2STimestamp, 10); + else if (typeof object.messageC2STimestamp === "number") + message.messageC2STimestamp = object.messageC2STimestamp; + else if (typeof object.messageC2STimestamp === "object") + message.messageC2STimestamp = new $util.LongBits(object.messageC2STimestamp.low >>> 0, object.messageC2STimestamp.high >>> 0).toNumber(true); + if (object.ignore != null) + message.ignore = Boolean(object.ignore); + if (object.starred != null) + message.starred = Boolean(object.starred); + if (object.broadcast != null) + message.broadcast = Boolean(object.broadcast); + if (object.pushName != null) + message.pushName = String(object.pushName); + if (object.mediaCiphertextSha256 != null) + if (typeof object.mediaCiphertextSha256 === "string") + $util.base64.decode(object.mediaCiphertextSha256, message.mediaCiphertextSha256 = $util.newBuffer($util.base64.length(object.mediaCiphertextSha256)), 0); + else if (object.mediaCiphertextSha256.length) + message.mediaCiphertextSha256 = object.mediaCiphertextSha256; + if (object.multicast != null) + message.multicast = Boolean(object.multicast); + if (object.urlText != null) + message.urlText = Boolean(object.urlText); + if (object.urlNumber != null) + message.urlNumber = Boolean(object.urlNumber); + switch (object.messageStubType) { + case "UNKNOWN": + case 0: + message.messageStubType = 0; + break; + case "REVOKE": + case 1: + message.messageStubType = 1; + break; + case "CIPHERTEXT": + case 2: + message.messageStubType = 2; + break; + case "FUTUREPROOF": + case 3: + message.messageStubType = 3; + break; + case "NON_VERIFIED_TRANSITION": + case 4: + message.messageStubType = 4; + break; + case "UNVERIFIED_TRANSITION": + case 5: + message.messageStubType = 5; + break; + case "VERIFIED_TRANSITION": + case 6: + message.messageStubType = 6; + break; + case "VERIFIED_LOW_UNKNOWN": + case 7: + message.messageStubType = 7; + break; + case "VERIFIED_HIGH": + case 8: + message.messageStubType = 8; + break; + case "VERIFIED_INITIAL_UNKNOWN": + case 9: + message.messageStubType = 9; + break; + case "VERIFIED_INITIAL_LOW": + case 10: + message.messageStubType = 10; + break; + case "VERIFIED_INITIAL_HIGH": + case 11: + message.messageStubType = 11; + break; + case "VERIFIED_TRANSITION_ANY_TO_NONE": + case 12: + message.messageStubType = 12; + break; + case "VERIFIED_TRANSITION_ANY_TO_HIGH": + case 13: + message.messageStubType = 13; + break; + case "VERIFIED_TRANSITION_HIGH_TO_LOW": + case 14: + message.messageStubType = 14; + break; + case "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN": + case 15: + message.messageStubType = 15; + break; + case "VERIFIED_TRANSITION_UNKNOWN_TO_LOW": + case 16: + message.messageStubType = 16; + break; + case "VERIFIED_TRANSITION_LOW_TO_UNKNOWN": + case 17: + message.messageStubType = 17; + break; + case "VERIFIED_TRANSITION_NONE_TO_LOW": + case 18: + message.messageStubType = 18; + break; + case "VERIFIED_TRANSITION_NONE_TO_UNKNOWN": + case 19: + message.messageStubType = 19; + break; + case "GROUP_CREATE": + case 20: + message.messageStubType = 20; + break; + case "GROUP_CHANGE_SUBJECT": + case 21: + message.messageStubType = 21; + break; + case "GROUP_CHANGE_ICON": + case 22: + message.messageStubType = 22; + break; + case "GROUP_CHANGE_INVITE_LINK": + case 23: + message.messageStubType = 23; + break; + case "GROUP_CHANGE_DESCRIPTION": + case 24: + message.messageStubType = 24; + break; + case "GROUP_CHANGE_RESTRICT": + case 25: + message.messageStubType = 25; + break; + case "GROUP_CHANGE_ANNOUNCE": + case 26: + message.messageStubType = 26; + break; + case "GROUP_PARTICIPANT_ADD": + case 27: + message.messageStubType = 27; + break; + case "GROUP_PARTICIPANT_REMOVE": + case 28: + message.messageStubType = 28; + break; + case "GROUP_PARTICIPANT_PROMOTE": + case 29: + message.messageStubType = 29; + break; + case "GROUP_PARTICIPANT_DEMOTE": + case 30: + message.messageStubType = 30; + break; + case "GROUP_PARTICIPANT_INVITE": + case 31: + message.messageStubType = 31; + break; + case "GROUP_PARTICIPANT_LEAVE": + case 32: + message.messageStubType = 32; + break; + case "GROUP_PARTICIPANT_CHANGE_NUMBER": + case 33: + message.messageStubType = 33; + break; + case "BROADCAST_CREATE": + case 34: + message.messageStubType = 34; + break; + case "BROADCAST_ADD": + case 35: + message.messageStubType = 35; + break; + case "BROADCAST_REMOVE": + case 36: + message.messageStubType = 36; + break; + case "GENERIC_NOTIFICATION": + case 37: + message.messageStubType = 37; + break; + case "E2E_IDENTITY_CHANGED": + case 38: + message.messageStubType = 38; + break; + case "E2E_ENCRYPTED": + case 39: + message.messageStubType = 39; + break; + case "CALL_MISSED_VOICE": + case 40: + message.messageStubType = 40; + break; + case "CALL_MISSED_VIDEO": + case 41: + message.messageStubType = 41; + break; + case "INDIVIDUAL_CHANGE_NUMBER": + case 42: + message.messageStubType = 42; + break; + case "GROUP_DELETE": + case 43: + message.messageStubType = 43; + break; + case "GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE": + case 44: + message.messageStubType = 44; + break; + case "CALL_MISSED_GROUP_VOICE": + case 45: + message.messageStubType = 45; + break; + case "CALL_MISSED_GROUP_VIDEO": + case 46: + message.messageStubType = 46; + break; + case "PAYMENT_CIPHERTEXT": + case 47: + message.messageStubType = 47; + break; + case "PAYMENT_FUTUREPROOF": + case 48: + message.messageStubType = 48; + break; + case "PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED": + case 49: + message.messageStubType = 49; + break; + case "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED": + case 50: + message.messageStubType = 50; + break; + case "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED": + case 51: + message.messageStubType = 51; + break; + case "PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP": + case 52: + message.messageStubType = 52; + break; + case "PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP": + case 53: + message.messageStubType = 53; + break; + case "PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER": + case 54: + message.messageStubType = 54; + break; + case "PAYMENT_ACTION_SEND_PAYMENT_REMINDER": + case 55: + message.messageStubType = 55; + break; + case "PAYMENT_ACTION_SEND_PAYMENT_INVITATION": + case 56: + message.messageStubType = 56; + break; + case "PAYMENT_ACTION_REQUEST_DECLINED": + case 57: + message.messageStubType = 57; + break; + case "PAYMENT_ACTION_REQUEST_EXPIRED": + case 58: + message.messageStubType = 58; + break; + case "PAYMENT_ACTION_REQUEST_CANCELLED": + case 59: + message.messageStubType = 59; + break; + case "BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM": + case 60: + message.messageStubType = 60; + break; + case "BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP": + case 61: + message.messageStubType = 61; + break; + case "BIZ_INTRO_TOP": + case 62: + message.messageStubType = 62; + break; + case "BIZ_INTRO_BOTTOM": + case 63: + message.messageStubType = 63; + break; + case "BIZ_NAME_CHANGE": + case 64: + message.messageStubType = 64; + break; + case "BIZ_MOVE_TO_CONSUMER_APP": + case 65: + message.messageStubType = 65; + break; + case "BIZ_TWO_TIER_MIGRATION_TOP": + case 66: + message.messageStubType = 66; + break; + case "BIZ_TWO_TIER_MIGRATION_BOTTOM": + case 67: + message.messageStubType = 67; + break; + case "OVERSIZED": + case 68: + message.messageStubType = 68; + break; + case "GROUP_CHANGE_NO_FREQUENTLY_FORWARDED": + case 69: + message.messageStubType = 69; + break; + case "GROUP_V4_ADD_INVITE_SENT": + case 70: + message.messageStubType = 70; + break; + case "GROUP_PARTICIPANT_ADD_REQUEST_JOIN": + case 71: + message.messageStubType = 71; + break; + case "CHANGE_EPHEMERAL_SETTING": + case 72: + message.messageStubType = 72; + break; + case "E2E_DEVICE_CHANGED": + case 73: + message.messageStubType = 73; + break; + case "VIEWED_ONCE": + case 74: + message.messageStubType = 74; + break; + case "E2E_ENCRYPTED_NOW": + case 75: + message.messageStubType = 75; + break; + case "BLUE_MSG_BSP_FB_TO_BSP_PREMISE": + case 76: + message.messageStubType = 76; + break; + case "BLUE_MSG_BSP_FB_TO_SELF_FB": + case 77: + message.messageStubType = 77; + break; + case "BLUE_MSG_BSP_FB_TO_SELF_PREMISE": + case 78: + message.messageStubType = 78; + break; + case "BLUE_MSG_BSP_FB_UNVERIFIED": + case 79: + message.messageStubType = 79; + break; + case "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED": + case 80: + message.messageStubType = 80; + break; + case "BLUE_MSG_BSP_FB_VERIFIED": + case 81: + message.messageStubType = 81; + break; + case "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED": + case 82: + message.messageStubType = 82; + break; + case "BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE": + case 83: + message.messageStubType = 83; + break; + case "BLUE_MSG_BSP_PREMISE_UNVERIFIED": + case 84: + message.messageStubType = 84; + break; + case "BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED": + case 85: + message.messageStubType = 85; + break; + case "BLUE_MSG_BSP_PREMISE_VERIFIED": + case 86: + message.messageStubType = 86; + break; + case "BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED": + case 87: + message.messageStubType = 87; + break; + case "BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED": + case 88: + message.messageStubType = 88; + break; + case "BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED": + case 89: + message.messageStubType = 89; + break; + case "BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED": + case 90: + message.messageStubType = 90; + break; + case "BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED": + case 91: + message.messageStubType = 91; + break; + case "BLUE_MSG_SELF_FB_TO_BSP_PREMISE": + case 92: + message.messageStubType = 92; + break; + case "BLUE_MSG_SELF_FB_TO_SELF_PREMISE": + case 93: + message.messageStubType = 93; + break; + case "BLUE_MSG_SELF_FB_UNVERIFIED": + case 94: + message.messageStubType = 94; + break; + case "BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED": + case 95: + message.messageStubType = 95; + break; + case "BLUE_MSG_SELF_FB_VERIFIED": + case 96: + message.messageStubType = 96; + break; + case "BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED": + case 97: + message.messageStubType = 97; + break; + case "BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE": + case 98: + message.messageStubType = 98; + break; + case "BLUE_MSG_SELF_PREMISE_UNVERIFIED": + case 99: + message.messageStubType = 99; + break; + case "BLUE_MSG_SELF_PREMISE_VERIFIED": + case 100: + message.messageStubType = 100; + break; + case "BLUE_MSG_TO_BSP_FB": + case 101: + message.messageStubType = 101; + break; + case "BLUE_MSG_TO_CONSUMER": + case 102: + message.messageStubType = 102; + break; + case "BLUE_MSG_TO_SELF_FB": + case 103: + message.messageStubType = 103; + break; + case "BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED": + case 104: + message.messageStubType = 104; + break; + case "BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED": + case 105: + message.messageStubType = 105; + break; + case "BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED": + case 106: + message.messageStubType = 106; + break; + case "BLUE_MSG_UNVERIFIED_TO_VERIFIED": + case 107: + message.messageStubType = 107; + break; + case "BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED": + case 108: + message.messageStubType = 108; + break; + case "BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED": + case 109: + message.messageStubType = 109; + break; + case "BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED": + case 110: + message.messageStubType = 110; + break; + case "BLUE_MSG_VERIFIED_TO_UNVERIFIED": + case 111: + message.messageStubType = 111; + break; + case "BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED": + case 112: + message.messageStubType = 112; + break; + case "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED": + case 113: + message.messageStubType = 113; + break; + case "BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED": + case 114: + message.messageStubType = 114; + break; + case "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED": + case 115: + message.messageStubType = 115; + break; + case "BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED": + case 116: + message.messageStubType = 116; + break; + case "BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED": + case 117: + message.messageStubType = 117; + break; + case "E2E_IDENTITY_UNAVAILABLE": + case 118: + message.messageStubType = 118; + break; + case "GROUP_CREATING": + case 119: + message.messageStubType = 119; + break; + case "GROUP_CREATE_FAILED": + case 120: + message.messageStubType = 120; + break; + case "GROUP_BOUNCED": + case 121: + message.messageStubType = 121; + break; + case "BLOCK_CONTACT": + case 122: + message.messageStubType = 122; + break; + case "EPHEMERAL_SETTING_NOT_APPLIED": + case 123: + message.messageStubType = 123; + break; + case "SYNC_FAILED": + case 124: + message.messageStubType = 124; + break; + case "SYNCING": + case 125: + message.messageStubType = 125; + break; + case "BIZ_PRIVACY_MODE_INIT_FB": + case 126: + message.messageStubType = 126; + break; + case "BIZ_PRIVACY_MODE_INIT_BSP": + case 127: + message.messageStubType = 127; + break; + case "BIZ_PRIVACY_MODE_TO_FB": + case 128: + message.messageStubType = 128; + break; + case "BIZ_PRIVACY_MODE_TO_BSP": + case 129: + message.messageStubType = 129; + break; + case "DISAPPEARING_MODE": + case 130: + message.messageStubType = 130; + break; + case "E2E_DEVICE_FETCH_FAILED": + case 131: + message.messageStubType = 131; + break; + case "ADMIN_REVOKE": + case 132: + message.messageStubType = 132; + break; + case "GROUP_INVITE_LINK_GROWTH_LOCKED": + case 133: + message.messageStubType = 133; + break; + case "COMMUNITY_LINK_PARENT_GROUP": + case 134: + message.messageStubType = 134; + break; + case "COMMUNITY_LINK_SIBLING_GROUP": + case 135: + message.messageStubType = 135; + break; + case "COMMUNITY_LINK_SUB_GROUP": + case 136: + message.messageStubType = 136; + break; + case "COMMUNITY_UNLINK_PARENT_GROUP": + case 137: + message.messageStubType = 137; + break; + case "COMMUNITY_UNLINK_SIBLING_GROUP": + case 138: + message.messageStubType = 138; + break; + case "COMMUNITY_UNLINK_SUB_GROUP": + case 139: + message.messageStubType = 139; + break; + case "GROUP_PARTICIPANT_ACCEPT": + case 140: + message.messageStubType = 140; + break; + case "GROUP_PARTICIPANT_LINKED_GROUP_JOIN": + case 141: + message.messageStubType = 141; + break; + case "COMMUNITY_CREATE": + case 142: + message.messageStubType = 142; + break; + case "EPHEMERAL_KEEP_IN_CHAT": + case 143: + message.messageStubType = 143; + break; + case "GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST": + case 144: + message.messageStubType = 144; + break; + case "GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE": + case 145: + message.messageStubType = 145; + break; + case "INTEGRITY_UNLINK_PARENT_GROUP": + case 146: + message.messageStubType = 146; + break; + case "COMMUNITY_PARTICIPANT_PROMOTE": + case 147: + message.messageStubType = 147; + break; + case "COMMUNITY_PARTICIPANT_DEMOTE": + case 148: + message.messageStubType = 148; + break; + case "COMMUNITY_PARENT_GROUP_DELETED": + case 149: + message.messageStubType = 149; + break; + case "COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL": + case 150: + message.messageStubType = 150; + break; + case "GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP": + case 151: + message.messageStubType = 151; + break; + case "MASKED_THREAD_CREATED": + case 152: + message.messageStubType = 152; + break; + case "MASKED_THREAD_UNMASKED": + case 153: + message.messageStubType = 153; + break; + case "BIZ_CHAT_ASSIGNMENT": + case 154: + message.messageStubType = 154; + break; + case "CHAT_PSA": + case 155: + message.messageStubType = 155; + break; + case "CHAT_POLL_CREATION_MESSAGE": + case 156: + message.messageStubType = 156; + break; + case "CAG_MASKED_THREAD_CREATED": + case 157: + message.messageStubType = 157; + break; + case "COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED": + case 158: + message.messageStubType = 158; + break; + case "CAG_INVITE_AUTO_ADD": + case 159: + message.messageStubType = 159; + break; + case "BIZ_CHAT_ASSIGNMENT_UNASSIGN": + case 160: + message.messageStubType = 160; + break; + case "CAG_INVITE_AUTO_JOINED": + case 161: + message.messageStubType = 161; + break; + } + if (object.clearMedia != null) + message.clearMedia = Boolean(object.clearMedia); + if (object.messageStubParameters) { + if (!Array.isArray(object.messageStubParameters)) + throw TypeError(".proto.WebMessageInfo.messageStubParameters: array expected"); + message.messageStubParameters = []; + for (var i = 0; i < object.messageStubParameters.length; ++i) + message.messageStubParameters[i] = String(object.messageStubParameters[i]); + } + if (object.duration != null) + message.duration = object.duration >>> 0; + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".proto.WebMessageInfo.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) + message.labels[i] = String(object.labels[i]); + } + if (object.paymentInfo != null) { + if (typeof object.paymentInfo !== "object") + throw TypeError(".proto.WebMessageInfo.paymentInfo: object expected"); + message.paymentInfo = $root.proto.PaymentInfo.fromObject(object.paymentInfo); + } + if (object.finalLiveLocation != null) { + if (typeof object.finalLiveLocation !== "object") + throw TypeError(".proto.WebMessageInfo.finalLiveLocation: object expected"); + message.finalLiveLocation = $root.proto.Message.LiveLocationMessage.fromObject(object.finalLiveLocation); + } + if (object.quotedPaymentInfo != null) { + if (typeof object.quotedPaymentInfo !== "object") + throw TypeError(".proto.WebMessageInfo.quotedPaymentInfo: object expected"); + message.quotedPaymentInfo = $root.proto.PaymentInfo.fromObject(object.quotedPaymentInfo); + } + if (object.ephemeralStartTimestamp != null) + if ($util.Long) + (message.ephemeralStartTimestamp = $util.Long.fromValue(object.ephemeralStartTimestamp)).unsigned = true; + else if (typeof object.ephemeralStartTimestamp === "string") + message.ephemeralStartTimestamp = parseInt(object.ephemeralStartTimestamp, 10); + else if (typeof object.ephemeralStartTimestamp === "number") + message.ephemeralStartTimestamp = object.ephemeralStartTimestamp; + else if (typeof object.ephemeralStartTimestamp === "object") + message.ephemeralStartTimestamp = new $util.LongBits(object.ephemeralStartTimestamp.low >>> 0, object.ephemeralStartTimestamp.high >>> 0).toNumber(true); + if (object.ephemeralDuration != null) + message.ephemeralDuration = object.ephemeralDuration >>> 0; + if (object.ephemeralOffToOn != null) + message.ephemeralOffToOn = Boolean(object.ephemeralOffToOn); + if (object.ephemeralOutOfSync != null) + message.ephemeralOutOfSync = Boolean(object.ephemeralOutOfSync); + switch (object.bizPrivacyStatus) { + case "E2EE": + case 0: + message.bizPrivacyStatus = 0; + break; + case "FB": + case 2: + message.bizPrivacyStatus = 2; + break; + case "BSP": + case 1: + message.bizPrivacyStatus = 1; + break; + case "BSP_AND_FB": + case 3: + message.bizPrivacyStatus = 3; + break; + } + if (object.verifiedBizName != null) + message.verifiedBizName = String(object.verifiedBizName); + if (object.mediaData != null) { + if (typeof object.mediaData !== "object") + throw TypeError(".proto.WebMessageInfo.mediaData: object expected"); + message.mediaData = $root.proto.MediaData.fromObject(object.mediaData); + } + if (object.photoChange != null) { + if (typeof object.photoChange !== "object") + throw TypeError(".proto.WebMessageInfo.photoChange: object expected"); + message.photoChange = $root.proto.PhotoChange.fromObject(object.photoChange); + } + if (object.userReceipt) { + if (!Array.isArray(object.userReceipt)) + throw TypeError(".proto.WebMessageInfo.userReceipt: array expected"); + message.userReceipt = []; + for (var i = 0; i < object.userReceipt.length; ++i) { + if (typeof object.userReceipt[i] !== "object") + throw TypeError(".proto.WebMessageInfo.userReceipt: object expected"); + message.userReceipt[i] = $root.proto.UserReceipt.fromObject(object.userReceipt[i]); + } + } + if (object.reactions) { + if (!Array.isArray(object.reactions)) + throw TypeError(".proto.WebMessageInfo.reactions: array expected"); + message.reactions = []; + for (var i = 0; i < object.reactions.length; ++i) { + if (typeof object.reactions[i] !== "object") + throw TypeError(".proto.WebMessageInfo.reactions: object expected"); + message.reactions[i] = $root.proto.Reaction.fromObject(object.reactions[i]); + } + } + if (object.quotedStickerData != null) { + if (typeof object.quotedStickerData !== "object") + throw TypeError(".proto.WebMessageInfo.quotedStickerData: object expected"); + message.quotedStickerData = $root.proto.MediaData.fromObject(object.quotedStickerData); + } + if (object.futureproofData != null) + if (typeof object.futureproofData === "string") + $util.base64.decode(object.futureproofData, message.futureproofData = $util.newBuffer($util.base64.length(object.futureproofData)), 0); + else if (object.futureproofData.length) + message.futureproofData = object.futureproofData; + if (object.statusPsa != null) { + if (typeof object.statusPsa !== "object") + throw TypeError(".proto.WebMessageInfo.statusPsa: object expected"); + message.statusPsa = $root.proto.StatusPSA.fromObject(object.statusPsa); + } + if (object.pollUpdates) { + if (!Array.isArray(object.pollUpdates)) + throw TypeError(".proto.WebMessageInfo.pollUpdates: array expected"); + message.pollUpdates = []; + for (var i = 0; i < object.pollUpdates.length; ++i) { + if (typeof object.pollUpdates[i] !== "object") + throw TypeError(".proto.WebMessageInfo.pollUpdates: object expected"); + message.pollUpdates[i] = $root.proto.PollUpdate.fromObject(object.pollUpdates[i]); + } + } + if (object.pollAdditionalMetadata != null) { + if (typeof object.pollAdditionalMetadata !== "object") + throw TypeError(".proto.WebMessageInfo.pollAdditionalMetadata: object expected"); + message.pollAdditionalMetadata = $root.proto.PollAdditionalMetadata.fromObject(object.pollAdditionalMetadata); + } + if (object.agentId != null) + message.agentId = String(object.agentId); + if (object.statusAlreadyViewed != null) + message.statusAlreadyViewed = Boolean(object.statusAlreadyViewed); + if (object.messageSecret != null) + if (typeof object.messageSecret === "string") + $util.base64.decode(object.messageSecret, message.messageSecret = $util.newBuffer($util.base64.length(object.messageSecret)), 0); + else if (object.messageSecret.length) + message.messageSecret = object.messageSecret; + if (object.keepInChat != null) { + if (typeof object.keepInChat !== "object") + throw TypeError(".proto.WebMessageInfo.keepInChat: object expected"); + message.keepInChat = $root.proto.KeepInChat.fromObject(object.keepInChat); + } + if (object.originalSelfAuthorUserJidString != null) + message.originalSelfAuthorUserJidString = String(object.originalSelfAuthorUserJidString); + if (object.revokeMessageTimestamp != null) + if ($util.Long) + (message.revokeMessageTimestamp = $util.Long.fromValue(object.revokeMessageTimestamp)).unsigned = true; + else if (typeof object.revokeMessageTimestamp === "string") + message.revokeMessageTimestamp = parseInt(object.revokeMessageTimestamp, 10); + else if (typeof object.revokeMessageTimestamp === "number") + message.revokeMessageTimestamp = object.revokeMessageTimestamp; + else if (typeof object.revokeMessageTimestamp === "object") + message.revokeMessageTimestamp = new $util.LongBits(object.revokeMessageTimestamp.low >>> 0, object.revokeMessageTimestamp.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a WebMessageInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.WebMessageInfo + * @static + * @param {proto.WebMessageInfo} message WebMessageInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebMessageInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.messageStubParameters = []; + object.labels = []; + object.userReceipt = []; + object.reactions = []; + object.pollUpdates = []; + } + if (options.defaults) { + object.key = null; + object.message = null; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.messageTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.messageTimestamp = options.longs === String ? "0" : 0; + object.status = options.enums === String ? "ERROR" : 0; + object.participant = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.messageC2STimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.messageC2STimestamp = options.longs === String ? "0" : 0; + object.ignore = false; + object.starred = false; + object.broadcast = false; + object.pushName = ""; + if (options.bytes === String) + object.mediaCiphertextSha256 = ""; + else { + object.mediaCiphertextSha256 = []; + if (options.bytes !== Array) + object.mediaCiphertextSha256 = $util.newBuffer(object.mediaCiphertextSha256); + } + object.multicast = false; + object.urlText = false; + object.urlNumber = false; + object.messageStubType = options.enums === String ? "UNKNOWN" : 0; + object.clearMedia = false; + object.duration = 0; + object.paymentInfo = null; + object.finalLiveLocation = null; + object.quotedPaymentInfo = null; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.ephemeralStartTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.ephemeralStartTimestamp = options.longs === String ? "0" : 0; + object.ephemeralDuration = 0; + object.ephemeralOffToOn = false; + object.ephemeralOutOfSync = false; + object.bizPrivacyStatus = options.enums === String ? "E2EE" : 0; + object.verifiedBizName = ""; + object.mediaData = null; + object.photoChange = null; + object.quotedStickerData = null; + if (options.bytes === String) + object.futureproofData = ""; + else { + object.futureproofData = []; + if (options.bytes !== Array) + object.futureproofData = $util.newBuffer(object.futureproofData); + } + object.statusPsa = null; + object.pollAdditionalMetadata = null; + object.agentId = ""; + object.statusAlreadyViewed = false; + if (options.bytes === String) + object.messageSecret = ""; + else { + object.messageSecret = []; + if (options.bytes !== Array) + object.messageSecret = $util.newBuffer(object.messageSecret); + } + object.keepInChat = null; + object.originalSelfAuthorUserJidString = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.revokeMessageTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.revokeMessageTimestamp = options.longs === String ? "0" : 0; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = $root.proto.MessageKey.toObject(message.key, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.proto.Message.toObject(message.message, options); + if (message.messageTimestamp != null && message.hasOwnProperty("messageTimestamp")) + if (typeof message.messageTimestamp === "number") + object.messageTimestamp = options.longs === String ? String(message.messageTimestamp) : message.messageTimestamp; + else + object.messageTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.messageTimestamp) : options.longs === Number ? new $util.LongBits(message.messageTimestamp.low >>> 0, message.messageTimestamp.high >>> 0).toNumber(true) : message.messageTimestamp; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.proto.WebMessageInfo.Status[message.status] : message.status; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.messageC2STimestamp != null && message.hasOwnProperty("messageC2STimestamp")) + if (typeof message.messageC2STimestamp === "number") + object.messageC2STimestamp = options.longs === String ? String(message.messageC2STimestamp) : message.messageC2STimestamp; + else + object.messageC2STimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.messageC2STimestamp) : options.longs === Number ? new $util.LongBits(message.messageC2STimestamp.low >>> 0, message.messageC2STimestamp.high >>> 0).toNumber(true) : message.messageC2STimestamp; + if (message.ignore != null && message.hasOwnProperty("ignore")) + object.ignore = message.ignore; + if (message.starred != null && message.hasOwnProperty("starred")) + object.starred = message.starred; + if (message.broadcast != null && message.hasOwnProperty("broadcast")) + object.broadcast = message.broadcast; + if (message.pushName != null && message.hasOwnProperty("pushName")) + object.pushName = message.pushName; + if (message.mediaCiphertextSha256 != null && message.hasOwnProperty("mediaCiphertextSha256")) + object.mediaCiphertextSha256 = options.bytes === String ? $util.base64.encode(message.mediaCiphertextSha256, 0, message.mediaCiphertextSha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.mediaCiphertextSha256) : message.mediaCiphertextSha256; + if (message.multicast != null && message.hasOwnProperty("multicast")) + object.multicast = message.multicast; + if (message.urlText != null && message.hasOwnProperty("urlText")) + object.urlText = message.urlText; + if (message.urlNumber != null && message.hasOwnProperty("urlNumber")) + object.urlNumber = message.urlNumber; + if (message.messageStubType != null && message.hasOwnProperty("messageStubType")) + object.messageStubType = options.enums === String ? $root.proto.WebMessageInfo.StubType[message.messageStubType] : message.messageStubType; + if (message.clearMedia != null && message.hasOwnProperty("clearMedia")) + object.clearMedia = message.clearMedia; + if (message.messageStubParameters && message.messageStubParameters.length) { + object.messageStubParameters = []; + for (var j = 0; j < message.messageStubParameters.length; ++j) + object.messageStubParameters[j] = message.messageStubParameters[j]; + } + if (message.duration != null && message.hasOwnProperty("duration")) + object.duration = message.duration; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = message.labels[j]; + } + if (message.paymentInfo != null && message.hasOwnProperty("paymentInfo")) + object.paymentInfo = $root.proto.PaymentInfo.toObject(message.paymentInfo, options); + if (message.finalLiveLocation != null && message.hasOwnProperty("finalLiveLocation")) + object.finalLiveLocation = $root.proto.Message.LiveLocationMessage.toObject(message.finalLiveLocation, options); + if (message.quotedPaymentInfo != null && message.hasOwnProperty("quotedPaymentInfo")) + object.quotedPaymentInfo = $root.proto.PaymentInfo.toObject(message.quotedPaymentInfo, options); + if (message.ephemeralStartTimestamp != null && message.hasOwnProperty("ephemeralStartTimestamp")) + if (typeof message.ephemeralStartTimestamp === "number") + object.ephemeralStartTimestamp = options.longs === String ? String(message.ephemeralStartTimestamp) : message.ephemeralStartTimestamp; + else + object.ephemeralStartTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.ephemeralStartTimestamp) : options.longs === Number ? new $util.LongBits(message.ephemeralStartTimestamp.low >>> 0, message.ephemeralStartTimestamp.high >>> 0).toNumber(true) : message.ephemeralStartTimestamp; + if (message.ephemeralDuration != null && message.hasOwnProperty("ephemeralDuration")) + object.ephemeralDuration = message.ephemeralDuration; + if (message.ephemeralOffToOn != null && message.hasOwnProperty("ephemeralOffToOn")) + object.ephemeralOffToOn = message.ephemeralOffToOn; + if (message.ephemeralOutOfSync != null && message.hasOwnProperty("ephemeralOutOfSync")) + object.ephemeralOutOfSync = message.ephemeralOutOfSync; + if (message.bizPrivacyStatus != null && message.hasOwnProperty("bizPrivacyStatus")) + object.bizPrivacyStatus = options.enums === String ? $root.proto.WebMessageInfo.BizPrivacyStatus[message.bizPrivacyStatus] : message.bizPrivacyStatus; + if (message.verifiedBizName != null && message.hasOwnProperty("verifiedBizName")) + object.verifiedBizName = message.verifiedBizName; + if (message.mediaData != null && message.hasOwnProperty("mediaData")) + object.mediaData = $root.proto.MediaData.toObject(message.mediaData, options); + if (message.photoChange != null && message.hasOwnProperty("photoChange")) + object.photoChange = $root.proto.PhotoChange.toObject(message.photoChange, options); + if (message.userReceipt && message.userReceipt.length) { + object.userReceipt = []; + for (var j = 0; j < message.userReceipt.length; ++j) + object.userReceipt[j] = $root.proto.UserReceipt.toObject(message.userReceipt[j], options); + } + if (message.reactions && message.reactions.length) { + object.reactions = []; + for (var j = 0; j < message.reactions.length; ++j) + object.reactions[j] = $root.proto.Reaction.toObject(message.reactions[j], options); + } + if (message.quotedStickerData != null && message.hasOwnProperty("quotedStickerData")) + object.quotedStickerData = $root.proto.MediaData.toObject(message.quotedStickerData, options); + if (message.futureproofData != null && message.hasOwnProperty("futureproofData")) + object.futureproofData = options.bytes === String ? $util.base64.encode(message.futureproofData, 0, message.futureproofData.length) : options.bytes === Array ? Array.prototype.slice.call(message.futureproofData) : message.futureproofData; + if (message.statusPsa != null && message.hasOwnProperty("statusPsa")) + object.statusPsa = $root.proto.StatusPSA.toObject(message.statusPsa, options); + if (message.pollUpdates && message.pollUpdates.length) { + object.pollUpdates = []; + for (var j = 0; j < message.pollUpdates.length; ++j) + object.pollUpdates[j] = $root.proto.PollUpdate.toObject(message.pollUpdates[j], options); + } + if (message.pollAdditionalMetadata != null && message.hasOwnProperty("pollAdditionalMetadata")) + object.pollAdditionalMetadata = $root.proto.PollAdditionalMetadata.toObject(message.pollAdditionalMetadata, options); + if (message.agentId != null && message.hasOwnProperty("agentId")) + object.agentId = message.agentId; + if (message.statusAlreadyViewed != null && message.hasOwnProperty("statusAlreadyViewed")) + object.statusAlreadyViewed = message.statusAlreadyViewed; + if (message.messageSecret != null && message.hasOwnProperty("messageSecret")) + object.messageSecret = options.bytes === String ? $util.base64.encode(message.messageSecret, 0, message.messageSecret.length) : options.bytes === Array ? Array.prototype.slice.call(message.messageSecret) : message.messageSecret; + if (message.keepInChat != null && message.hasOwnProperty("keepInChat")) + object.keepInChat = $root.proto.KeepInChat.toObject(message.keepInChat, options); + if (message.originalSelfAuthorUserJidString != null && message.hasOwnProperty("originalSelfAuthorUserJidString")) + object.originalSelfAuthorUserJidString = message.originalSelfAuthorUserJidString; + if (message.revokeMessageTimestamp != null && message.hasOwnProperty("revokeMessageTimestamp")) + if (typeof message.revokeMessageTimestamp === "number") + object.revokeMessageTimestamp = options.longs === String ? String(message.revokeMessageTimestamp) : message.revokeMessageTimestamp; + else + object.revokeMessageTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.revokeMessageTimestamp) : options.longs === Number ? new $util.LongBits(message.revokeMessageTimestamp.low >>> 0, message.revokeMessageTimestamp.high >>> 0).toNumber(true) : message.revokeMessageTimestamp; + return object; + }; + + /** + * Converts this WebMessageInfo to JSON. + * @function toJSON + * @memberof proto.WebMessageInfo + * @instance + * @returns {Object.} JSON object + */ + WebMessageInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * BizPrivacyStatus enum. + * @name proto.WebMessageInfo.BizPrivacyStatus + * @enum {number} + * @property {number} E2EE=0 E2EE value + * @property {number} FB=2 FB value + * @property {number} BSP=1 BSP value + * @property {number} BSP_AND_FB=3 BSP_AND_FB value + */ + WebMessageInfo.BizPrivacyStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "E2EE"] = 0; + values[valuesById[2] = "FB"] = 2; + values[valuesById[1] = "BSP"] = 1; + values[valuesById[3] = "BSP_AND_FB"] = 3; + return values; + })(); + + /** + * Status enum. + * @name proto.WebMessageInfo.Status + * @enum {number} + * @property {number} ERROR=0 ERROR value + * @property {number} PENDING=1 PENDING value + * @property {number} SERVER_ACK=2 SERVER_ACK value + * @property {number} DELIVERY_ACK=3 DELIVERY_ACK value + * @property {number} READ=4 READ value + * @property {number} PLAYED=5 PLAYED value + */ + WebMessageInfo.Status = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ERROR"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "SERVER_ACK"] = 2; + values[valuesById[3] = "DELIVERY_ACK"] = 3; + values[valuesById[4] = "READ"] = 4; + values[valuesById[5] = "PLAYED"] = 5; + return values; + })(); + + /** + * StubType enum. + * @name proto.WebMessageInfo.StubType + * @enum {number} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} REVOKE=1 REVOKE value + * @property {number} CIPHERTEXT=2 CIPHERTEXT value + * @property {number} FUTUREPROOF=3 FUTUREPROOF value + * @property {number} NON_VERIFIED_TRANSITION=4 NON_VERIFIED_TRANSITION value + * @property {number} UNVERIFIED_TRANSITION=5 UNVERIFIED_TRANSITION value + * @property {number} VERIFIED_TRANSITION=6 VERIFIED_TRANSITION value + * @property {number} VERIFIED_LOW_UNKNOWN=7 VERIFIED_LOW_UNKNOWN value + * @property {number} VERIFIED_HIGH=8 VERIFIED_HIGH value + * @property {number} VERIFIED_INITIAL_UNKNOWN=9 VERIFIED_INITIAL_UNKNOWN value + * @property {number} VERIFIED_INITIAL_LOW=10 VERIFIED_INITIAL_LOW value + * @property {number} VERIFIED_INITIAL_HIGH=11 VERIFIED_INITIAL_HIGH value + * @property {number} VERIFIED_TRANSITION_ANY_TO_NONE=12 VERIFIED_TRANSITION_ANY_TO_NONE value + * @property {number} VERIFIED_TRANSITION_ANY_TO_HIGH=13 VERIFIED_TRANSITION_ANY_TO_HIGH value + * @property {number} VERIFIED_TRANSITION_HIGH_TO_LOW=14 VERIFIED_TRANSITION_HIGH_TO_LOW value + * @property {number} VERIFIED_TRANSITION_HIGH_TO_UNKNOWN=15 VERIFIED_TRANSITION_HIGH_TO_UNKNOWN value + * @property {number} VERIFIED_TRANSITION_UNKNOWN_TO_LOW=16 VERIFIED_TRANSITION_UNKNOWN_TO_LOW value + * @property {number} VERIFIED_TRANSITION_LOW_TO_UNKNOWN=17 VERIFIED_TRANSITION_LOW_TO_UNKNOWN value + * @property {number} VERIFIED_TRANSITION_NONE_TO_LOW=18 VERIFIED_TRANSITION_NONE_TO_LOW value + * @property {number} VERIFIED_TRANSITION_NONE_TO_UNKNOWN=19 VERIFIED_TRANSITION_NONE_TO_UNKNOWN value + * @property {number} GROUP_CREATE=20 GROUP_CREATE value + * @property {number} GROUP_CHANGE_SUBJECT=21 GROUP_CHANGE_SUBJECT value + * @property {number} GROUP_CHANGE_ICON=22 GROUP_CHANGE_ICON value + * @property {number} GROUP_CHANGE_INVITE_LINK=23 GROUP_CHANGE_INVITE_LINK value + * @property {number} GROUP_CHANGE_DESCRIPTION=24 GROUP_CHANGE_DESCRIPTION value + * @property {number} GROUP_CHANGE_RESTRICT=25 GROUP_CHANGE_RESTRICT value + * @property {number} GROUP_CHANGE_ANNOUNCE=26 GROUP_CHANGE_ANNOUNCE value + * @property {number} GROUP_PARTICIPANT_ADD=27 GROUP_PARTICIPANT_ADD value + * @property {number} GROUP_PARTICIPANT_REMOVE=28 GROUP_PARTICIPANT_REMOVE value + * @property {number} GROUP_PARTICIPANT_PROMOTE=29 GROUP_PARTICIPANT_PROMOTE value + * @property {number} GROUP_PARTICIPANT_DEMOTE=30 GROUP_PARTICIPANT_DEMOTE value + * @property {number} GROUP_PARTICIPANT_INVITE=31 GROUP_PARTICIPANT_INVITE value + * @property {number} GROUP_PARTICIPANT_LEAVE=32 GROUP_PARTICIPANT_LEAVE value + * @property {number} GROUP_PARTICIPANT_CHANGE_NUMBER=33 GROUP_PARTICIPANT_CHANGE_NUMBER value + * @property {number} BROADCAST_CREATE=34 BROADCAST_CREATE value + * @property {number} BROADCAST_ADD=35 BROADCAST_ADD value + * @property {number} BROADCAST_REMOVE=36 BROADCAST_REMOVE value + * @property {number} GENERIC_NOTIFICATION=37 GENERIC_NOTIFICATION value + * @property {number} E2E_IDENTITY_CHANGED=38 E2E_IDENTITY_CHANGED value + * @property {number} E2E_ENCRYPTED=39 E2E_ENCRYPTED value + * @property {number} CALL_MISSED_VOICE=40 CALL_MISSED_VOICE value + * @property {number} CALL_MISSED_VIDEO=41 CALL_MISSED_VIDEO value + * @property {number} INDIVIDUAL_CHANGE_NUMBER=42 INDIVIDUAL_CHANGE_NUMBER value + * @property {number} GROUP_DELETE=43 GROUP_DELETE value + * @property {number} GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE=44 GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE value + * @property {number} CALL_MISSED_GROUP_VOICE=45 CALL_MISSED_GROUP_VOICE value + * @property {number} CALL_MISSED_GROUP_VIDEO=46 CALL_MISSED_GROUP_VIDEO value + * @property {number} PAYMENT_CIPHERTEXT=47 PAYMENT_CIPHERTEXT value + * @property {number} PAYMENT_FUTUREPROOF=48 PAYMENT_FUTUREPROOF value + * @property {number} PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED=49 PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED value + * @property {number} PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED=50 PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED value + * @property {number} PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED=51 PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED value + * @property {number} PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP=52 PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP value + * @property {number} PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP=53 PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP value + * @property {number} PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER=54 PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER value + * @property {number} PAYMENT_ACTION_SEND_PAYMENT_REMINDER=55 PAYMENT_ACTION_SEND_PAYMENT_REMINDER value + * @property {number} PAYMENT_ACTION_SEND_PAYMENT_INVITATION=56 PAYMENT_ACTION_SEND_PAYMENT_INVITATION value + * @property {number} PAYMENT_ACTION_REQUEST_DECLINED=57 PAYMENT_ACTION_REQUEST_DECLINED value + * @property {number} PAYMENT_ACTION_REQUEST_EXPIRED=58 PAYMENT_ACTION_REQUEST_EXPIRED value + * @property {number} PAYMENT_ACTION_REQUEST_CANCELLED=59 PAYMENT_ACTION_REQUEST_CANCELLED value + * @property {number} BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM=60 BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM value + * @property {number} BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP=61 BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP value + * @property {number} BIZ_INTRO_TOP=62 BIZ_INTRO_TOP value + * @property {number} BIZ_INTRO_BOTTOM=63 BIZ_INTRO_BOTTOM value + * @property {number} BIZ_NAME_CHANGE=64 BIZ_NAME_CHANGE value + * @property {number} BIZ_MOVE_TO_CONSUMER_APP=65 BIZ_MOVE_TO_CONSUMER_APP value + * @property {number} BIZ_TWO_TIER_MIGRATION_TOP=66 BIZ_TWO_TIER_MIGRATION_TOP value + * @property {number} BIZ_TWO_TIER_MIGRATION_BOTTOM=67 BIZ_TWO_TIER_MIGRATION_BOTTOM value + * @property {number} OVERSIZED=68 OVERSIZED value + * @property {number} GROUP_CHANGE_NO_FREQUENTLY_FORWARDED=69 GROUP_CHANGE_NO_FREQUENTLY_FORWARDED value + * @property {number} GROUP_V4_ADD_INVITE_SENT=70 GROUP_V4_ADD_INVITE_SENT value + * @property {number} GROUP_PARTICIPANT_ADD_REQUEST_JOIN=71 GROUP_PARTICIPANT_ADD_REQUEST_JOIN value + * @property {number} CHANGE_EPHEMERAL_SETTING=72 CHANGE_EPHEMERAL_SETTING value + * @property {number} E2E_DEVICE_CHANGED=73 E2E_DEVICE_CHANGED value + * @property {number} VIEWED_ONCE=74 VIEWED_ONCE value + * @property {number} E2E_ENCRYPTED_NOW=75 E2E_ENCRYPTED_NOW value + * @property {number} BLUE_MSG_BSP_FB_TO_BSP_PREMISE=76 BLUE_MSG_BSP_FB_TO_BSP_PREMISE value + * @property {number} BLUE_MSG_BSP_FB_TO_SELF_FB=77 BLUE_MSG_BSP_FB_TO_SELF_FB value + * @property {number} BLUE_MSG_BSP_FB_TO_SELF_PREMISE=78 BLUE_MSG_BSP_FB_TO_SELF_PREMISE value + * @property {number} BLUE_MSG_BSP_FB_UNVERIFIED=79 BLUE_MSG_BSP_FB_UNVERIFIED value + * @property {number} BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED=80 BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_BSP_FB_VERIFIED=81 BLUE_MSG_BSP_FB_VERIFIED value + * @property {number} BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED=82 BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE=83 BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE value + * @property {number} BLUE_MSG_BSP_PREMISE_UNVERIFIED=84 BLUE_MSG_BSP_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED=85 BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_BSP_PREMISE_VERIFIED=86 BLUE_MSG_BSP_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED=87 BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED=88 BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED value + * @property {number} BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED=89 BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED=90 BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED value + * @property {number} BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED=91 BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_SELF_FB_TO_BSP_PREMISE=92 BLUE_MSG_SELF_FB_TO_BSP_PREMISE value + * @property {number} BLUE_MSG_SELF_FB_TO_SELF_PREMISE=93 BLUE_MSG_SELF_FB_TO_SELF_PREMISE value + * @property {number} BLUE_MSG_SELF_FB_UNVERIFIED=94 BLUE_MSG_SELF_FB_UNVERIFIED value + * @property {number} BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED=95 BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_SELF_FB_VERIFIED=96 BLUE_MSG_SELF_FB_VERIFIED value + * @property {number} BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED=97 BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE=98 BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE value + * @property {number} BLUE_MSG_SELF_PREMISE_UNVERIFIED=99 BLUE_MSG_SELF_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_SELF_PREMISE_VERIFIED=100 BLUE_MSG_SELF_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_TO_BSP_FB=101 BLUE_MSG_TO_BSP_FB value + * @property {number} BLUE_MSG_TO_CONSUMER=102 BLUE_MSG_TO_CONSUMER value + * @property {number} BLUE_MSG_TO_SELF_FB=103 BLUE_MSG_TO_SELF_FB value + * @property {number} BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED=104 BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED value + * @property {number} BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED=105 BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED=106 BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED value + * @property {number} BLUE_MSG_UNVERIFIED_TO_VERIFIED=107 BLUE_MSG_UNVERIFIED_TO_VERIFIED value + * @property {number} BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED=108 BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED value + * @property {number} BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED=109 BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED=110 BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED value + * @property {number} BLUE_MSG_VERIFIED_TO_UNVERIFIED=111 BLUE_MSG_VERIFIED_TO_UNVERIFIED value + * @property {number} BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED=112 BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED=113 BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED value + * @property {number} BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED=114 BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED value + * @property {number} BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED=115 BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED value + * @property {number} BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED=116 BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED value + * @property {number} BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED=117 BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED value + * @property {number} E2E_IDENTITY_UNAVAILABLE=118 E2E_IDENTITY_UNAVAILABLE value + * @property {number} GROUP_CREATING=119 GROUP_CREATING value + * @property {number} GROUP_CREATE_FAILED=120 GROUP_CREATE_FAILED value + * @property {number} GROUP_BOUNCED=121 GROUP_BOUNCED value + * @property {number} BLOCK_CONTACT=122 BLOCK_CONTACT value + * @property {number} EPHEMERAL_SETTING_NOT_APPLIED=123 EPHEMERAL_SETTING_NOT_APPLIED value + * @property {number} SYNC_FAILED=124 SYNC_FAILED value + * @property {number} SYNCING=125 SYNCING value + * @property {number} BIZ_PRIVACY_MODE_INIT_FB=126 BIZ_PRIVACY_MODE_INIT_FB value + * @property {number} BIZ_PRIVACY_MODE_INIT_BSP=127 BIZ_PRIVACY_MODE_INIT_BSP value + * @property {number} BIZ_PRIVACY_MODE_TO_FB=128 BIZ_PRIVACY_MODE_TO_FB value + * @property {number} BIZ_PRIVACY_MODE_TO_BSP=129 BIZ_PRIVACY_MODE_TO_BSP value + * @property {number} DISAPPEARING_MODE=130 DISAPPEARING_MODE value + * @property {number} E2E_DEVICE_FETCH_FAILED=131 E2E_DEVICE_FETCH_FAILED value + * @property {number} ADMIN_REVOKE=132 ADMIN_REVOKE value + * @property {number} GROUP_INVITE_LINK_GROWTH_LOCKED=133 GROUP_INVITE_LINK_GROWTH_LOCKED value + * @property {number} COMMUNITY_LINK_PARENT_GROUP=134 COMMUNITY_LINK_PARENT_GROUP value + * @property {number} COMMUNITY_LINK_SIBLING_GROUP=135 COMMUNITY_LINK_SIBLING_GROUP value + * @property {number} COMMUNITY_LINK_SUB_GROUP=136 COMMUNITY_LINK_SUB_GROUP value + * @property {number} COMMUNITY_UNLINK_PARENT_GROUP=137 COMMUNITY_UNLINK_PARENT_GROUP value + * @property {number} COMMUNITY_UNLINK_SIBLING_GROUP=138 COMMUNITY_UNLINK_SIBLING_GROUP value + * @property {number} COMMUNITY_UNLINK_SUB_GROUP=139 COMMUNITY_UNLINK_SUB_GROUP value + * @property {number} GROUP_PARTICIPANT_ACCEPT=140 GROUP_PARTICIPANT_ACCEPT value + * @property {number} GROUP_PARTICIPANT_LINKED_GROUP_JOIN=141 GROUP_PARTICIPANT_LINKED_GROUP_JOIN value + * @property {number} COMMUNITY_CREATE=142 COMMUNITY_CREATE value + * @property {number} EPHEMERAL_KEEP_IN_CHAT=143 EPHEMERAL_KEEP_IN_CHAT value + * @property {number} GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST=144 GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST value + * @property {number} GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE=145 GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE value + * @property {number} INTEGRITY_UNLINK_PARENT_GROUP=146 INTEGRITY_UNLINK_PARENT_GROUP value + * @property {number} COMMUNITY_PARTICIPANT_PROMOTE=147 COMMUNITY_PARTICIPANT_PROMOTE value + * @property {number} COMMUNITY_PARTICIPANT_DEMOTE=148 COMMUNITY_PARTICIPANT_DEMOTE value + * @property {number} COMMUNITY_PARENT_GROUP_DELETED=149 COMMUNITY_PARENT_GROUP_DELETED value + * @property {number} COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL=150 COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL value + * @property {number} GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP=151 GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP value + * @property {number} MASKED_THREAD_CREATED=152 MASKED_THREAD_CREATED value + * @property {number} MASKED_THREAD_UNMASKED=153 MASKED_THREAD_UNMASKED value + * @property {number} BIZ_CHAT_ASSIGNMENT=154 BIZ_CHAT_ASSIGNMENT value + * @property {number} CHAT_PSA=155 CHAT_PSA value + * @property {number} CHAT_POLL_CREATION_MESSAGE=156 CHAT_POLL_CREATION_MESSAGE value + * @property {number} CAG_MASKED_THREAD_CREATED=157 CAG_MASKED_THREAD_CREATED value + * @property {number} COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED=158 COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED value + * @property {number} CAG_INVITE_AUTO_ADD=159 CAG_INVITE_AUTO_ADD value + * @property {number} BIZ_CHAT_ASSIGNMENT_UNASSIGN=160 BIZ_CHAT_ASSIGNMENT_UNASSIGN value + * @property {number} CAG_INVITE_AUTO_JOINED=161 CAG_INVITE_AUTO_JOINED value + */ + WebMessageInfo.StubType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "REVOKE"] = 1; + values[valuesById[2] = "CIPHERTEXT"] = 2; + values[valuesById[3] = "FUTUREPROOF"] = 3; + values[valuesById[4] = "NON_VERIFIED_TRANSITION"] = 4; + values[valuesById[5] = "UNVERIFIED_TRANSITION"] = 5; + values[valuesById[6] = "VERIFIED_TRANSITION"] = 6; + values[valuesById[7] = "VERIFIED_LOW_UNKNOWN"] = 7; + values[valuesById[8] = "VERIFIED_HIGH"] = 8; + values[valuesById[9] = "VERIFIED_INITIAL_UNKNOWN"] = 9; + values[valuesById[10] = "VERIFIED_INITIAL_LOW"] = 10; + values[valuesById[11] = "VERIFIED_INITIAL_HIGH"] = 11; + values[valuesById[12] = "VERIFIED_TRANSITION_ANY_TO_NONE"] = 12; + values[valuesById[13] = "VERIFIED_TRANSITION_ANY_TO_HIGH"] = 13; + values[valuesById[14] = "VERIFIED_TRANSITION_HIGH_TO_LOW"] = 14; + values[valuesById[15] = "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN"] = 15; + values[valuesById[16] = "VERIFIED_TRANSITION_UNKNOWN_TO_LOW"] = 16; + values[valuesById[17] = "VERIFIED_TRANSITION_LOW_TO_UNKNOWN"] = 17; + values[valuesById[18] = "VERIFIED_TRANSITION_NONE_TO_LOW"] = 18; + values[valuesById[19] = "VERIFIED_TRANSITION_NONE_TO_UNKNOWN"] = 19; + values[valuesById[20] = "GROUP_CREATE"] = 20; + values[valuesById[21] = "GROUP_CHANGE_SUBJECT"] = 21; + values[valuesById[22] = "GROUP_CHANGE_ICON"] = 22; + values[valuesById[23] = "GROUP_CHANGE_INVITE_LINK"] = 23; + values[valuesById[24] = "GROUP_CHANGE_DESCRIPTION"] = 24; + values[valuesById[25] = "GROUP_CHANGE_RESTRICT"] = 25; + values[valuesById[26] = "GROUP_CHANGE_ANNOUNCE"] = 26; + values[valuesById[27] = "GROUP_PARTICIPANT_ADD"] = 27; + values[valuesById[28] = "GROUP_PARTICIPANT_REMOVE"] = 28; + values[valuesById[29] = "GROUP_PARTICIPANT_PROMOTE"] = 29; + values[valuesById[30] = "GROUP_PARTICIPANT_DEMOTE"] = 30; + values[valuesById[31] = "GROUP_PARTICIPANT_INVITE"] = 31; + values[valuesById[32] = "GROUP_PARTICIPANT_LEAVE"] = 32; + values[valuesById[33] = "GROUP_PARTICIPANT_CHANGE_NUMBER"] = 33; + values[valuesById[34] = "BROADCAST_CREATE"] = 34; + values[valuesById[35] = "BROADCAST_ADD"] = 35; + values[valuesById[36] = "BROADCAST_REMOVE"] = 36; + values[valuesById[37] = "GENERIC_NOTIFICATION"] = 37; + values[valuesById[38] = "E2E_IDENTITY_CHANGED"] = 38; + values[valuesById[39] = "E2E_ENCRYPTED"] = 39; + values[valuesById[40] = "CALL_MISSED_VOICE"] = 40; + values[valuesById[41] = "CALL_MISSED_VIDEO"] = 41; + values[valuesById[42] = "INDIVIDUAL_CHANGE_NUMBER"] = 42; + values[valuesById[43] = "GROUP_DELETE"] = 43; + values[valuesById[44] = "GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE"] = 44; + values[valuesById[45] = "CALL_MISSED_GROUP_VOICE"] = 45; + values[valuesById[46] = "CALL_MISSED_GROUP_VIDEO"] = 46; + values[valuesById[47] = "PAYMENT_CIPHERTEXT"] = 47; + values[valuesById[48] = "PAYMENT_FUTUREPROOF"] = 48; + values[valuesById[49] = "PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED"] = 49; + values[valuesById[50] = "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED"] = 50; + values[valuesById[51] = "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED"] = 51; + values[valuesById[52] = "PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP"] = 52; + values[valuesById[53] = "PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP"] = 53; + values[valuesById[54] = "PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER"] = 54; + values[valuesById[55] = "PAYMENT_ACTION_SEND_PAYMENT_REMINDER"] = 55; + values[valuesById[56] = "PAYMENT_ACTION_SEND_PAYMENT_INVITATION"] = 56; + values[valuesById[57] = "PAYMENT_ACTION_REQUEST_DECLINED"] = 57; + values[valuesById[58] = "PAYMENT_ACTION_REQUEST_EXPIRED"] = 58; + values[valuesById[59] = "PAYMENT_ACTION_REQUEST_CANCELLED"] = 59; + values[valuesById[60] = "BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM"] = 60; + values[valuesById[61] = "BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP"] = 61; + values[valuesById[62] = "BIZ_INTRO_TOP"] = 62; + values[valuesById[63] = "BIZ_INTRO_BOTTOM"] = 63; + values[valuesById[64] = "BIZ_NAME_CHANGE"] = 64; + values[valuesById[65] = "BIZ_MOVE_TO_CONSUMER_APP"] = 65; + values[valuesById[66] = "BIZ_TWO_TIER_MIGRATION_TOP"] = 66; + values[valuesById[67] = "BIZ_TWO_TIER_MIGRATION_BOTTOM"] = 67; + values[valuesById[68] = "OVERSIZED"] = 68; + values[valuesById[69] = "GROUP_CHANGE_NO_FREQUENTLY_FORWARDED"] = 69; + values[valuesById[70] = "GROUP_V4_ADD_INVITE_SENT"] = 70; + values[valuesById[71] = "GROUP_PARTICIPANT_ADD_REQUEST_JOIN"] = 71; + values[valuesById[72] = "CHANGE_EPHEMERAL_SETTING"] = 72; + values[valuesById[73] = "E2E_DEVICE_CHANGED"] = 73; + values[valuesById[74] = "VIEWED_ONCE"] = 74; + values[valuesById[75] = "E2E_ENCRYPTED_NOW"] = 75; + values[valuesById[76] = "BLUE_MSG_BSP_FB_TO_BSP_PREMISE"] = 76; + values[valuesById[77] = "BLUE_MSG_BSP_FB_TO_SELF_FB"] = 77; + values[valuesById[78] = "BLUE_MSG_BSP_FB_TO_SELF_PREMISE"] = 78; + values[valuesById[79] = "BLUE_MSG_BSP_FB_UNVERIFIED"] = 79; + values[valuesById[80] = "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED"] = 80; + values[valuesById[81] = "BLUE_MSG_BSP_FB_VERIFIED"] = 81; + values[valuesById[82] = "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED"] = 82; + values[valuesById[83] = "BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE"] = 83; + values[valuesById[84] = "BLUE_MSG_BSP_PREMISE_UNVERIFIED"] = 84; + values[valuesById[85] = "BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED"] = 85; + values[valuesById[86] = "BLUE_MSG_BSP_PREMISE_VERIFIED"] = 86; + values[valuesById[87] = "BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED"] = 87; + values[valuesById[88] = "BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED"] = 88; + values[valuesById[89] = "BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED"] = 89; + values[valuesById[90] = "BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED"] = 90; + values[valuesById[91] = "BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED"] = 91; + values[valuesById[92] = "BLUE_MSG_SELF_FB_TO_BSP_PREMISE"] = 92; + values[valuesById[93] = "BLUE_MSG_SELF_FB_TO_SELF_PREMISE"] = 93; + values[valuesById[94] = "BLUE_MSG_SELF_FB_UNVERIFIED"] = 94; + values[valuesById[95] = "BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED"] = 95; + values[valuesById[96] = "BLUE_MSG_SELF_FB_VERIFIED"] = 96; + values[valuesById[97] = "BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED"] = 97; + values[valuesById[98] = "BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE"] = 98; + values[valuesById[99] = "BLUE_MSG_SELF_PREMISE_UNVERIFIED"] = 99; + values[valuesById[100] = "BLUE_MSG_SELF_PREMISE_VERIFIED"] = 100; + values[valuesById[101] = "BLUE_MSG_TO_BSP_FB"] = 101; + values[valuesById[102] = "BLUE_MSG_TO_CONSUMER"] = 102; + values[valuesById[103] = "BLUE_MSG_TO_SELF_FB"] = 103; + values[valuesById[104] = "BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED"] = 104; + values[valuesById[105] = "BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED"] = 105; + values[valuesById[106] = "BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED"] = 106; + values[valuesById[107] = "BLUE_MSG_UNVERIFIED_TO_VERIFIED"] = 107; + values[valuesById[108] = "BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED"] = 108; + values[valuesById[109] = "BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED"] = 109; + values[valuesById[110] = "BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED"] = 110; + values[valuesById[111] = "BLUE_MSG_VERIFIED_TO_UNVERIFIED"] = 111; + values[valuesById[112] = "BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED"] = 112; + values[valuesById[113] = "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED"] = 113; + values[valuesById[114] = "BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED"] = 114; + values[valuesById[115] = "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED"] = 115; + values[valuesById[116] = "BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED"] = 116; + values[valuesById[117] = "BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED"] = 117; + values[valuesById[118] = "E2E_IDENTITY_UNAVAILABLE"] = 118; + values[valuesById[119] = "GROUP_CREATING"] = 119; + values[valuesById[120] = "GROUP_CREATE_FAILED"] = 120; + values[valuesById[121] = "GROUP_BOUNCED"] = 121; + values[valuesById[122] = "BLOCK_CONTACT"] = 122; + values[valuesById[123] = "EPHEMERAL_SETTING_NOT_APPLIED"] = 123; + values[valuesById[124] = "SYNC_FAILED"] = 124; + values[valuesById[125] = "SYNCING"] = 125; + values[valuesById[126] = "BIZ_PRIVACY_MODE_INIT_FB"] = 126; + values[valuesById[127] = "BIZ_PRIVACY_MODE_INIT_BSP"] = 127; + values[valuesById[128] = "BIZ_PRIVACY_MODE_TO_FB"] = 128; + values[valuesById[129] = "BIZ_PRIVACY_MODE_TO_BSP"] = 129; + values[valuesById[130] = "DISAPPEARING_MODE"] = 130; + values[valuesById[131] = "E2E_DEVICE_FETCH_FAILED"] = 131; + values[valuesById[132] = "ADMIN_REVOKE"] = 132; + values[valuesById[133] = "GROUP_INVITE_LINK_GROWTH_LOCKED"] = 133; + values[valuesById[134] = "COMMUNITY_LINK_PARENT_GROUP"] = 134; + values[valuesById[135] = "COMMUNITY_LINK_SIBLING_GROUP"] = 135; + values[valuesById[136] = "COMMUNITY_LINK_SUB_GROUP"] = 136; + values[valuesById[137] = "COMMUNITY_UNLINK_PARENT_GROUP"] = 137; + values[valuesById[138] = "COMMUNITY_UNLINK_SIBLING_GROUP"] = 138; + values[valuesById[139] = "COMMUNITY_UNLINK_SUB_GROUP"] = 139; + values[valuesById[140] = "GROUP_PARTICIPANT_ACCEPT"] = 140; + values[valuesById[141] = "GROUP_PARTICIPANT_LINKED_GROUP_JOIN"] = 141; + values[valuesById[142] = "COMMUNITY_CREATE"] = 142; + values[valuesById[143] = "EPHEMERAL_KEEP_IN_CHAT"] = 143; + values[valuesById[144] = "GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST"] = 144; + values[valuesById[145] = "GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE"] = 145; + values[valuesById[146] = "INTEGRITY_UNLINK_PARENT_GROUP"] = 146; + values[valuesById[147] = "COMMUNITY_PARTICIPANT_PROMOTE"] = 147; + values[valuesById[148] = "COMMUNITY_PARTICIPANT_DEMOTE"] = 148; + values[valuesById[149] = "COMMUNITY_PARENT_GROUP_DELETED"] = 149; + values[valuesById[150] = "COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL"] = 150; + values[valuesById[151] = "GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP"] = 151; + values[valuesById[152] = "MASKED_THREAD_CREATED"] = 152; + values[valuesById[153] = "MASKED_THREAD_UNMASKED"] = 153; + values[valuesById[154] = "BIZ_CHAT_ASSIGNMENT"] = 154; + values[valuesById[155] = "CHAT_PSA"] = 155; + values[valuesById[156] = "CHAT_POLL_CREATION_MESSAGE"] = 156; + values[valuesById[157] = "CAG_MASKED_THREAD_CREATED"] = 157; + values[valuesById[158] = "COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED"] = 158; + values[valuesById[159] = "CAG_INVITE_AUTO_ADD"] = 159; + values[valuesById[160] = "BIZ_CHAT_ASSIGNMENT_UNASSIGN"] = 160; + values[valuesById[161] = "CAG_INVITE_AUTO_JOINED"] = 161; + return values; + })(); + + return WebMessageInfo; + })(); + + proto.WebNotificationsInfo = (function() { + + /** + * Properties of a WebNotificationsInfo. + * @memberof proto + * @interface IWebNotificationsInfo + * @property {number|Long|null} [timestamp] WebNotificationsInfo timestamp + * @property {number|null} [unreadChats] WebNotificationsInfo unreadChats + * @property {number|null} [notifyMessageCount] WebNotificationsInfo notifyMessageCount + * @property {Array.|null} [notifyMessages] WebNotificationsInfo notifyMessages + */ + + /** + * Constructs a new WebNotificationsInfo. + * @memberof proto + * @classdesc Represents a WebNotificationsInfo. + * @implements IWebNotificationsInfo + * @constructor + * @param {proto.IWebNotificationsInfo=} [properties] Properties to set + */ + function WebNotificationsInfo(properties) { + this.notifyMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebNotificationsInfo timestamp. + * @member {number|Long} timestamp + * @memberof proto.WebNotificationsInfo + * @instance + */ + WebNotificationsInfo.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * WebNotificationsInfo unreadChats. + * @member {number} unreadChats + * @memberof proto.WebNotificationsInfo + * @instance + */ + WebNotificationsInfo.prototype.unreadChats = 0; + + /** + * WebNotificationsInfo notifyMessageCount. + * @member {number} notifyMessageCount + * @memberof proto.WebNotificationsInfo + * @instance + */ + WebNotificationsInfo.prototype.notifyMessageCount = 0; + + /** + * WebNotificationsInfo notifyMessages. + * @member {Array.} notifyMessages + * @memberof proto.WebNotificationsInfo + * @instance + */ + WebNotificationsInfo.prototype.notifyMessages = $util.emptyArray; + + /** + * Creates a new WebNotificationsInfo instance using the specified properties. + * @function create + * @memberof proto.WebNotificationsInfo + * @static + * @param {proto.IWebNotificationsInfo=} [properties] Properties to set + * @returns {proto.WebNotificationsInfo} WebNotificationsInfo instance + */ + WebNotificationsInfo.create = function create(properties) { + return new WebNotificationsInfo(properties); + }; + + /** + * Encodes the specified WebNotificationsInfo message. Does not implicitly {@link proto.WebNotificationsInfo.verify|verify} messages. + * @function encode + * @memberof proto.WebNotificationsInfo + * @static + * @param {proto.IWebNotificationsInfo} message WebNotificationsInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebNotificationsInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.timestamp); + if (message.unreadChats != null && Object.hasOwnProperty.call(message, "unreadChats")) + writer.uint32(/* id 3, wireType 0 =*/24).uint32(message.unreadChats); + if (message.notifyMessageCount != null && Object.hasOwnProperty.call(message, "notifyMessageCount")) + writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.notifyMessageCount); + if (message.notifyMessages != null && message.notifyMessages.length) + for (var i = 0; i < message.notifyMessages.length; ++i) + $root.proto.WebMessageInfo.encode(message.notifyMessages[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WebNotificationsInfo message, length delimited. Does not implicitly {@link proto.WebNotificationsInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof proto.WebNotificationsInfo + * @static + * @param {proto.IWebNotificationsInfo} message WebNotificationsInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebNotificationsInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebNotificationsInfo message from the specified reader or buffer. + * @function decode + * @memberof proto.WebNotificationsInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {proto.WebNotificationsInfo} WebNotificationsInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebNotificationsInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.WebNotificationsInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.timestamp = reader.uint64(); + break; + case 3: + message.unreadChats = reader.uint32(); + break; + case 4: + message.notifyMessageCount = reader.uint32(); + break; + case 5: + if (!(message.notifyMessages && message.notifyMessages.length)) + message.notifyMessages = []; + message.notifyMessages.push($root.proto.WebMessageInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebNotificationsInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof proto.WebNotificationsInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {proto.WebNotificationsInfo} WebNotificationsInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebNotificationsInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebNotificationsInfo message. + * @function verify + * @memberof proto.WebNotificationsInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebNotificationsInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high))) + return "timestamp: integer|Long expected"; + if (message.unreadChats != null && message.hasOwnProperty("unreadChats")) + if (!$util.isInteger(message.unreadChats)) + return "unreadChats: integer expected"; + if (message.notifyMessageCount != null && message.hasOwnProperty("notifyMessageCount")) + if (!$util.isInteger(message.notifyMessageCount)) + return "notifyMessageCount: integer expected"; + if (message.notifyMessages != null && message.hasOwnProperty("notifyMessages")) { + if (!Array.isArray(message.notifyMessages)) + return "notifyMessages: array expected"; + for (var i = 0; i < message.notifyMessages.length; ++i) { + var error = $root.proto.WebMessageInfo.verify(message.notifyMessages[i]); + if (error) + return "notifyMessages." + error; + } + } + return null; + }; + + /** + * Creates a WebNotificationsInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof proto.WebNotificationsInfo + * @static + * @param {Object.} object Plain object + * @returns {proto.WebNotificationsInfo} WebNotificationsInfo + */ + WebNotificationsInfo.fromObject = function fromObject(object) { + if (object instanceof $root.proto.WebNotificationsInfo) + return object; + var message = new $root.proto.WebNotificationsInfo(); + if (object.timestamp != null) + if ($util.Long) + (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true; + else if (typeof object.timestamp === "string") + message.timestamp = parseInt(object.timestamp, 10); + else if (typeof object.timestamp === "number") + message.timestamp = object.timestamp; + else if (typeof object.timestamp === "object") + message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true); + if (object.unreadChats != null) + message.unreadChats = object.unreadChats >>> 0; + if (object.notifyMessageCount != null) + message.notifyMessageCount = object.notifyMessageCount >>> 0; + if (object.notifyMessages) { + if (!Array.isArray(object.notifyMessages)) + throw TypeError(".proto.WebNotificationsInfo.notifyMessages: array expected"); + message.notifyMessages = []; + for (var i = 0; i < object.notifyMessages.length; ++i) { + if (typeof object.notifyMessages[i] !== "object") + throw TypeError(".proto.WebNotificationsInfo.notifyMessages: object expected"); + message.notifyMessages[i] = $root.proto.WebMessageInfo.fromObject(object.notifyMessages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a WebNotificationsInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof proto.WebNotificationsInfo + * @static + * @param {proto.WebNotificationsInfo} message WebNotificationsInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebNotificationsInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.notifyMessages = []; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.timestamp = options.longs === String ? "0" : 0; + object.unreadChats = 0; + object.notifyMessageCount = 0; + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + if (typeof message.timestamp === "number") + object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp; + else + object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp; + if (message.unreadChats != null && message.hasOwnProperty("unreadChats")) + object.unreadChats = message.unreadChats; + if (message.notifyMessageCount != null && message.hasOwnProperty("notifyMessageCount")) + object.notifyMessageCount = message.notifyMessageCount; + if (message.notifyMessages && message.notifyMessages.length) { + object.notifyMessages = []; + for (var j = 0; j < message.notifyMessages.length; ++j) + object.notifyMessages[j] = $root.proto.WebMessageInfo.toObject(message.notifyMessages[j], options); + } + return object; + }; + + /** + * Converts this WebNotificationsInfo to JSON. + * @function toJSON + * @memberof proto.WebNotificationsInfo + * @instance + * @returns {Object.} JSON object + */ + WebNotificationsInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WebNotificationsInfo; + })(); + + return proto; +})(); + +module.exports = $root; diff --git a/WASignalGroup/GroupProtocol.js b/WASignalGroup/GroupProtocol.js new file mode 100644 index 00000000000..efa722a9e32 --- /dev/null +++ b/WASignalGroup/GroupProtocol.js @@ -0,0 +1,1697 @@ +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.groupproto = (function() { + + /** + * Namespace groupproto. + * @exports groupproto + * @namespace + */ + var groupproto = {}; + + groupproto.SenderKeyMessage = (function() { + + /** + * Properties of a SenderKeyMessage. + * @memberof groupproto + * @interface ISenderKeyMessage + * @property {number|null} [id] SenderKeyMessage id + * @property {number|null} [iteration] SenderKeyMessage iteration + * @property {Uint8Array|null} [ciphertext] SenderKeyMessage ciphertext + */ + + /** + * Constructs a new SenderKeyMessage. + * @memberof groupproto + * @classdesc Represents a SenderKeyMessage. + * @implements ISenderKeyMessage + * @constructor + * @param {groupproto.ISenderKeyMessage=} [properties] Properties to set + */ + function SenderKeyMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyMessage id. + * @member {number} id + * @memberof groupproto.SenderKeyMessage + * @instance + */ + SenderKeyMessage.prototype.id = 0; + + /** + * SenderKeyMessage iteration. + * @member {number} iteration + * @memberof groupproto.SenderKeyMessage + * @instance + */ + SenderKeyMessage.prototype.iteration = 0; + + /** + * SenderKeyMessage ciphertext. + * @member {Uint8Array} ciphertext + * @memberof groupproto.SenderKeyMessage + * @instance + */ + SenderKeyMessage.prototype.ciphertext = $util.newBuffer([]); + + /** + * Creates a new SenderKeyMessage instance using the specified properties. + * @function create + * @memberof groupproto.SenderKeyMessage + * @static + * @param {groupproto.ISenderKeyMessage=} [properties] Properties to set + * @returns {groupproto.SenderKeyMessage} SenderKeyMessage instance + */ + SenderKeyMessage.create = function create(properties) { + return new SenderKeyMessage(properties); + }; + + /** + * Encodes the specified SenderKeyMessage message. Does not implicitly {@link groupproto.SenderKeyMessage.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderKeyMessage + * @static + * @param {groupproto.ISenderKeyMessage} message SenderKeyMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.id); + if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.iteration); + if (message.ciphertext != null && Object.hasOwnProperty.call(message, "ciphertext")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.ciphertext); + return writer; + }; + + /** + * Encodes the specified SenderKeyMessage message, length delimited. Does not implicitly {@link groupproto.SenderKeyMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderKeyMessage + * @static + * @param {groupproto.ISenderKeyMessage} message SenderKeyMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyMessage message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderKeyMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderKeyMessage} SenderKeyMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderKeyMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.iteration = reader.uint32(); + break; + case 3: + message.ciphertext = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderKeyMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderKeyMessage} SenderKeyMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyMessage message. + * @function verify + * @memberof groupproto.SenderKeyMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + if (message.iteration != null && message.hasOwnProperty("iteration")) + if (!$util.isInteger(message.iteration)) + return "iteration: integer expected"; + if (message.ciphertext != null && message.hasOwnProperty("ciphertext")) + if (!(message.ciphertext && typeof message.ciphertext.length === "number" || $util.isString(message.ciphertext))) + return "ciphertext: buffer expected"; + return null; + }; + + /** + * Creates a SenderKeyMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderKeyMessage + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderKeyMessage} SenderKeyMessage + */ + SenderKeyMessage.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderKeyMessage) + return object; + var message = new $root.groupproto.SenderKeyMessage(); + if (object.id != null) + message.id = object.id >>> 0; + if (object.iteration != null) + message.iteration = object.iteration >>> 0; + if (object.ciphertext != null) + if (typeof object.ciphertext === "string") + $util.base64.decode(object.ciphertext, message.ciphertext = $util.newBuffer($util.base64.length(object.ciphertext)), 0); + else if (object.ciphertext.length) + message.ciphertext = object.ciphertext; + return message; + }; + + /** + * Creates a plain object from a SenderKeyMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderKeyMessage + * @static + * @param {groupproto.SenderKeyMessage} message SenderKeyMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = 0; + object.iteration = 0; + if (options.bytes === String) + object.ciphertext = ""; + else { + object.ciphertext = []; + if (options.bytes !== Array) + object.ciphertext = $util.newBuffer(object.ciphertext); + } + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.iteration != null && message.hasOwnProperty("iteration")) + object.iteration = message.iteration; + if (message.ciphertext != null && message.hasOwnProperty("ciphertext")) + object.ciphertext = options.bytes === String ? $util.base64.encode(message.ciphertext, 0, message.ciphertext.length) : options.bytes === Array ? Array.prototype.slice.call(message.ciphertext) : message.ciphertext; + return object; + }; + + /** + * Converts this SenderKeyMessage to JSON. + * @function toJSON + * @memberof groupproto.SenderKeyMessage + * @instance + * @returns {Object.} JSON object + */ + SenderKeyMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderKeyMessage; + })(); + + groupproto.SenderKeyDistributionMessage = (function() { + + /** + * Properties of a SenderKeyDistributionMessage. + * @memberof groupproto + * @interface ISenderKeyDistributionMessage + * @property {number|null} [id] SenderKeyDistributionMessage id + * @property {number|null} [iteration] SenderKeyDistributionMessage iteration + * @property {Uint8Array|null} [chainKey] SenderKeyDistributionMessage chainKey + * @property {Uint8Array|null} [signingKey] SenderKeyDistributionMessage signingKey + */ + + /** + * Constructs a new SenderKeyDistributionMessage. + * @memberof groupproto + * @classdesc Represents a SenderKeyDistributionMessage. + * @implements ISenderKeyDistributionMessage + * @constructor + * @param {groupproto.ISenderKeyDistributionMessage=} [properties] Properties to set + */ + function SenderKeyDistributionMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyDistributionMessage id. + * @member {number} id + * @memberof groupproto.SenderKeyDistributionMessage + * @instance + */ + SenderKeyDistributionMessage.prototype.id = 0; + + /** + * SenderKeyDistributionMessage iteration. + * @member {number} iteration + * @memberof groupproto.SenderKeyDistributionMessage + * @instance + */ + SenderKeyDistributionMessage.prototype.iteration = 0; + + /** + * SenderKeyDistributionMessage chainKey. + * @member {Uint8Array} chainKey + * @memberof groupproto.SenderKeyDistributionMessage + * @instance + */ + SenderKeyDistributionMessage.prototype.chainKey = $util.newBuffer([]); + + /** + * SenderKeyDistributionMessage signingKey. + * @member {Uint8Array} signingKey + * @memberof groupproto.SenderKeyDistributionMessage + * @instance + */ + SenderKeyDistributionMessage.prototype.signingKey = $util.newBuffer([]); + + /** + * Creates a new SenderKeyDistributionMessage instance using the specified properties. + * @function create + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {groupproto.ISenderKeyDistributionMessage=} [properties] Properties to set + * @returns {groupproto.SenderKeyDistributionMessage} SenderKeyDistributionMessage instance + */ + SenderKeyDistributionMessage.create = function create(properties) { + return new SenderKeyDistributionMessage(properties); + }; + + /** + * Encodes the specified SenderKeyDistributionMessage message. Does not implicitly {@link groupproto.SenderKeyDistributionMessage.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {groupproto.ISenderKeyDistributionMessage} message SenderKeyDistributionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyDistributionMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.id); + if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.iteration); + if (message.chainKey != null && Object.hasOwnProperty.call(message, "chainKey")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.chainKey); + if (message.signingKey != null && Object.hasOwnProperty.call(message, "signingKey")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.signingKey); + return writer; + }; + + /** + * Encodes the specified SenderKeyDistributionMessage message, length delimited. Does not implicitly {@link groupproto.SenderKeyDistributionMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {groupproto.ISenderKeyDistributionMessage} message SenderKeyDistributionMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyDistributionMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyDistributionMessage message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderKeyDistributionMessage} SenderKeyDistributionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyDistributionMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderKeyDistributionMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + case 2: + message.iteration = reader.uint32(); + break; + case 3: + message.chainKey = reader.bytes(); + break; + case 4: + message.signingKey = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyDistributionMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderKeyDistributionMessage} SenderKeyDistributionMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyDistributionMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyDistributionMessage message. + * @function verify + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyDistributionMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id)) + return "id: integer expected"; + if (message.iteration != null && message.hasOwnProperty("iteration")) + if (!$util.isInteger(message.iteration)) + return "iteration: integer expected"; + if (message.chainKey != null && message.hasOwnProperty("chainKey")) + if (!(message.chainKey && typeof message.chainKey.length === "number" || $util.isString(message.chainKey))) + return "chainKey: buffer expected"; + if (message.signingKey != null && message.hasOwnProperty("signingKey")) + if (!(message.signingKey && typeof message.signingKey.length === "number" || $util.isString(message.signingKey))) + return "signingKey: buffer expected"; + return null; + }; + + /** + * Creates a SenderKeyDistributionMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderKeyDistributionMessage} SenderKeyDistributionMessage + */ + SenderKeyDistributionMessage.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderKeyDistributionMessage) + return object; + var message = new $root.groupproto.SenderKeyDistributionMessage(); + if (object.id != null) + message.id = object.id >>> 0; + if (object.iteration != null) + message.iteration = object.iteration >>> 0; + if (object.chainKey != null) + if (typeof object.chainKey === "string") + $util.base64.decode(object.chainKey, message.chainKey = $util.newBuffer($util.base64.length(object.chainKey)), 0); + else if (object.chainKey.length) + message.chainKey = object.chainKey; + if (object.signingKey != null) + if (typeof object.signingKey === "string") + $util.base64.decode(object.signingKey, message.signingKey = $util.newBuffer($util.base64.length(object.signingKey)), 0); + else if (object.signingKey.length) + message.signingKey = object.signingKey; + return message; + }; + + /** + * Creates a plain object from a SenderKeyDistributionMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderKeyDistributionMessage + * @static + * @param {groupproto.SenderKeyDistributionMessage} message SenderKeyDistributionMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyDistributionMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = 0; + object.iteration = 0; + if (options.bytes === String) + object.chainKey = ""; + else { + object.chainKey = []; + if (options.bytes !== Array) + object.chainKey = $util.newBuffer(object.chainKey); + } + if (options.bytes === String) + object.signingKey = ""; + else { + object.signingKey = []; + if (options.bytes !== Array) + object.signingKey = $util.newBuffer(object.signingKey); + } + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.iteration != null && message.hasOwnProperty("iteration")) + object.iteration = message.iteration; + if (message.chainKey != null && message.hasOwnProperty("chainKey")) + object.chainKey = options.bytes === String ? $util.base64.encode(message.chainKey, 0, message.chainKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.chainKey) : message.chainKey; + if (message.signingKey != null && message.hasOwnProperty("signingKey")) + object.signingKey = options.bytes === String ? $util.base64.encode(message.signingKey, 0, message.signingKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.signingKey) : message.signingKey; + return object; + }; + + /** + * Converts this SenderKeyDistributionMessage to JSON. + * @function toJSON + * @memberof groupproto.SenderKeyDistributionMessage + * @instance + * @returns {Object.} JSON object + */ + SenderKeyDistributionMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderKeyDistributionMessage; + })(); + + groupproto.SenderChainKey = (function() { + + /** + * Properties of a SenderChainKey. + * @memberof groupproto + * @interface ISenderChainKey + * @property {number|null} [iteration] SenderChainKey iteration + * @property {Uint8Array|null} [seed] SenderChainKey seed + */ + + /** + * Constructs a new SenderChainKey. + * @memberof groupproto + * @classdesc Represents a SenderChainKey. + * @implements ISenderChainKey + * @constructor + * @param {groupproto.ISenderChainKey=} [properties] Properties to set + */ + function SenderChainKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderChainKey iteration. + * @member {number} iteration + * @memberof groupproto.SenderChainKey + * @instance + */ + SenderChainKey.prototype.iteration = 0; + + /** + * SenderChainKey seed. + * @member {Uint8Array} seed + * @memberof groupproto.SenderChainKey + * @instance + */ + SenderChainKey.prototype.seed = $util.newBuffer([]); + + /** + * Creates a new SenderChainKey instance using the specified properties. + * @function create + * @memberof groupproto.SenderChainKey + * @static + * @param {groupproto.ISenderChainKey=} [properties] Properties to set + * @returns {groupproto.SenderChainKey} SenderChainKey instance + */ + SenderChainKey.create = function create(properties) { + return new SenderChainKey(properties); + }; + + /** + * Encodes the specified SenderChainKey message. Does not implicitly {@link groupproto.SenderChainKey.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderChainKey + * @static + * @param {groupproto.ISenderChainKey} message SenderChainKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderChainKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.iteration); + if (message.seed != null && Object.hasOwnProperty.call(message, "seed")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.seed); + return writer; + }; + + /** + * Encodes the specified SenderChainKey message, length delimited. Does not implicitly {@link groupproto.SenderChainKey.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderChainKey + * @static + * @param {groupproto.ISenderChainKey} message SenderChainKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderChainKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderChainKey message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderChainKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderChainKey} SenderChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderChainKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderChainKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.iteration = reader.uint32(); + break; + case 2: + message.seed = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderChainKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderChainKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderChainKey} SenderChainKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderChainKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderChainKey message. + * @function verify + * @memberof groupproto.SenderChainKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderChainKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.iteration != null && message.hasOwnProperty("iteration")) + if (!$util.isInteger(message.iteration)) + return "iteration: integer expected"; + if (message.seed != null && message.hasOwnProperty("seed")) + if (!(message.seed && typeof message.seed.length === "number" || $util.isString(message.seed))) + return "seed: buffer expected"; + return null; + }; + + /** + * Creates a SenderChainKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderChainKey + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderChainKey} SenderChainKey + */ + SenderChainKey.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderChainKey) + return object; + var message = new $root.groupproto.SenderChainKey(); + if (object.iteration != null) + message.iteration = object.iteration >>> 0; + if (object.seed != null) + if (typeof object.seed === "string") + $util.base64.decode(object.seed, message.seed = $util.newBuffer($util.base64.length(object.seed)), 0); + else if (object.seed.length) + message.seed = object.seed; + return message; + }; + + /** + * Creates a plain object from a SenderChainKey message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderChainKey + * @static + * @param {groupproto.SenderChainKey} message SenderChainKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderChainKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.iteration = 0; + if (options.bytes === String) + object.seed = ""; + else { + object.seed = []; + if (options.bytes !== Array) + object.seed = $util.newBuffer(object.seed); + } + } + if (message.iteration != null && message.hasOwnProperty("iteration")) + object.iteration = message.iteration; + if (message.seed != null && message.hasOwnProperty("seed")) + object.seed = options.bytes === String ? $util.base64.encode(message.seed, 0, message.seed.length) : options.bytes === Array ? Array.prototype.slice.call(message.seed) : message.seed; + return object; + }; + + /** + * Converts this SenderChainKey to JSON. + * @function toJSON + * @memberof groupproto.SenderChainKey + * @instance + * @returns {Object.} JSON object + */ + SenderChainKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderChainKey; + })(); + + groupproto.SenderMessageKey = (function() { + + /** + * Properties of a SenderMessageKey. + * @memberof groupproto + * @interface ISenderMessageKey + * @property {number|null} [iteration] SenderMessageKey iteration + * @property {Uint8Array|null} [seed] SenderMessageKey seed + */ + + /** + * Constructs a new SenderMessageKey. + * @memberof groupproto + * @classdesc Represents a SenderMessageKey. + * @implements ISenderMessageKey + * @constructor + * @param {groupproto.ISenderMessageKey=} [properties] Properties to set + */ + function SenderMessageKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderMessageKey iteration. + * @member {number} iteration + * @memberof groupproto.SenderMessageKey + * @instance + */ + SenderMessageKey.prototype.iteration = 0; + + /** + * SenderMessageKey seed. + * @member {Uint8Array} seed + * @memberof groupproto.SenderMessageKey + * @instance + */ + SenderMessageKey.prototype.seed = $util.newBuffer([]); + + /** + * Creates a new SenderMessageKey instance using the specified properties. + * @function create + * @memberof groupproto.SenderMessageKey + * @static + * @param {groupproto.ISenderMessageKey=} [properties] Properties to set + * @returns {groupproto.SenderMessageKey} SenderMessageKey instance + */ + SenderMessageKey.create = function create(properties) { + return new SenderMessageKey(properties); + }; + + /** + * Encodes the specified SenderMessageKey message. Does not implicitly {@link groupproto.SenderMessageKey.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderMessageKey + * @static + * @param {groupproto.ISenderMessageKey} message SenderMessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderMessageKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.iteration != null && Object.hasOwnProperty.call(message, "iteration")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.iteration); + if (message.seed != null && Object.hasOwnProperty.call(message, "seed")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.seed); + return writer; + }; + + /** + * Encodes the specified SenderMessageKey message, length delimited. Does not implicitly {@link groupproto.SenderMessageKey.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderMessageKey + * @static + * @param {groupproto.ISenderMessageKey} message SenderMessageKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderMessageKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderMessageKey message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderMessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderMessageKey} SenderMessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderMessageKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderMessageKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.iteration = reader.uint32(); + break; + case 2: + message.seed = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderMessageKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderMessageKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderMessageKey} SenderMessageKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderMessageKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderMessageKey message. + * @function verify + * @memberof groupproto.SenderMessageKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderMessageKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.iteration != null && message.hasOwnProperty("iteration")) + if (!$util.isInteger(message.iteration)) + return "iteration: integer expected"; + if (message.seed != null && message.hasOwnProperty("seed")) + if (!(message.seed && typeof message.seed.length === "number" || $util.isString(message.seed))) + return "seed: buffer expected"; + return null; + }; + + /** + * Creates a SenderMessageKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderMessageKey + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderMessageKey} SenderMessageKey + */ + SenderMessageKey.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderMessageKey) + return object; + var message = new $root.groupproto.SenderMessageKey(); + if (object.iteration != null) + message.iteration = object.iteration >>> 0; + if (object.seed != null) + if (typeof object.seed === "string") + $util.base64.decode(object.seed, message.seed = $util.newBuffer($util.base64.length(object.seed)), 0); + else if (object.seed.length) + message.seed = object.seed; + return message; + }; + + /** + * Creates a plain object from a SenderMessageKey message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderMessageKey + * @static + * @param {groupproto.SenderMessageKey} message SenderMessageKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderMessageKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.iteration = 0; + if (options.bytes === String) + object.seed = ""; + else { + object.seed = []; + if (options.bytes !== Array) + object.seed = $util.newBuffer(object.seed); + } + } + if (message.iteration != null && message.hasOwnProperty("iteration")) + object.iteration = message.iteration; + if (message.seed != null && message.hasOwnProperty("seed")) + object.seed = options.bytes === String ? $util.base64.encode(message.seed, 0, message.seed.length) : options.bytes === Array ? Array.prototype.slice.call(message.seed) : message.seed; + return object; + }; + + /** + * Converts this SenderMessageKey to JSON. + * @function toJSON + * @memberof groupproto.SenderMessageKey + * @instance + * @returns {Object.} JSON object + */ + SenderMessageKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderMessageKey; + })(); + + groupproto.SenderSigningKey = (function() { + + /** + * Properties of a SenderSigningKey. + * @memberof groupproto + * @interface ISenderSigningKey + * @property {Uint8Array|null} ["public"] SenderSigningKey public + * @property {Uint8Array|null} ["private"] SenderSigningKey private + */ + + /** + * Constructs a new SenderSigningKey. + * @memberof groupproto + * @classdesc Represents a SenderSigningKey. + * @implements ISenderSigningKey + * @constructor + * @param {groupproto.ISenderSigningKey=} [properties] Properties to set + */ + function SenderSigningKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderSigningKey public. + * @member {Uint8Array} public + * @memberof groupproto.SenderSigningKey + * @instance + */ + SenderSigningKey.prototype["public"] = $util.newBuffer([]); + + /** + * SenderSigningKey private. + * @member {Uint8Array} private + * @memberof groupproto.SenderSigningKey + * @instance + */ + SenderSigningKey.prototype["private"] = $util.newBuffer([]); + + /** + * Creates a new SenderSigningKey instance using the specified properties. + * @function create + * @memberof groupproto.SenderSigningKey + * @static + * @param {groupproto.ISenderSigningKey=} [properties] Properties to set + * @returns {groupproto.SenderSigningKey} SenderSigningKey instance + */ + SenderSigningKey.create = function create(properties) { + return new SenderSigningKey(properties); + }; + + /** + * Encodes the specified SenderSigningKey message. Does not implicitly {@link groupproto.SenderSigningKey.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderSigningKey + * @static + * @param {groupproto.ISenderSigningKey} message SenderSigningKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderSigningKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message["public"] != null && Object.hasOwnProperty.call(message, "public")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message["public"]); + if (message["private"] != null && Object.hasOwnProperty.call(message, "private")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message["private"]); + return writer; + }; + + /** + * Encodes the specified SenderSigningKey message, length delimited. Does not implicitly {@link groupproto.SenderSigningKey.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderSigningKey + * @static + * @param {groupproto.ISenderSigningKey} message SenderSigningKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderSigningKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderSigningKey message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderSigningKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderSigningKey} SenderSigningKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderSigningKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderSigningKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message["public"] = reader.bytes(); + break; + case 2: + message["private"] = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderSigningKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderSigningKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderSigningKey} SenderSigningKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderSigningKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderSigningKey message. + * @function verify + * @memberof groupproto.SenderSigningKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderSigningKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message["public"] != null && message.hasOwnProperty("public")) + if (!(message["public"] && typeof message["public"].length === "number" || $util.isString(message["public"]))) + return "public: buffer expected"; + if (message["private"] != null && message.hasOwnProperty("private")) + if (!(message["private"] && typeof message["private"].length === "number" || $util.isString(message["private"]))) + return "private: buffer expected"; + return null; + }; + + /** + * Creates a SenderSigningKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderSigningKey + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderSigningKey} SenderSigningKey + */ + SenderSigningKey.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderSigningKey) + return object; + var message = new $root.groupproto.SenderSigningKey(); + if (object["public"] != null) + if (typeof object["public"] === "string") + $util.base64.decode(object["public"], message["public"] = $util.newBuffer($util.base64.length(object["public"])), 0); + else if (object["public"].length) + message["public"] = object["public"]; + if (object["private"] != null) + if (typeof object["private"] === "string") + $util.base64.decode(object["private"], message["private"] = $util.newBuffer($util.base64.length(object["private"])), 0); + else if (object["private"].length) + message["private"] = object["private"]; + return message; + }; + + /** + * Creates a plain object from a SenderSigningKey message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderSigningKey + * @static + * @param {groupproto.SenderSigningKey} message SenderSigningKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderSigningKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object["public"] = ""; + else { + object["public"] = []; + if (options.bytes !== Array) + object["public"] = $util.newBuffer(object["public"]); + } + if (options.bytes === String) + object["private"] = ""; + else { + object["private"] = []; + if (options.bytes !== Array) + object["private"] = $util.newBuffer(object["private"]); + } + } + if (message["public"] != null && message.hasOwnProperty("public")) + object["public"] = options.bytes === String ? $util.base64.encode(message["public"], 0, message["public"].length) : options.bytes === Array ? Array.prototype.slice.call(message["public"]) : message["public"]; + if (message["private"] != null && message.hasOwnProperty("private")) + object["private"] = options.bytes === String ? $util.base64.encode(message["private"], 0, message["private"].length) : options.bytes === Array ? Array.prototype.slice.call(message["private"]) : message["private"]; + return object; + }; + + /** + * Converts this SenderSigningKey to JSON. + * @function toJSON + * @memberof groupproto.SenderSigningKey + * @instance + * @returns {Object.} JSON object + */ + SenderSigningKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderSigningKey; + })(); + + groupproto.SenderKeyStateStructure = (function() { + + /** + * Properties of a SenderKeyStateStructure. + * @memberof groupproto + * @interface ISenderKeyStateStructure + * @property {number|null} [senderKeyId] SenderKeyStateStructure senderKeyId + * @property {groupproto.ISenderChainKey|null} [senderChainKey] SenderKeyStateStructure senderChainKey + * @property {groupproto.ISenderSigningKey|null} [senderSigningKey] SenderKeyStateStructure senderSigningKey + * @property {Array.|null} [senderMessageKeys] SenderKeyStateStructure senderMessageKeys + */ + + /** + * Constructs a new SenderKeyStateStructure. + * @memberof groupproto + * @classdesc Represents a SenderKeyStateStructure. + * @implements ISenderKeyStateStructure + * @constructor + * @param {groupproto.ISenderKeyStateStructure=} [properties] Properties to set + */ + function SenderKeyStateStructure(properties) { + this.senderMessageKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyStateStructure senderKeyId. + * @member {number} senderKeyId + * @memberof groupproto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderKeyId = 0; + + /** + * SenderKeyStateStructure senderChainKey. + * @member {groupproto.ISenderChainKey|null|undefined} senderChainKey + * @memberof groupproto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderChainKey = null; + + /** + * SenderKeyStateStructure senderSigningKey. + * @member {groupproto.ISenderSigningKey|null|undefined} senderSigningKey + * @memberof groupproto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderSigningKey = null; + + /** + * SenderKeyStateStructure senderMessageKeys. + * @member {Array.} senderMessageKeys + * @memberof groupproto.SenderKeyStateStructure + * @instance + */ + SenderKeyStateStructure.prototype.senderMessageKeys = $util.emptyArray; + + /** + * Creates a new SenderKeyStateStructure instance using the specified properties. + * @function create + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {groupproto.ISenderKeyStateStructure=} [properties] Properties to set + * @returns {groupproto.SenderKeyStateStructure} SenderKeyStateStructure instance + */ + SenderKeyStateStructure.create = function create(properties) { + return new SenderKeyStateStructure(properties); + }; + + /** + * Encodes the specified SenderKeyStateStructure message. Does not implicitly {@link groupproto.SenderKeyStateStructure.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {groupproto.ISenderKeyStateStructure} message SenderKeyStateStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyStateStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.senderKeyId != null && Object.hasOwnProperty.call(message, "senderKeyId")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.senderKeyId); + if (message.senderChainKey != null && Object.hasOwnProperty.call(message, "senderChainKey")) + $root.groupproto.SenderChainKey.encode(message.senderChainKey, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.senderSigningKey != null && Object.hasOwnProperty.call(message, "senderSigningKey")) + $root.groupproto.SenderSigningKey.encode(message.senderSigningKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.senderMessageKeys != null && message.senderMessageKeys.length) + for (var i = 0; i < message.senderMessageKeys.length; ++i) + $root.groupproto.SenderMessageKey.encode(message.senderMessageKeys[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SenderKeyStateStructure message, length delimited. Does not implicitly {@link groupproto.SenderKeyStateStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {groupproto.ISenderKeyStateStructure} message SenderKeyStateStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyStateStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyStateStructure message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderKeyStateStructure} SenderKeyStateStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyStateStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderKeyStateStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.senderKeyId = reader.uint32(); + break; + case 2: + message.senderChainKey = $root.groupproto.SenderChainKey.decode(reader, reader.uint32()); + break; + case 3: + message.senderSigningKey = $root.groupproto.SenderSigningKey.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.senderMessageKeys && message.senderMessageKeys.length)) + message.senderMessageKeys = []; + message.senderMessageKeys.push($root.groupproto.SenderMessageKey.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyStateStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderKeyStateStructure} SenderKeyStateStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyStateStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyStateStructure message. + * @function verify + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyStateStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.senderKeyId != null && message.hasOwnProperty("senderKeyId")) + if (!$util.isInteger(message.senderKeyId)) + return "senderKeyId: integer expected"; + if (message.senderChainKey != null && message.hasOwnProperty("senderChainKey")) { + var error = $root.groupproto.SenderChainKey.verify(message.senderChainKey); + if (error) + return "senderChainKey." + error; + } + if (message.senderSigningKey != null && message.hasOwnProperty("senderSigningKey")) { + var error = $root.groupproto.SenderSigningKey.verify(message.senderSigningKey); + if (error) + return "senderSigningKey." + error; + } + if (message.senderMessageKeys != null && message.hasOwnProperty("senderMessageKeys")) { + if (!Array.isArray(message.senderMessageKeys)) + return "senderMessageKeys: array expected"; + for (var i = 0; i < message.senderMessageKeys.length; ++i) { + var error = $root.groupproto.SenderMessageKey.verify(message.senderMessageKeys[i]); + if (error) + return "senderMessageKeys." + error; + } + } + return null; + }; + + /** + * Creates a SenderKeyStateStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderKeyStateStructure} SenderKeyStateStructure + */ + SenderKeyStateStructure.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderKeyStateStructure) + return object; + var message = new $root.groupproto.SenderKeyStateStructure(); + if (object.senderKeyId != null) + message.senderKeyId = object.senderKeyId >>> 0; + if (object.senderChainKey != null) { + if (typeof object.senderChainKey !== "object") + throw TypeError(".groupproto.SenderKeyStateStructure.senderChainKey: object expected"); + message.senderChainKey = $root.groupproto.SenderChainKey.fromObject(object.senderChainKey); + } + if (object.senderSigningKey != null) { + if (typeof object.senderSigningKey !== "object") + throw TypeError(".groupproto.SenderKeyStateStructure.senderSigningKey: object expected"); + message.senderSigningKey = $root.groupproto.SenderSigningKey.fromObject(object.senderSigningKey); + } + if (object.senderMessageKeys) { + if (!Array.isArray(object.senderMessageKeys)) + throw TypeError(".groupproto.SenderKeyStateStructure.senderMessageKeys: array expected"); + message.senderMessageKeys = []; + for (var i = 0; i < object.senderMessageKeys.length; ++i) { + if (typeof object.senderMessageKeys[i] !== "object") + throw TypeError(".groupproto.SenderKeyStateStructure.senderMessageKeys: object expected"); + message.senderMessageKeys[i] = $root.groupproto.SenderMessageKey.fromObject(object.senderMessageKeys[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SenderKeyStateStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderKeyStateStructure + * @static + * @param {groupproto.SenderKeyStateStructure} message SenderKeyStateStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyStateStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.senderMessageKeys = []; + if (options.defaults) { + object.senderKeyId = 0; + object.senderChainKey = null; + object.senderSigningKey = null; + } + if (message.senderKeyId != null && message.hasOwnProperty("senderKeyId")) + object.senderKeyId = message.senderKeyId; + if (message.senderChainKey != null && message.hasOwnProperty("senderChainKey")) + object.senderChainKey = $root.groupproto.SenderChainKey.toObject(message.senderChainKey, options); + if (message.senderSigningKey != null && message.hasOwnProperty("senderSigningKey")) + object.senderSigningKey = $root.groupproto.SenderSigningKey.toObject(message.senderSigningKey, options); + if (message.senderMessageKeys && message.senderMessageKeys.length) { + object.senderMessageKeys = []; + for (var j = 0; j < message.senderMessageKeys.length; ++j) + object.senderMessageKeys[j] = $root.groupproto.SenderMessageKey.toObject(message.senderMessageKeys[j], options); + } + return object; + }; + + /** + * Converts this SenderKeyStateStructure to JSON. + * @function toJSON + * @memberof groupproto.SenderKeyStateStructure + * @instance + * @returns {Object.} JSON object + */ + SenderKeyStateStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderKeyStateStructure; + })(); + + groupproto.SenderKeyRecordStructure = (function() { + + /** + * Properties of a SenderKeyRecordStructure. + * @memberof groupproto + * @interface ISenderKeyRecordStructure + * @property {Array.|null} [senderKeyStates] SenderKeyRecordStructure senderKeyStates + */ + + /** + * Constructs a new SenderKeyRecordStructure. + * @memberof groupproto + * @classdesc Represents a SenderKeyRecordStructure. + * @implements ISenderKeyRecordStructure + * @constructor + * @param {groupproto.ISenderKeyRecordStructure=} [properties] Properties to set + */ + function SenderKeyRecordStructure(properties) { + this.senderKeyStates = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SenderKeyRecordStructure senderKeyStates. + * @member {Array.} senderKeyStates + * @memberof groupproto.SenderKeyRecordStructure + * @instance + */ + SenderKeyRecordStructure.prototype.senderKeyStates = $util.emptyArray; + + /** + * Creates a new SenderKeyRecordStructure instance using the specified properties. + * @function create + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {groupproto.ISenderKeyRecordStructure=} [properties] Properties to set + * @returns {groupproto.SenderKeyRecordStructure} SenderKeyRecordStructure instance + */ + SenderKeyRecordStructure.create = function create(properties) { + return new SenderKeyRecordStructure(properties); + }; + + /** + * Encodes the specified SenderKeyRecordStructure message. Does not implicitly {@link groupproto.SenderKeyRecordStructure.verify|verify} messages. + * @function encode + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {groupproto.ISenderKeyRecordStructure} message SenderKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyRecordStructure.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.senderKeyStates != null && message.senderKeyStates.length) + for (var i = 0; i < message.senderKeyStates.length; ++i) + $root.groupproto.SenderKeyStateStructure.encode(message.senderKeyStates[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SenderKeyRecordStructure message, length delimited. Does not implicitly {@link groupproto.SenderKeyRecordStructure.verify|verify} messages. + * @function encodeDelimited + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {groupproto.ISenderKeyRecordStructure} message SenderKeyRecordStructure message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SenderKeyRecordStructure.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SenderKeyRecordStructure message from the specified reader or buffer. + * @function decode + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {groupproto.SenderKeyRecordStructure} SenderKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyRecordStructure.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.groupproto.SenderKeyRecordStructure(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.senderKeyStates && message.senderKeyStates.length)) + message.senderKeyStates = []; + message.senderKeyStates.push($root.groupproto.SenderKeyStateStructure.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SenderKeyRecordStructure message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {groupproto.SenderKeyRecordStructure} SenderKeyRecordStructure + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SenderKeyRecordStructure.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SenderKeyRecordStructure message. + * @function verify + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SenderKeyRecordStructure.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.senderKeyStates != null && message.hasOwnProperty("senderKeyStates")) { + if (!Array.isArray(message.senderKeyStates)) + return "senderKeyStates: array expected"; + for (var i = 0; i < message.senderKeyStates.length; ++i) { + var error = $root.groupproto.SenderKeyStateStructure.verify(message.senderKeyStates[i]); + if (error) + return "senderKeyStates." + error; + } + } + return null; + }; + + /** + * Creates a SenderKeyRecordStructure message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {Object.} object Plain object + * @returns {groupproto.SenderKeyRecordStructure} SenderKeyRecordStructure + */ + SenderKeyRecordStructure.fromObject = function fromObject(object) { + if (object instanceof $root.groupproto.SenderKeyRecordStructure) + return object; + var message = new $root.groupproto.SenderKeyRecordStructure(); + if (object.senderKeyStates) { + if (!Array.isArray(object.senderKeyStates)) + throw TypeError(".groupproto.SenderKeyRecordStructure.senderKeyStates: array expected"); + message.senderKeyStates = []; + for (var i = 0; i < object.senderKeyStates.length; ++i) { + if (typeof object.senderKeyStates[i] !== "object") + throw TypeError(".groupproto.SenderKeyRecordStructure.senderKeyStates: object expected"); + message.senderKeyStates[i] = $root.groupproto.SenderKeyStateStructure.fromObject(object.senderKeyStates[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SenderKeyRecordStructure message. Also converts values to other types if specified. + * @function toObject + * @memberof groupproto.SenderKeyRecordStructure + * @static + * @param {groupproto.SenderKeyRecordStructure} message SenderKeyRecordStructure + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SenderKeyRecordStructure.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.senderKeyStates = []; + if (message.senderKeyStates && message.senderKeyStates.length) { + object.senderKeyStates = []; + for (var j = 0; j < message.senderKeyStates.length; ++j) + object.senderKeyStates[j] = $root.groupproto.SenderKeyStateStructure.toObject(message.senderKeyStates[j], options); + } + return object; + }; + + /** + * Converts this SenderKeyRecordStructure to JSON. + * @function toJSON + * @memberof groupproto.SenderKeyRecordStructure + * @instance + * @returns {Object.} JSON object + */ + SenderKeyRecordStructure.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SenderKeyRecordStructure; + })(); + + return groupproto; +})(); + +module.exports = $root; diff --git a/WASignalGroup/ciphertext_message.js b/WASignalGroup/ciphertext_message.js new file mode 100644 index 00000000000..f9bb771ff88 --- /dev/null +++ b/WASignalGroup/ciphertext_message.js @@ -0,0 +1,16 @@ +class CiphertextMessage { + UNSUPPORTED_VERSION = 1; + + CURRENT_VERSION = 3; + + WHISPER_TYPE = 2; + + PREKEY_TYPE = 3; + + SENDERKEY_TYPE = 4; + + SENDERKEY_DISTRIBUTION_TYPE = 5; + + ENCRYPTED_MESSAGE_OVERHEAD = 53; +} +module.exports = CiphertextMessage; \ No newline at end of file diff --git a/WASignalGroup/generate-proto.sh b/WASignalGroup/generate-proto.sh new file mode 100644 index 00000000000..051876d20a0 --- /dev/null +++ b/WASignalGroup/generate-proto.sh @@ -0,0 +1 @@ +yarn pbjs -t static-module -w commonjs -o ./WASignalGroup/GroupProtocol.js ./WASignalGroup/group.proto \ No newline at end of file diff --git a/WASignalGroup/group.proto b/WASignalGroup/group.proto new file mode 100644 index 00000000000..e6f549b4a06 --- /dev/null +++ b/WASignalGroup/group.proto @@ -0,0 +1,42 @@ +package groupproto; + +message SenderKeyMessage { + optional uint32 id = 1; + optional uint32 iteration = 2; + optional bytes ciphertext = 3; + } + + message SenderKeyDistributionMessage { + optional uint32 id = 1; + optional uint32 iteration = 2; + optional bytes chainKey = 3; + optional bytes signingKey = 4; + } + + message SenderChainKey { + optional uint32 iteration = 1; + optional bytes seed = 2; +} + +message SenderMessageKey { + optional uint32 iteration = 1; + optional bytes seed = 2; +} + +message SenderSigningKey { + optional bytes public = 1; + optional bytes private = 2; +} + +message SenderKeyStateStructure { + + + optional uint32 senderKeyId = 1; + optional SenderChainKey senderChainKey = 2; + optional SenderSigningKey senderSigningKey = 3; + repeated SenderMessageKey senderMessageKeys = 4; +} + +message SenderKeyRecordStructure { + repeated SenderKeyStateStructure senderKeyStates = 1; +} \ No newline at end of file diff --git a/WASignalGroup/group_cipher.js b/WASignalGroup/group_cipher.js new file mode 100644 index 00000000000..3c126f4c233 --- /dev/null +++ b/WASignalGroup/group_cipher.js @@ -0,0 +1,106 @@ +const SenderKeyMessage = require('./sender_key_message'); +const crypto = require('libsignal/src/crypto'); + +class GroupCipher { + constructor(senderKeyStore, senderKeyName) { + this.senderKeyStore = senderKeyStore; + this.senderKeyName = senderKeyName; + } + + async encrypt(paddedPlaintext) { + try { + const record = await this.senderKeyStore.loadSenderKey(this.senderKeyName); + const senderKeyState = record.getSenderKeyState(); + const senderKey = senderKeyState.getSenderChainKey().getSenderMessageKey(); + + const ciphertext = await this.getCipherText( + senderKey.getIv(), + senderKey.getCipherKey(), + paddedPlaintext + ); + + const senderKeyMessage = new SenderKeyMessage( + senderKeyState.getKeyId(), + senderKey.getIteration(), + ciphertext, + senderKeyState.getSigningKeyPrivate() + ); + senderKeyState.setSenderChainKey(senderKeyState.getSenderChainKey().getNext()); + await this.senderKeyStore.storeSenderKey(this.senderKeyName, record); + return senderKeyMessage.serialize(); + } catch (e) { + //console.log(e.stack); + throw new Error('NoSessionException'); + } + } + + async decrypt(senderKeyMessageBytes) { + const record = await this.senderKeyStore.loadSenderKey(this.senderKeyName); + if (!record) throw new Error(`No sender key for: ${this.senderKeyName}`); + + const senderKeyMessage = new SenderKeyMessage(null, null, null, null, senderKeyMessageBytes); + + const senderKeyState = record.getSenderKeyState(senderKeyMessage.getKeyId()); + senderKeyMessage.verifySignature(senderKeyState.getSigningKeyPublic()); + const senderKey = this.getSenderKey(senderKeyState, senderKeyMessage.getIteration()); + // senderKeyState.senderKeyStateStructure.senderSigningKey.private = + + const plaintext = await this.getPlainText( + senderKey.getIv(), + senderKey.getCipherKey(), + senderKeyMessage.getCipherText() + ); + + await this.senderKeyStore.storeSenderKey(this.senderKeyName, record); + + return plaintext; + } + + getSenderKey(senderKeyState, iteration) { + let senderChainKey = senderKeyState.getSenderChainKey(); + if (senderChainKey.getIteration() > iteration) { + if (senderKeyState.hasSenderMessageKey(iteration)) { + return senderKeyState.removeSenderMessageKey(iteration); + } + throw new Error( + `Received message with old counter: ${senderChainKey.getIteration()}, ${iteration}` + ); + } + + if (senderChainKey.getIteration() - iteration > 2000) { + throw new Error('Over 2000 messages into the future!'); + } + + while (senderChainKey.getIteration() < iteration) { + senderKeyState.addSenderMessageKey(senderChainKey.getSenderMessageKey()); + senderChainKey = senderChainKey.getNext(); + } + + senderKeyState.setSenderChainKey(senderChainKey.getNext()); + return senderChainKey.getSenderMessageKey(); + } + + getPlainText(iv, key, ciphertext) { + try { + const plaintext = crypto.decrypt(key, ciphertext, iv); + return plaintext; + } catch (e) { + //console.log(e.stack); + throw new Error('InvalidMessageException'); + } + } + + getCipherText(iv, key, plaintext) { + try { + iv = typeof iv === 'string' ? Buffer.from(iv, 'base64') : iv; + key = typeof key === 'string' ? Buffer.from(key, 'base64') : key; + const crypted = crypto.encrypt(key, Buffer.from(plaintext), iv); + return crypted; + } catch (e) { + //console.log(e.stack); + throw new Error('InvalidMessageException'); + } + } +} + +module.exports = GroupCipher; \ No newline at end of file diff --git a/WASignalGroup/group_session_builder.js b/WASignalGroup/group_session_builder.js new file mode 100644 index 00000000000..24c84a251b3 --- /dev/null +++ b/WASignalGroup/group_session_builder.js @@ -0,0 +1,46 @@ +//const utils = require('../../common/utils'); +const SenderKeyDistributionMessage = require('./sender_key_distribution_message'); + +const keyhelper = require("./keyhelper"); +class GroupSessionBuilder { + constructor(senderKeyStore) { + this.senderKeyStore = senderKeyStore; + } + + async process(senderKeyName, senderKeyDistributionMessage) { + //console.log('GroupSessionBuilder process', senderKeyName, senderKeyDistributionMessage); + const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName); + senderKeyRecord.addSenderKeyState( + senderKeyDistributionMessage.getId(), + senderKeyDistributionMessage.getIteration(), + senderKeyDistributionMessage.getChainKey(), + senderKeyDistributionMessage.getSignatureKey() + ); + await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord); + } + + // [{"senderKeyId":1742199468,"senderChainKey":{"iteration":0,"seed":"yxMY9VFQcXEP34olRAcGCtsgx1XoKsHfDIh+1ea4HAQ="},"senderSigningKey":{"public":""}}] + async create(senderKeyName) { + const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName); + //console.log('GroupSessionBuilder create session', senderKeyName, senderKeyRecord); + + if (senderKeyRecord.isEmpty()) { + const keyId = keyhelper.generateSenderKeyId(); + const senderKey = keyhelper.generateSenderKey(); + const signingKey = keyhelper.generateSenderSigningKey(); + + senderKeyRecord.setSenderKeyState(keyId, 0, senderKey, signingKey); + await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord); + } + + const state = senderKeyRecord.getSenderKeyState(); + + return new SenderKeyDistributionMessage( + state.getKeyId(), + state.getSenderChainKey().getIteration(), + state.getSenderChainKey().getSeed(), + state.getSigningKeyPublic() + ); + } +} +module.exports = GroupSessionBuilder; \ No newline at end of file diff --git a/WASignalGroup/index.js b/WASignalGroup/index.js new file mode 100644 index 00000000000..69b935d7f46 --- /dev/null +++ b/WASignalGroup/index.js @@ -0,0 +1,5 @@ +module.exports.GroupSessionBuilder = require('./group_session_builder') +module.exports.SenderKeyDistributionMessage = require('./sender_key_distribution_message') +module.exports.SenderKeyRecord = require('./sender_key_record') +module.exports.SenderKeyName = require('./sender_key_name') +module.exports.GroupCipher = require('./group_cipher') \ No newline at end of file diff --git a/WASignalGroup/keyhelper.js b/WASignalGroup/keyhelper.js new file mode 100644 index 00000000000..a2445813071 --- /dev/null +++ b/WASignalGroup/keyhelper.js @@ -0,0 +1,21 @@ +const curve = require('libsignal/src/curve'); +const nodeCrypto = require('crypto'); + +exports.generateSenderKey = function() { + return nodeCrypto.randomBytes(32); +} + +exports.generateSenderKeyId = function() { + return nodeCrypto.randomInt(2147483647); +} + +exports.generateSenderSigningKey = function(key) { + if (!key) { + key = curve.generateKeyPair(); + } + + return { + public: key.pubKey, + private: key.privKey, + }; +} diff --git a/WASignalGroup/protobufs.js b/WASignalGroup/protobufs.js new file mode 100644 index 00000000000..76daa5cd984 --- /dev/null +++ b/WASignalGroup/protobufs.js @@ -0,0 +1,3 @@ +const { groupproto } = require('./GroupProtocol') + +module.exports = groupproto \ No newline at end of file diff --git a/WASignalGroup/readme.md b/WASignalGroup/readme.md new file mode 100644 index 00000000000..8290d9c1d95 --- /dev/null +++ b/WASignalGroup/readme.md @@ -0,0 +1,6 @@ +# Signal-Group + +This contains the code to decrypt/encrypt WA group messages. +Originally from [pokearaujo/libsignal-node](https://github.com/pokearaujo/libsignal-node) + +The code has been moved outside the signal package as I felt it didn't belong in ths signal package, as it isn't inherently a part of signal but of WA. \ No newline at end of file diff --git a/WASignalGroup/sender_chain_key.js b/WASignalGroup/sender_chain_key.js new file mode 100644 index 00000000000..9a3125b407f --- /dev/null +++ b/WASignalGroup/sender_chain_key.js @@ -0,0 +1,50 @@ +const SenderMessageKey = require('./sender_message_key'); +//const HKDF = require('./hkdf'); +const crypto = require('libsignal/src/crypto'); + +class SenderChainKey { + MESSAGE_KEY_SEED = Buffer.from([0x01]); + + CHAIN_KEY_SEED = Buffer.from([0x02]); + + iteration = 0; + + chainKey = Buffer.alloc(0); + + constructor(iteration, chainKey) { + this.iteration = iteration; + this.chainKey = chainKey; + } + + getIteration() { + return this.iteration; + } + + getSenderMessageKey() { + return new SenderMessageKey( + this.iteration, + this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey) + ); + } + + getNext() { + return new SenderChainKey( + this.iteration + 1, + this.getDerivative(this.CHAIN_KEY_SEED, this.chainKey) + ); + } + + getSeed() { + return typeof this.chainKey === 'string' ? Buffer.from(this.chainKey, 'base64') : this.chainKey; + } + + getDerivative(seed, key) { + key = typeof key === 'string' ? Buffer.from(key, 'base64') : key; + const hash = crypto.calculateMAC(key, seed); + //const hash = new Hash().hmac_hash(key, seed, 'sha256', ''); + + return hash; + } +} + +module.exports = SenderChainKey; \ No newline at end of file diff --git a/WASignalGroup/sender_key_distribution_message.js b/WASignalGroup/sender_key_distribution_message.js new file mode 100644 index 00000000000..9c1400fa692 --- /dev/null +++ b/WASignalGroup/sender_key_distribution_message.js @@ -0,0 +1,78 @@ +const CiphertextMessage = require('./ciphertext_message'); +const protobufs = require('./protobufs'); + +class SenderKeyDistributionMessage extends CiphertextMessage { + constructor( + id = null, + iteration = null, + chainKey = null, + signatureKey = null, + serialized = null + ) { + super(); + if (serialized) { + try { + const version = serialized[0]; + const message = serialized.slice(1); + + const distributionMessage = protobufs.SenderKeyDistributionMessage.decode( + message + ).toJSON(); + this.serialized = serialized; + this.id = distributionMessage.id; + this.iteration = distributionMessage.iteration; + this.chainKey = distributionMessage.chainKey; + this.signatureKey = distributionMessage.signingKey; + } catch (e) { + throw new Error(e); + } + } else { + const version = this.intsToByteHighAndLow(this.CURRENT_VERSION, this.CURRENT_VERSION); + this.id = id; + this.iteration = iteration; + this.chainKey = chainKey; + this.signatureKey = signatureKey; + const message = protobufs.SenderKeyDistributionMessage.encode( + protobufs.SenderKeyDistributionMessage.create({ + id, + iteration, + chainKey, + signingKey: this.signatureKey, + }) + ).finish(); + this.serialized = Buffer.concat([Buffer.from([version]), message]); + } + } + + intsToByteHighAndLow(highValue, lowValue) { + return (((highValue << 4) | lowValue) & 0xff) % 256; + } + + serialize() { + return this.serialized; + } + + getType() { + return this.SENDERKEY_DISTRIBUTION_TYPE; + } + + getIteration() { + return this.iteration; + } + + getChainKey() { + return typeof this.chainKey === 'string' ? Buffer.from(this.chainKey, 'base64') : this.chainKey; + } + + getSignatureKey() { + return typeof this.signatureKey === 'string' + ? Buffer.from(this.signatureKey, 'base64') + : this.signatureKey; + } + + getId() { + return this.id; + } +} + +module.exports = SenderKeyDistributionMessage; \ No newline at end of file diff --git a/WASignalGroup/sender_key_message.js b/WASignalGroup/sender_key_message.js new file mode 100644 index 00000000000..288aeba4d7f --- /dev/null +++ b/WASignalGroup/sender_key_message.js @@ -0,0 +1,92 @@ +const CiphertextMessage = require('./ciphertext_message'); +const curve = require('libsignal/src/curve'); +const protobufs = require('./protobufs'); + +class SenderKeyMessage extends CiphertextMessage { + SIGNATURE_LENGTH = 64; + + constructor( + keyId = null, + iteration = null, + ciphertext = null, + signatureKey = null, + serialized = null + ) { + super(); + if (serialized) { + const version = serialized[0]; + const message = serialized.slice(1, serialized.length - this.SIGNATURE_LENGTH); + const signature = serialized.slice(-1 * this.SIGNATURE_LENGTH); + const senderKeyMessage = protobufs.SenderKeyMessage.decode(message).toJSON(); + senderKeyMessage.ciphertext = Buffer.from(senderKeyMessage.ciphertext, 'base64'); + + this.serialized = serialized; + this.messageVersion = (version & 0xff) >> 4; + + this.keyId = senderKeyMessage.id; + this.iteration = senderKeyMessage.iteration; + this.ciphertext = senderKeyMessage.ciphertext; + this.signature = signature; + } else { + const version = (((this.CURRENT_VERSION << 4) | this.CURRENT_VERSION) & 0xff) % 256; + ciphertext = Buffer.from(ciphertext); // .toString('base64'); + const message = protobufs.SenderKeyMessage.encode( + protobufs.SenderKeyMessage.create({ + id: keyId, + iteration, + ciphertext, + }) + ).finish(); + + const signature = this.getSignature( + signatureKey, + Buffer.concat([Buffer.from([version]), message]) + ); + this.serialized = Buffer.concat([Buffer.from([version]), message, Buffer.from(signature)]); + this.messageVersion = this.CURRENT_VERSION; + this.keyId = keyId; + this.iteration = iteration; + this.ciphertext = ciphertext; + this.signature = signature; + } + } + + getKeyId() { + return this.keyId; + } + + getIteration() { + return this.iteration; + } + + getCipherText() { + return this.ciphertext; + } + + verifySignature(signatureKey) { + const part1 = this.serialized.slice(0, this.serialized.length - this.SIGNATURE_LENGTH); + const part2 = this.serialized.slice(-1 * this.SIGNATURE_LENGTH); + const res = curve.verifySignature(signatureKey, part1, part2); + if (!res) throw new Error('Invalid signature!'); + } + + getSignature(signatureKey, serialized) { + const signature = Buffer.from( + curve.calculateSignature( + signatureKey, + serialized + ) + ); + return signature; + } + + serialize() { + return this.serialized; + } + + getType() { + return 4; + } +} + +module.exports = SenderKeyMessage; \ No newline at end of file diff --git a/WASignalGroup/sender_key_name.js b/WASignalGroup/sender_key_name.js new file mode 100644 index 00000000000..e7f529041ba --- /dev/null +++ b/WASignalGroup/sender_key_name.js @@ -0,0 +1,70 @@ +function isNull(str) { + return str === null || str.value === ''; +} + +/** + * java String hashCode 的实现 + * @param strKey + * @return intValue + */ +function intValue(num) { + const MAX_VALUE = 0x7fffffff; + const MIN_VALUE = -0x80000000; + if (num > MAX_VALUE || num < MIN_VALUE) { + // eslint-disable-next-line + return (num &= 0xffffffff); + } + return num; +} + +function hashCode(strKey) { + let hash = 0; + if (!isNull(strKey)) { + for (let i = 0; i < strKey.length; i++) { + hash = hash * 31 + strKey.charCodeAt(i); + hash = intValue(hash); + } + } + return hash; +} + +/** + * 将js页面的number类型转换为java的int类型 + * @param num + * @return intValue + */ + +class SenderKeyName { + constructor(groupId, sender) { + this.groupId = groupId; + this.sender = sender; + } + + getGroupId() { + return this.groupId; + } + + getSender() { + return this.sender; + } + + serialize() { + return `${this.groupId}::${this.sender.id}::${this.sender.deviceId}`; + } + + toString() { + return this.serialize(); + } + + equals(other) { + if (other === null) return false; + if (!(other instanceof SenderKeyName)) return false; + return this.groupId === other.groupId && this.sender.toString() === other.sender.toString(); + } + + hashCode() { + return hashCode(this.groupId) ^ hashCode(this.sender.toString()); + } +} + +module.exports = SenderKeyName; \ No newline at end of file diff --git a/WASignalGroup/sender_key_record.js b/WASignalGroup/sender_key_record.js new file mode 100644 index 00000000000..e17f290b2b6 --- /dev/null +++ b/WASignalGroup/sender_key_record.js @@ -0,0 +1,54 @@ +const SenderKeyState = require('./sender_key_state'); + +class SenderKeyRecord { + MAX_STATES = 5; + + constructor(serialized) { + this.senderKeyStates = []; + + if (serialized) { + const list = serialized; + for (let i = 0; i < list.length; i++) { + const structure = list[i]; + this.senderKeyStates.push( + new SenderKeyState(null, null, null, null, null, null, structure) + ); + } + } + } + + isEmpty() { + return this.senderKeyStates.length === 0; + } + + getSenderKeyState(keyId) { + if (!keyId && this.senderKeyStates.length) return this.senderKeyStates[0]; + for (let i = 0; i < this.senderKeyStates.length; i++) { + const state = this.senderKeyStates[i]; + if (state.getKeyId() === keyId) { + return state; + } + } + throw new Error(`No keys for: ${keyId}`); + } + + addSenderKeyState(id, iteration, chainKey, signatureKey) { + this.senderKeyStates.push(new SenderKeyState(id, iteration, chainKey, null, signatureKey)); + } + + setSenderKeyState(id, iteration, chainKey, keyPair) { + this.senderKeyStates.length = 0; + this.senderKeyStates.push(new SenderKeyState(id, iteration, chainKey, keyPair)); + } + + serialize() { + const recordStructure = []; + for (let i = 0; i < this.senderKeyStates.length; i++) { + const senderKeyState = this.senderKeyStates[i]; + recordStructure.push(senderKeyState.getStructure()); + } + return recordStructure; + } + } + + module.exports = SenderKeyRecord; \ No newline at end of file diff --git a/WASignalGroup/sender_key_state.js b/WASignalGroup/sender_key_state.js new file mode 100644 index 00000000000..c3e0fc994fb --- /dev/null +++ b/WASignalGroup/sender_key_state.js @@ -0,0 +1,129 @@ +const SenderChainKey = require('./sender_chain_key'); +const SenderMessageKey = require('./sender_message_key'); + +const protobufs = require('./protobufs'); + +class SenderKeyState { + MAX_MESSAGE_KEYS = 2000; + + constructor( + id = null, + iteration = null, + chainKey = null, + signatureKeyPair = null, + signatureKeyPublic = null, + signatureKeyPrivate = null, + senderKeyStateStructure = null + ) { + if (senderKeyStateStructure) { + this.senderKeyStateStructure = senderKeyStateStructure; + } else { + if (signatureKeyPair) { + signatureKeyPublic = signatureKeyPair.public; + signatureKeyPrivate = signatureKeyPair.private; + } + + chainKey = typeof chainKey === 'string' ? Buffer.from(chainKey, 'base64') : chainKey; + this.senderKeyStateStructure = protobufs.SenderKeyStateStructure.create(); + const senderChainKeyStructure = protobufs.SenderChainKey.create(); + senderChainKeyStructure.iteration = iteration; + senderChainKeyStructure.seed = chainKey; + this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure; + + const signingKeyStructure = protobufs.SenderSigningKey.create(); + signingKeyStructure.public = + typeof signatureKeyPublic === 'string' ? + Buffer.from(signatureKeyPublic, 'base64') : + signatureKeyPublic; + if (signatureKeyPrivate) { + signingKeyStructure.private = + typeof signatureKeyPrivate === 'string' ? + Buffer.from(signatureKeyPrivate, 'base64') : + signatureKeyPrivate; + } + this.senderKeyStateStructure.senderKeyId = id; + this.senderChainKey = senderChainKeyStructure; + this.senderKeyStateStructure.senderSigningKey = signingKeyStructure; + } + this.senderKeyStateStructure.senderMessageKeys = + this.senderKeyStateStructure.senderMessageKeys || []; + } + + SenderKeyState(senderKeyStateStructure) { + this.senderKeyStateStructure = senderKeyStateStructure; + } + + getKeyId() { + return this.senderKeyStateStructure.senderKeyId; + } + + getSenderChainKey() { + return new SenderChainKey( + this.senderKeyStateStructure.senderChainKey.iteration, + this.senderKeyStateStructure.senderChainKey.seed + ); + } + + setSenderChainKey(chainKey) { + const senderChainKeyStructure = protobufs.SenderChainKey.create({ + iteration: chainKey.getIteration(), + seed: chainKey.getSeed(), + }); + this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure; + } + + getSigningKeyPublic() { + return typeof this.senderKeyStateStructure.senderSigningKey.public === 'string' ? + Buffer.from(this.senderKeyStateStructure.senderSigningKey.public, 'base64') : + this.senderKeyStateStructure.senderSigningKey.public; + } + + getSigningKeyPrivate() { + return typeof this.senderKeyStateStructure.senderSigningKey.private === 'string' ? + Buffer.from(this.senderKeyStateStructure.senderSigningKey.private, 'base64') : + this.senderKeyStateStructure.senderSigningKey.private; + } + + hasSenderMessageKey(iteration) { + const list = this.senderKeyStateStructure.senderMessageKeys; + for (let o = 0; o < list.length; o++) { + const senderMessageKey = list[o]; + if (senderMessageKey.iteration === iteration) return true; + } + return false; + } + + addSenderMessageKey(senderMessageKey) { + const senderMessageKeyStructure = protobufs.SenderKeyStateStructure.create({ + iteration: senderMessageKey.getIteration(), + seed: senderMessageKey.getSeed(), + }); + this.senderKeyStateStructure.senderMessageKeys.push(senderMessageKeyStructure); + + if (this.senderKeyStateStructure.senderMessageKeys.length > this.MAX_MESSAGE_KEYS) { + this.senderKeyStateStructure.senderMessageKeys.shift(); + } + } + + removeSenderMessageKey(iteration) { + let result = null; + + this.senderKeyStateStructure.senderMessageKeys = this.senderKeyStateStructure.senderMessageKeys.filter( + senderMessageKey => { + if (senderMessageKey.iteration === iteration) result = senderMessageKey; + return senderMessageKey.iteration !== iteration; + } + ); + + if (result != null) { + return new SenderMessageKey(result.iteration, result.seed); + } + return null; + } + + getStructure() { + return this.senderKeyStateStructure; + } +} + +module.exports = SenderKeyState; \ No newline at end of file diff --git a/WASignalGroup/sender_message_key.js b/WASignalGroup/sender_message_key.js new file mode 100644 index 00000000000..7639704294b --- /dev/null +++ b/WASignalGroup/sender_message_key.js @@ -0,0 +1,39 @@ +const { deriveSecrets } = require('libsignal/src/crypto'); +class SenderMessageKey { + iteration = 0; + + iv = Buffer.alloc(0); + + cipherKey = Buffer.alloc(0); + + seed = Buffer.alloc(0); + + constructor(iteration, seed) { + const derivative = deriveSecrets(seed, Buffer.alloc(32), Buffer.from('WhisperGroup')); + const keys = new Uint8Array(32); + keys.set(new Uint8Array(derivative[0].slice(16))); + keys.set(new Uint8Array(derivative[1].slice(0, 16)), 16); + this.iv = Buffer.from(derivative[0].slice(0, 16)); + this.cipherKey = Buffer.from(keys.buffer); + + this.iteration = iteration; + this.seed = seed; + } + + getIteration() { + return this.iteration; + } + + getIv() { + return this.iv; + } + + getCipherKey() { + return this.cipherKey; + } + + getSeed() { + return this.seed; + } +} +module.exports = SenderMessageKey; \ No newline at end of file diff --git a/WhatsAppWeb.Recv.js b/WhatsAppWeb.Recv.js deleted file mode 100644 index 6558fe13022..00000000000 --- a/WhatsAppWeb.Recv.js +++ /dev/null @@ -1,226 +0,0 @@ -const Utils = require("./WhatsAppWeb.Utils") -/* - Contains the code for recieving messages and forwarding what to do with them to the correct functions -*/ -module.exports = function(WhatsAppWeb) { - - const Status = WhatsAppWeb.Status - - WhatsAppWeb.prototype.onMessageRecieved = function (message) { - - if (message[0] === "!") { // when the first character in the message is an '!', the server is updating on the last seen - const timestamp = message.slice(1,message.length) - this.lastSeen = new Date( parseInt(timestamp) ) - } else { - const commaIndex = message.indexOf(",") // all whatsapp messages have a tag and a comma, followed by the actual message - - if (commaIndex < 0) { // if there was no comma, then this message must be not be valid - return this.gotError([2, "invalid message", message]) - } - - var data = message.slice(commaIndex+1, message.length) - if (data.length === 0) { - // got an empty message, usually get one after sending a message or something, just return then - return - } - - let json - if (data[0] === "[" || data[0] === "{") { // if the first character is a "[", then the data must just be plain JSON array or object - json = JSON.parse( data ) // simply parse the JSON - console.log("JSON: " + data) - } else if (this.status === Status.connected) { - /* - If the data recieved was not a JSON, then it must be an encrypted message. - Such a message can only be decrypted if we're connected successfully to the servers & have encryption keys - */ - - data = Buffer.from(data, 'binary') // convert the string to a buffer - const checksum = data.slice(0, 32) // the first 32 bytes of the buffer are the HMAC sign of the message - data = data.slice(32, data.length) // the actual message - - const computedChecksum = Utils.hmacSign(data, this.authInfo.macKey) // compute the sign of the message we recieved using our macKey - - if (checksum.equals(computedChecksum)) { // the checksum the server sent, must match the one we computed for the message to be valid - const decrypted = Utils.aesDecrypt(data, this.authInfo.encKey) // decrypt using AES - json = this.decoder.read( decrypted ) // decode the binary message into a JSON array - } else { - return this.gotError([7, "checksums don't match"]) - } - //console.log("enc_json: " + JSON.stringify(json)) - } else { - // if we recieved a message that was encrypted but we weren't conencted, then there must be an error - return this.gotError([3, "recieved encrypted message when not connected: " + this.status, message]) - } - - //console.log(json) - // the first item in the recieved JSON, if it exists, it tells us what the message is about - switch (json[0]) { - case "Conn": - /* - we get this message when a new connection is established, - whether we're starting a new session or are logging back in. - Sometimes, we also recieve it when one opens their phone - */ - this.validateNewConnection(json[1]) - return - case "Cmd": - /* - WhatsApp usually sends this when we're trying to restore a closed session, - WhatsApp will challenge us to see whether we still have the keys - */ - if (json[1].type === "challenge") { // if it really is a challenge - this.respondToChallenge(json[1].challenge) - } - return - case "action": - /* - this is when some action was taken on a chat or that we recieve a message. - json[1] tells us more about the message, it can be null - */ - if (!json[1]) { // if json[1] is null - json = json[2][0] // set json to the first element in json[2]; it contains the relevant part - - if (json[0] === "read") { // if one marked a chat as read or unread on the phone - const id = json[1].jid.replace("@c.us", "@s.whatsapp.net") // format the sender's ID - if (this.chats[id] && json[1].type === 'false') { // if it was marked unread - this.chats[id].user.count = 1 // up the read count - this.clearUnreadMessages(id) // send notification to the handler about the unread message - } else { // if it was marked read - this.chats[id].user.count = 0 // set the read count to zero - } - } - - } else if (json[1].add === "relay") { // if we just recieved a new message sent to us - this.onNewMessage( json[2][0][2] ) // handle this new message - } else if (json[1].add === "before" || json[1].add === "last") { - /* - if we're recieving a full chat log - if json[1].add equals before: if its non-recent messages - if json[1].add equals last: contains the last message of the conversation between the sender and us - */ - - json = json[2] // json[2] is the relevant part - /* reverse for loop, because messages are sent ordered by most recent - I can order them by recency if I add them in reverse order */ - for (var k = json.length-1;k >= 0;k--) { - const message = json[k] - const id = message[2].key.remoteJid - if (!this.chats[ id ]) { // if we haven't added this ID before, add them now - this.chats[ id ] = {user: { jid: id, count: 0 }, messages: []} - } - - this.chats[id].messages.push(message[2]) // append this message to the array - } - - const id = json[0][2].key.remoteJid // get the ID whose chats we just processed - this.clearUnreadMessages(id) // forward to the handler any any unread messages - } - return - case "response": - // if it is the list of all the people the WhatsApp account has chats with - if (json[1].type === "chat") { - json[2].forEach (chat => { - if (chat[0] === "chat" && chat[1].jid) { - const jid = chat[1].jid.replace("@c.us", "@s.whatsapp.net") // format ID - this.chats[ jid ] = { - user: { - jid: jid, // the ID of the person - count: chat[1].count}, // number of unread messages we have from them - messages: [ ] // empty messages, is filled by content in the previous section - } - } - }) - - } - return - default: - break - } - - /* - if the recieved JSON wasn't an array, then we must have recieved a status for a request we made - this would include creating new sessions, logging in & queries - */ - // if we're connected and we had a pending query - if (this.status === Status.connected) { - if (json.status && this.queryCallbacks.length > 0) { - for (var i in this.queryCallbacks) { - if (this.queryCallbacks[i].queryJSON[1] === "exist") { - this.queryCallbacks[i].callback(json.status == 200, this.queryCallbacks[i].queryJSON[2]) - this.queryCallbacks.splice(i, 1) - break - } - } - } - } else { - // if we're trying to establish a new connection or are trying to log in - switch (json.status) { - case 200: // all good and we can procede to generate a QR code for new connection, or can now login given present auth info - - if (this.status === Status.creatingNewConnection){ // if we're trying to start a connection - if (this.authInfo.encKey && this.authInfo.macKey) { // if we have the info to restore a closed session - this.status = Status.loggingIn - // create the login request - const data = ["admin", "login", this.authInfo.clientToken, this.authInfo.serverToken, this.authInfo.clientID, "takeover"] - this.sendJSON( data ) - } else { - this.generateKeysForAuth(json.ref) - } - } else if (this.queryCallbacks.length > 0) { - for (var i in this.queryCallbacks) { - if (this.queryCallbacks[i].queryJSON[1] == "query") { - this.queryCallbacks[i].callback( ) - } - } - } - - break - case 401: // if the phone was unpaired - this.close() - return this.gotError([json.status, "unpaired from phone", message]) - case 429: // request to login was denied, don't know why it happens - this.close() - return this.gotError([ json.status, "request denied, try reconnecting", message ]) - case 304: // request to generate a new key for a QR code was denied - console.log("reuse previous ref") - return this.gotError([ json.status, "request for new key denied", message ]) - default: - break - } - } - } - } - // shoot off notifications to the handler that new unread message are available - WhatsAppWeb.prototype.clearUnreadMessages = function (id) { - const chat = this.chats[id] // get the chat - var j = 0 - let unreadMessages = chat.user.count - while (unreadMessages > 0) { - if (!chat.messages[j].key.fromMe) { // only forward if the message is from the sender - this.handlers.onUnreadMessage( chat.messages[j] ) // send off the unread message - unreadMessages -= 1 // reduce - } - j += 1 - } - } - // when a new message is recieved - WhatsAppWeb.prototype.onNewMessage = function (message) { - - if (message && message.message) { // confirm that the message really is valid - if (!this.chats[message.key.remoteJid]) { // if we don't have any chats from this ID before, add them to our DB - this.chats[message.key.remoteJid] = { - user: { jid: message.key.remoteJid, count: 0 }, - messages: [ message ] - } - } else { - // if the chat was already there, then insert the message at the front of the array - this.chats[ message.key.remoteJid ].messages.splice(0, 0, message) - } - - if (!message.key.fromMe) { // if this message was sent to us, notify the handler - this.handlers.onUnreadMessage ( message ) - } - } - } - -} \ No newline at end of file diff --git a/WhatsAppWeb.Send.js b/WhatsAppWeb.Send.js deleted file mode 100644 index 53739b7dde1..00000000000 --- a/WhatsAppWeb.Send.js +++ /dev/null @@ -1,96 +0,0 @@ -const Utils = require("./WhatsAppWeb.Utils") - -/* - Contains the code for sending stuff to WhatsApp -*/ -module.exports = function(WhatsAppWeb) { - - // send a read receipt to the given ID on a certain message - WhatsAppWeb.prototype.sendReadReceipt = function (jid, messageID) { - const json = [ - "action", - { epoch: this.msgCount.toString(), type: "set" }, - [ ["read", {count: "1", index: messageID, jid: jid, owner: "false"}, null] ] - ] - this.sendBinary(json, [10, 128]) // encrypt and send off - - if (this.chats[ jid ]) { - this.chats[jid].user.count = 0 // reset read count - } - } - // check if given number is registered on WhatsApp - WhatsAppWeb.prototype.isOnWhatsApp = function (jid, callback) { - const json = [ - "query", - "exist", - jid - ] - this.sendJSON(json) // send - - this.queryCallbacks.push({queryJSON: json, callback: callback}) - } - // tell someone about your presence -- online, typing, offline etc. - WhatsAppWeb.prototype.updatePresence = function (jid, type) { - const json = [ - "action", - { epoch: this.msgCount.toString(), type: "set" }, - [ ["presence", {type: type, to: jid}, null] ] - ] - this.sendBinary(json, [10, 128]) - } - // send a text message to someone, optionally you can provide the time at which you want the message to be sent - WhatsAppWeb.prototype.sendTextMessage = function (id, txt, timestamp=null) { - const message = {conversation: txt} - return this.sendMessage(id, message, timestamp) - } - // generic send message construct - WhatsAppWeb.prototype.sendMessage = function (id, message, timestamp=null) { - if (!timestamp) { // if no timestamp was provided, - timestamp = new Date() // set timestamp to now - } - timestamp = timestamp.getTime()/1000 - - const messageJSON = { - key: { - remoteJid: id, - fromMe: true, - id: Utils.generateMessageID() - }, - message: message, - messageTimestamp: timestamp, - status: "ERROR" - } - - const json = [ - "action", - {epoch: this.msgCount.toString(), type: "relay" }, - [ ['message', null, messageJSON] ] - ] - return this.sendBinary(json, [16, 128]) - } - // send a binary message, the tags parameter tell WhatsApp what the message is all about - WhatsAppWeb.prototype.sendBinary = function (json, tags) { - const binary = this.encoder.write(json) // encode the JSON to the WhatsApp binary format - - var buff = Utils.aesEncrypt(binary, this.authInfo.encKey) // encrypt it using AES and our encKey - const sign = Utils.hmacSign(buff, this.authInfo.macKey) // sign the message using HMAC and our macKey - - buff = Buffer.concat([ - Buffer.from( Utils.generateMessageTag() + "," ), // generate & prefix the message tag - Buffer.from(tags), // prefix some bytes that tell whatsapp what the message is about - sign, // the HMAC sign of the message - buff // the actual encrypted buffer - ]) - this.send(buff) // send it off - } - // send a JSON message to WhatsApp servers - WhatsAppWeb.prototype.sendJSON = function (json) { - const str = JSON.stringify(json) - this.send( Utils.generateMessageTag() + "," + str ) - } - WhatsAppWeb.prototype.send = function (m) { - this.msgCount += 1 // increment message count, it makes the 'epoch' field when sending binary messages - this.conn.send( m ) - } - -} \ No newline at end of file diff --git a/WhatsAppWeb.Session.js b/WhatsAppWeb.Session.js deleted file mode 100644 index ab73d54b34e..00000000000 --- a/WhatsAppWeb.Session.js +++ /dev/null @@ -1,203 +0,0 @@ -const WebSocket = require('ws') -const Curve = require ('curve25519-js') -const HKDF = require('futoin-hkdf') -const Utils = require('./WhatsAppWeb.Utils') -const QR = require('qrcode-terminal') - -/* - Contains the code for connecting to WhatsApp Web, establishing a new session & logging back in -*/ -module.exports = function (WhatsAppWeb) { - const Status = WhatsAppWeb.Status - - // connect to the WhatsApp Web servers - WhatsAppWeb.prototype.connect = function () { - if (this.status != Status.notConnected) { - return this.gotError([1, "already connected or connecting"]) - } - - this.status = Status.connecting - - this.conn = new WebSocket("wss://web.whatsapp.com/ws", {origin: "https://web.whatsapp.com"}) - - this.conn.on('open', () => this.onConnect()) - this.conn.on('message', (m) => this.onMessageRecieved(m)) // in WhatsAppWeb.Recv.js - this.conn.on('error', (error) => { // if there was an error in the WebSocket - this.close() - this.gotError([20, error]) - }) - this.conn.on('close', () => { }) - } - // once a connection has been successfully established - WhatsAppWeb.prototype.onConnect = function () { - console.log("connected to WhatsApp Web") - - this.status = Status.creatingNewConnection - if (!this.authInfo) { // if no auth info is present, that is, a new session has to be established - this.authInfo = { clientID: Utils.generateClientID() } // generate a client ID - } - - const data = ["admin", "init", WhatsAppWeb.version, WhatsAppWeb.browserDescriptions, this.authInfo.clientID, true] - - this.sendJSON( data ) - } - // restore a previously closed session using the given authentication information - WhatsAppWeb.prototype.login = function (authInfo) { - this.authInfo = { - clientID: authInfo.clientID, - serverToken: authInfo.serverToken, - clientToken: authInfo.clientToken, - encKey: Buffer.from( authInfo.encKey, 'base64' ), - macKey: Buffer.from( authInfo.macKey, 'base64' ) - } - - this.connect() - } - // once the QR code is scanned and we can validate our connection, - // or we resolved the challenge when logging back in - WhatsAppWeb.prototype.validateNewConnection = function (json) { - if (json.connected) { // only if we're connected - if (!json.secret) { // if we didn't get a secret, that is we don't need it - return this.didConnectSuccessfully() - } - const secret = Buffer.from(json.secret, 'base64') - - if (secret.length !== 144) { - return this.gotError([4, "incorrect secret length: " + secret.length]) - } - // generate shared key from our private key & the secret shared by the server - const sharedKey = Curve.sharedKey( this.curveKeys.private, secret.slice(0, 32) ) - // expand the key to 80 bytes using HKDF - const expandedKey = HKDF(sharedKey, 80, [ Buffer.alloc(32), '', 'SHA-256' ]) - - // perform HMAC validation. - const hmacValidationKey = expandedKey.slice(32, 64) - const hmacValidationMessage = Buffer.concat( [ secret.slice(0, 32), secret.slice(64, secret.length) ] ) - - const hmac = Utils.hmacSign(hmacValidationMessage, hmacValidationKey) - - if ( hmac.equals(secret.slice(32, 64)) ) { // computed HMAC should equal secret[32:64] - // expandedKey[64:] + secret[64:] are the keys, encrypted using AES, that are used to encrypt/decrypt the messages recieved from WhatsApp - // they are encrypted using key: expandedKey[0:32] - const encryptedAESKeys = Buffer.concat([ expandedKey.slice(64, expandedKey.length), secret.slice(64, secret.length) ]) - const decryptedKeys = Utils.aesDecrypt(encryptedAESKeys, expandedKey.slice(0,32)) - - // this data is required to restore closed sessions - this.authInfo = { - encKey: decryptedKeys.slice(0, 32), // first 32 bytes form the key to encrypt/decrypt messages - macKey: decryptedKeys.slice(32, 64), // last 32 bytes from the key to sign messages - clientToken: json.clientToken, - serverToken: json.serverToken, - clientID: this.authInfo.clientID - } - this.userMetaData = { - id: json.wid, // one's WhatsApp ID [cc][number]@s.whatsapp.net - name: json.pushname, // name set on whatsapp - phone: json.phone // information about the phone one has logged in to - } - this.status = Status.CONNECTED - - this.didConnectSuccessfully() - } else { // if the checksums didn't match - this.close() - this.gotError([5, "HMAC validation failed"]) - } - } else { // if we didn't get the connected field (usually we get this message when one opens WhatsApp on their phone) - if (this.status !== Status.connected) { // and we're not already connected - this.close() - this.gotError([6, "json connection failed", json]) - } - } - } - /* - when logging back in (restoring a previously closed session), WhatsApp may challenge one to check if one still has the encryption keys - WhatsApp does that by asking for us to sign a string it sends with our macKey - */ - WhatsAppWeb.prototype.respondToChallenge = function (challenge) { - const bytes = Buffer.from(challenge, 'base64') // decode the base64 encoded challenge string - const signed = Utils.hmacSign(bytes, this.authInfo.macKey).toString('base64') // sign the challenge string with our macKey - const data = ["admin", "challenge", signed, this.authInfo.serverToken, this.authInfo.clientID] // prepare to send this signed string with the serverToken & clientID - - console.log( "resolving challenge" ) - - this.sendJSON( data ) - } - /* - when starting a new session, generate a QR code by generating a private/public key pair & the keys the server sends - */ - WhatsAppWeb.prototype.generateKeysForAuth = function (ref) { - this.curveKeys = Curve.generateKeyPair( Utils.randomBytes(32) ) - - const publicKeyStr = Buffer.from(this.curveKeys.public).toString('base64') - //console.log ("private key: " + Buffer.from(this.curveKeys.private) ) - - let str = ref + "," + publicKeyStr + "," + this.authInfo.clientID - - console.log("authenticating... Converting to QR: " + str) - - QR.generate(str, {small: true}) - } - // send a keep alive request every 25 seconds, server updates & responds with last seen - WhatsAppWeb.prototype.startKeepAliveRequest = function () { - this.keepAliveReq = setInterval(() => { - const diff = (new Date().getTime()-this.lastSeen.getTime())/1000 - /* - check if it's been a suspicious amount of time since the server responded with our last seen - could be that the network is down, or the phone got disconnected or unpaired - */ - if (diff > 25+10) { - console.log("disconnected") - - this.close() - if (this.handlers.onDisconnect) - this.handlers.onDisconnect() - - if (this.autoReconnect) { // attempt reconnecting if the user wants us to - // keep trying to connect - this.reconnectLoop = setInterval( () => { - // only connect if we're not already in the prcoess of connectin - if (this.status === Status.notConnected) { - this.connect() - } - }, 10 * 1000) - } - } else { // if its all good, send a keep alive request - this.send( "?,," ) - } - }, 25 * 1000) - } - // disconnect from the phone. Your auth credentials become invalid after sending a disconnect request. - // use close() if you just want to close the connection - WhatsAppWeb.prototype.disconnect = function () { - if (this.status === Status.connected) { - this.conn.send('goodbye,["admin","Conn","disconnect"]', null, () => { - this.conn.close() - if (this.handlers.onDisconnect) - this.handlers.onDisconnect() - }) - } else if (this.conn) { - this.close() - } - } - // close the connection - WhatsAppWeb.prototype.close = function () { - this.conn.close() - this.conn = null - this.status = Status.notConnected - this.msgCount = 0 - this.chats = {} - - if (this.keepAliveReq) { - clearInterval(this.keepAliveReq) - } - } - // request a new QR code from the server (HAVEN'T TESTED THIS OUT YET) - WhatsAppWeb.prototype.requestNewQRCode = function () { - if (this.status !== Status.creatingNewConnection) { // if we're not in the process of connecting - return - } - const json = ["admin", "Conn", "reref"] - this.sendJSON(json) - } - -} \ No newline at end of file diff --git a/WhatsAppWeb.Utils.js b/WhatsAppWeb.Utils.js deleted file mode 100644 index 5e583d9103b..00000000000 --- a/WhatsAppWeb.Utils.js +++ /dev/null @@ -1,31 +0,0 @@ -const Crypto = require("crypto") - -/* - Basic cryptographic utilities to interact with WhatsApp servers -*/ -module.exports = { - // decrypt AES 256 CBC; where the IV is prefixed to the buffer - aesDecrypt: function (buffer, key) { - const aes = Crypto.createDecipheriv('aes-256-cbc', key, buffer.slice(0,16) ) // first 16 bytes of buffer is IV - return Buffer.concat( [ aes.update(buffer.slice(16, buffer.length)), aes.final() ] ) - }, - // encrypt AES 256 CBC; where the IV is prefixed to the buffer - aesEncrypt: function (buffer, key) { - const IV = this.randomBytes(16) - const aes = Crypto.createCipheriv('aes-256-cbc', key, IV) - return Buffer.concat( [ IV, aes.update(buffer), aes.final() ] ) // prefix IV to the buffer - }, - // sign HMAC using SHA 256 - hmacSign: function (buffer, key) { - return Crypto.createHmac('sha256', key).update(buffer).digest() - }, - // generate a buffer with random bytes of the specified length - randomBytes: function (length) { return Crypto.randomBytes(length) }, - - // whatsapp requires a message tag for every message, we just use the timestamp as one - generateMessageTag: function () { return new Date().getTime().toString() }, - // generate a random 16 byte client ID - generateClientID: function () { return this.randomBytes(16).toString('base64') }, - // generate a random 10 byte ID to attach to a message - generateMessageID: function () { return this.randomBytes(10).toString('hex').toUpperCase() } -} \ No newline at end of file diff --git a/WhatsAppWeb.js b/WhatsAppWeb.js deleted file mode 100644 index 1f46c98e79b..00000000000 --- a/WhatsAppWeb.js +++ /dev/null @@ -1,81 +0,0 @@ -const BinaryCoding = require('./binary_coding/binary_encoder.js') - -class WhatsAppWeb { - - static version = [0,4,1296] // the version of WhatsApp Web we're telling the servers we are - static browserDescriptions = ["Baileys", "Baileys"] - - static Status = { - notConnected: 0, - connecting: 1, - creatingNewConnection: 3, - loggingIn: 4, - connected: 5 - } - - // set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send - static Presence = { - available: "available", // "online" - unavailable: "unavailable", // offline - composing: "composing", // "typing..." - recording: "recording", // "recording..." - paused: "paused" // I have no clue - } - - constructor() { - this.conn = null // the websocket connection - - this.authInfo = null // the auth info used to extablish new connections & restore connections - - this.userMetaData = null // metadata of the user i.e. name, phone number, phone stats - this.chats = {} // all chats of the user, mapped by the user ID - this.handlers = {} // data for the event handlers - this.msgCount = 0 // number of messages sent to the server; required field for sending messages etc. - this.autoReconnect = true // reconnect automatically after an unexpected disconnect - this.lastSeen = null // updated by sending a keep alive request to the server, and the server responds with our updated last seen - - this.queryCallbacks = [] - - this.encoder = new BinaryCoding.Encoder() - this.decoder = new BinaryCoding.Decoder() - - this.status = WhatsAppWeb.Status.notConnected - } - // error is a json array: [errorCode, "error description", optionalDescription] - gotError (error) { - this.handlers.onError(error) // tell the handler, we got an error - } - // called when established a connection to the WhatsApp servers successfully - didConnectSuccessfully () { - console.log("connected successfully") - - this.status = WhatsAppWeb.Status.connected // update our status - this.lastSeen = new Date() // set last seen to right now - this.startKeepAliveRequest() // start sending keep alive requests (keeps the WebSocket alive & updates our last seen) - - if (this.reconnectLoop) { // if we connected after being disconnected - clearInterval(this.reconnectLoop) // kill the loop to reconnect us - } else { // if we connected for the first time, i.e. not after being disconnected - if (this.handlers.onConnected) // tell the handler that we're connected - this.handlers.onConnected() - } - } - // base 64 encode the authentication credentials and return them, these can then be saved used to login again - // see login () in WhatsAppWeb.Session - base64EncodedAuthInfo () { - return { - clientID: this.authInfo.clientID, - serverToken: this.authInfo.serverToken, - clientToken: this.authInfo.clientToken, - encKey: this.authInfo.encKey.toString('base64'), - macKey: this.authInfo.macKey.toString('base64') - } - } -} - -/* import the rest of the code */ -require("./WhatsAppWeb.Session.js")(WhatsAppWeb) -require("./WhatsAppWeb.Recv.js")(WhatsAppWeb) -require("./WhatsAppWeb.Send.js")(WhatsAppWeb) - -module.exports = WhatsAppWeb \ No newline at end of file diff --git a/binary_coding/.DS_Store b/binary_coding/.DS_Store deleted file mode 100644 index 73d41478af9..00000000000 Binary files a/binary_coding/.DS_Store and /dev/null differ diff --git a/binary_coding/binary_coding_tests.js b/binary_coding/binary_coding_tests.js deleted file mode 100644 index e733ad4ebe8..00000000000 --- a/binary_coding/binary_coding_tests.js +++ /dev/null @@ -1,25 +0,0 @@ -const assert = require('assert').strict -const BinaryCoding = require("./binary_encoder.js") - -const testingPairs = [ - [ - "f806092f5a0a10f804f80234fc6c0a350a1b39313735323938373131313740732e77686174736170702e6e657410011a143345423030393637354537454433374141424632122b0a292a7069616e6f20726f6f6d2074696d696e6773206172653a2a0a20363a3030414d2d31323a3030414d18b3faa7f3052003f80234fc4c0a410a1b39313735323938373131313740732e77686174736170702e6e657410001a20304643454335333330463634393239433645394132434646443242433845414418bdfaa7f305c00101f80234fc930a350a1b39313735323938373131313740732e77686174736170702e6e657410011a14334542303033433742353339414644303937353312520a50536f727279206672656e2c204920636f756c646e277420756e6465727374616e6420274c69627261272e2054797065202768656c702720746f206b6e6f77207768617420616c6c20492063616e20646f18c1faa7f3052003f80234fc540a410a1b39313735323938373131313740732e77686174736170702e6e657410001a20413132333042384436423041314437393345433241453245413043313638443812090a076c69627261727918c2faa7f305", - ["action",{"last":"true","add":"before"},[["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":true,"id":"3EB009675E7ED37AABF2"},"message":{"conversation":"*piano room timings are:*\n 6:00AM-12:00AM"},"messageTimestamp":"1584004403","status":"DELIVERY_ACK"}],["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":false,"id":"0FCEC5330F64929C6E9A2CFFD2BC8EAD"},"messageTimestamp":"1584004413","messageStubType":"REVOKE"}],["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":true,"id":"3EB003C7B539AFD09753"},"message":{"conversation":"Sorry fren, I couldn't understand 'Libra'. Type 'help' to know what all I can do"},"messageTimestamp":"1584004417","status":"DELIVERY_ACK"}],["message",null,{"key":{"remoteJid":"917529871117@s.whatsapp.net","fromMe":false,"id":"A1230B8D6B0A1D793EC2AE2EA0C168D8"},"message":{"conversation":"library"},"messageTimestamp":"1584004418"}]]] - ] -] -function testCoding () { - const encoder = new BinaryCoding.Encoder() - const decoder = new BinaryCoding.Decoder() - - testingPairs.forEach(pair => { - const buff = Buffer.from(pair[0], 'hex') - const decoded = decoder.read(buff) - - assert.deepEqual( JSON.stringify( decoded ), JSON.stringify( pair[1] )) - - const encoded = encoder.write(decoded) - assert.deepEqual(encoded, buff) - }) - console.log("all coding tests passed") -} -testCoding() diff --git a/binary_coding/binary_encoder.js b/binary_coding/binary_encoder.js deleted file mode 100644 index 6dfe94fb4f4..00000000000 --- a/binary_coding/binary_encoder.js +++ /dev/null @@ -1,476 +0,0 @@ -const ProtoBuf = require("protobufjs") - -const WATags = { - LIST_EMPTY: 0, - STREAM_END: 2, - DICTIONARY_0: 236, - DICTIONARY_1: 237, - DICTIONARY_2: 238, - DICTIONARY_3: 239, - LIST_8 : 248, - LIST_16 : 249, - JID_PAIR : 250, - HEX_8 : 251, - BINARY_8 : 252, - BINARY_20 : 253, - BINARY_32 : 254, - NIBBLE_8 : 255, - SINGLE_BYTE_MAX: 256, - PACKED_MAX: 254 -} -const WADoubleByteTokens = [] - -const WASingleByteTokens = [ - null,null,null,"200","400","404","500","501","502","action","add", - "after","archive","author","available","battery","before","body", - "broadcast","chat","clear","code","composing","contacts","count", - "create","debug","delete","demote","duplicate","encoding","error", - "false","filehash","from","g.us","group","groups_v2","height","id", - "image","in","index","invis","item","jid","kind","last","leave", - "live","log","media","message","mimetype","missing","modify","name", - "notification","notify","out","owner","participant","paused", - "picture","played","presence","preview","promote","query","raw", - "read","receipt","received","recipient","recording","relay", - "remove","response","resume","retry","s.whatsapp.net","seconds", - "set","size","status","subject","subscribe","t","text","to","true", - "type","unarchive","unavailable","url","user","value","web","width", - "mute","read_only","admin","creator","short","update","powersave", - "checksum","epoch","block","previous","409","replaced","reason", - "spam","modify_tag","message_info","delivery","emoji","title", - "description","canonical-url","matched-text","star","unstar", - "media_key","filename","identity","unread","page","page_count", - "search","media_message","security","call_log","profile","ciphertext", - "invite","gif","vcard","frequent","privacy","blacklist","whitelist", - "verify","location","document","elapsed","revoke_invite","expiration", - "unsubscribe","disable","vname","old_jid","new_jid","announcement", - "locked","prop","label","color","call","offer","call-id", - "quick_reply", "sticker", "pay_t", "accept", "reject", "sticker_pack", - "invalid", "canceled", "missed", "connected", "result", "audio", - "video", "recent" -] -const WebMessageInfo = ProtoBuf.Root.fromJSON( require("./whatsapp_message_coding.json") ).lookupType("proto.WebMessageInfo") - -class WhatsAppBinaryEncoder { - - constructor () { - this.data = [] - } - pushByte (value) { - - this.data.push((value & 0xFF)) - } - pushInt (value, n, littleEndian=false) { - for (var i = 0; i < n;i++) { - const curShift = littleEndian ? i : (n-1-i) - this.data.push( (value>>(curShift*8)) & 0xFF ) - } - } - pushInt20 (value) { - this.pushBytes ( [(value >> 16) & 0x0F, (value >> 8) & 0xFF, value & 0xFF] ) - } - pushInt16 (value) { - this.pushInt(value, 2) - } - pushInt32 (value) { - this.pushInt(value, 4) - } - pushInt64 (value) { - this.pushInt(value, 8) - } - pushBytes (bytes) { - this.data.push.apply(this.data, bytes) - } - pushString (str) { - const bytes = new TextEncoder('utf-8').encode(str) - this.pushBytes(bytes) - } - writeByteLength (length) { - if (length >= 4294967296) { - throw "string too large to encode: " + length - } - - if (length >= (1<<20)) { - this.pushByte(WATags.BINARY_32) - this.pushInt32(length) - } else if (length >= 256) { - this.pushByte(WATags.BINARY_20) - this.pushInt20(length) - } else { - this.pushByte(WATags.BINARY_8) - this.pushByte(length) - } - } - writeStringRaw (string) { - this.writeByteLength( string.length ) - this.pushString(string) - } - writeJid(left,right) { - this.pushByte(WATags.JID_PAIR) - if (left && left.length > 0) { - this.writeString(left) - } else { - this.writeToken(WATags.LIST_EMPTY) - } - this.writeString(right) - } - writeToken (token) { - if (token < 245) { - this.pushByte(token) - } else if (token <= 500) { - throw "invalid token" - } - } - writeString(token, i=null) { - if (typeof token !== "string") { - throw "invalid string: " + token - } - - if (token === "c.us") { - token = "s.whatsapp.net" - } - - - const tokenIndex = WASingleByteTokens.indexOf(token) - if (!i && token === "s.whatsapp.net") { - this.writeToken( tokenIndex ) - } else if ( tokenIndex >= 0 ) { - if (tokenIndex < WATags.SINGLE_BYTE_MAX) { - this.writeToken(tokenIndex) - } else { - const overflow = tokenIndex-WATags.SINGLE_BYTE_MAX - const dictionaryIndex = overflow >> 8 - if (dictionaryIndex < 0 || dictionaryIndex > 3) { - throw "double byte dict token out of range: " + token + ", " + tokenIndex - } - this.writeToken(WATags.DICTIONARY_0 + dictionaryIndex) - this.writeToken(overflow % 256) - } - } else { - const jidSepIndex = token.indexOf("@") - - if (jidSepIndex <= 0) { - this.writeStringRaw(token) - } else { - this.writeJid(token.slice(0,jidSepIndex), token.slice(jidSepIndex+1, token.length)) - } - } - } - writeAttributes (attrs) { - if (!attrs) { - return - } - Object.keys(attrs).forEach (key => { - this.writeString( key ) - this.writeString( attrs[key] ) - }) - } - writeListStart (listSize) { - if (listSize === 0) { - this.pushByte(WATags.LIST_EMPTY) - } else if (listSize < 256) { - this.pushBytes([WATags.LIST_8, listSize]) - } else { - this.pushByte([WATags.LIST_16, listSize]) - } - } - writeChildren (children) { - if (!children) { - return - } - - if (typeof children === "string") { - this.writeString(children, true) - } else if (typeof children === "Buffer" || typeof children === "Uint8Array") { - this.writeByteLength(children.length) - this.pushBytes(children) - } else if (Array.isArray(children)) { - this.writeListStart(children.length) - children.forEach (c => { - this.writeNode(c) - }) - } else if (typeof children === "object") { - //console.log(children) - const buff = WebMessageInfo.encode(children).finish() - this.writeByteLength(buff.length) - this.pushBytes(buff) - } else { - throw "invalid children: " + children + " (" + (typeof children) + ")" - } - } - getNumValidKeys (arr) { - return arr ? Object.keys(arr).length : 0 - } - writeNode (node) { - if (!node) { - return - } else if (!Array.isArray(node) || node.length !== 3) { - throw "invalid node given: " + node - } - - const numAttributes = this.getNumValidKeys(node[1]) - - this.writeListStart( 2*numAttributes + 1 + ( node[2] ? 1 : 0 ) ) - this.writeString(node[0]) - this.writeAttributes(node[1]) - this.writeChildren(node[2]) - } - write (data) { - this.data = new Array() - this.writeNode(data) - - return Buffer.from(this.data) - } -} -class WhatsAppBinaryDecoder { - - constructor () { - this.buffer = null - this.index = 0 - - } - checkEOS (length) { - if (this.index+length > this.buffer.length) { - throw "end of stream" - } - } - next () { - const value = this.buffer[this.index] - this.index += 1 - return value - } - readByte () { - this.checkEOS(1) - return this.next() - } - - readInt (n, littleEndian=false) { - this.checkEOS(n) - let val = 0 - for (var i = 0; i < n;i++) { - const shift = (littleEndian) ? i : (n-1-i) - val |= this.next() << (shift*8) - } - return val - } - readInt16 (littleEndian=false) { - return this.readInt(2, littleEndian) - } - readInt20 () { - this.checkEOS(3) - return ( (this.next() & 15) << 16 ) + (this.next()<<8) + this.next() - } - readInt32 (littleEndian=false) { - return this.readInt(4, littleEndian) - } - readInt64 (littleEndian=false) { - return this.readInt(8, littleEndian) - } - unpackHex (value) { - if (value >= 0 && value < 16) { - return value<10 ? ('0'.charCodeAt(0)+value) : ('A'.charCodeAt(0)+value-10) - } - throw "invalid hex: " + value - } - unpackNibble(value) { - if (value >= 0 && value <= 9) { - return '0'.charCodeAt(0)+value - } - switch (value) { - case 10: - return '-'.charCodeAt(0) - case 11: - return '.'.charCodeAt(0) - case 15: - return '\0'.charCodeAt(0) - default: - throw "invalid nibble: " + value - } - } - unpackByte (tag, value) { - if (tag === WATags.NIBBLE_8) { - return this.unpackNibble(value) - } else if (tag === WATags.HEX_8) { - return this.unpackHex(value) - } else { - throw "unknown tag: " + tag - } - } - readPacked8(tag) { - const startByte = this.readByte() - let value = "" - - for (var i = 0; i < (startByte&127);i++) { - let curByte = this.readByte() - value += String.fromCharCode( this.unpackByte(tag, (curByte&0xF0) >> 4) ) - value += String.fromCharCode( this.unpackByte(tag, curByte&0x0F) ) - } - if ((startByte >> 7) !== 0) { - value = value.slice(0,-1) - } - return value - - } - readRangedVarInt (min, max, description="unknown") { - // value = - throw "WTF" - } - isListTag (tag) { - return tag === WATags.LIST_EMPTY || tag === WATags.LIST_8 || tag === WATags.LIST_16 - } - readListSize (tag) { - switch (tag) { - case WATags.LIST_EMPTY: - return 0 - case WATags.LIST_8: - return this.readByte() - case WATags.LIST_16: - return this.readInt16() - default: - throw "invalid tag for list size: " + tag - } - } - readStringFromChars (length) { - this.checkEOS(length) - const value = this.buffer.slice(this.index, this.index+length) - - this.index += length - return new TextDecoder('utf-8').decode(value) - } - readString (tag) { - if (tag >= 3 && tag <= 235) { - const token = this.getToken(tag) - return token === "s.whatsapp.net" ? "c.us" : token - } - - switch (tag) { - case WATags.DICTIONARY_0: - case WATags.DICTIONARY_1: - case WATags.DICTIONARY_2: - case WATags.DICTIONARY_3: - return this.getTokenDouble( tag - WATags.DICTIONARY_0, this.readByte() ) - case WATags.LIST_EMPTY: - return null - case WATags.BINARY_8: - return this.readStringFromChars( this.readByte() ) - case WATags.BINARY_20: - return this.readStringFromChars( this.readInt20() ) - case WATags.BINARY_32: - return this.readStringFromChars( this.readInt32() ) - case WATags.JID_PAIR: - const i = this.readString( this.readByte() ) - const j = this.readString( this.readByte() ) - if (i && j) { - return i + "@" + j - } - throw "invalid jid pair: " + i + ", " + j - case WATags.HEX_8: - case WATags.NIBBLE_8: - return this.readPacked8(tag) - default: - throw "invalid string with tag: " + tag - } - } - readAttributes (n) { - if (n !== 0) { - let attributes = {} - for (var i = 0;i < n;i++) { - const index = this.readString(this.readByte()) - const b = this.readByte() - - attributes[index] = this.readString(b) - } - return attributes - } else { - return null - } - } - readList (tag) { - let list = Array( this.readListSize(tag) ) - for (var i = 0;i < list.length;i++) { - list[i] = this.readNode() - } - return list - } - readBytes (n) { - this.checkEOS(n) - const value = this.buffer.slice(this.index, this.index+n) - this.index += n - return value - } - getToken (index) { - if (index < 3 || index >= WASingleByteTokens.length) { - throw "invalid token index: " + index - } - return WASingleByteTokens[index] - } - getTokenDouble (index1, index2) { - const n = 256*index1 + index2 - if (n < 0 || n > WADoubleByteTokens.length) { - throw "invalid double token index: " + n - } - return WADoubleByteTokens[n] - } - readNode () { - const listSize = this.readListSize( this.readByte() ) - const descrTag = this.readByte() - - if (descrTag === WATags.STREAM_END) { - throw "unexpected stream end" - } - - const descr = this.readString(descrTag) - if (listSize === 0 || !descr) { - throw "invalid node" - } - //console.log(descr + "," + listSize) - - let attrs = this.readAttributes( (listSize-1) >> 1 ) - let content = null - - - if (listSize%2 === 0) { - const tag = this.readByte() - - if (this.isListTag(tag)) { - content = this.readList(tag) - } else { - switch (tag) { - case WATags.BINARY_8: - content = this.readBytes( this.readByte() ) - break - case WATags.BINARY_20: - content = this.readBytes( this.readInt20() ) - break - case WATags.BINARY_32: - content = this.readBytes( this.readInt32() ) - break - default: - content = this.readString(tag) - break - } - } - } - //console.log( descr + "," + JSON.stringify(attrs) + ", " + content) - return [descr, attrs, content] - } - - read (buffer) { - this.buffer = buffer - this.index = 0 - - let node = this.readNode() - - if (node[2]) { - for (var i = 0; i < node[2].length;i++) { - if (node[2][0][0] === "message") { - node[2][i][2] = WebMessageInfo.decode( node[2][i][2] ) - } - } - } - - return node - } - -} - -module.exports = { Encoder: WhatsAppBinaryEncoder, Decoder: WhatsAppBinaryDecoder } \ No newline at end of file diff --git a/binary_coding/def.proto b/binary_coding/def.proto deleted file mode 100644 index 6d4006d764b..00000000000 --- a/binary_coding/def.proto +++ /dev/null @@ -1,671 +0,0 @@ -syntax = "proto2"; -package proto; - -message HydratedQuickReplyButton { - optional string displayText = 1; - optional string id = 2; -} - -message HydratedURLButton { - optional string displayText = 1; - optional string url = 2; -} - -message HydratedCallButton { - optional string displayText = 1; - optional string phoneNumber = 2; -} - -message HydratedTemplateButton { - optional uint32 index = 4; - oneof hydratedButton { - HydratedQuickReplyButton quickReplyButton = 1; - HydratedURLButton urlButton = 2; - HydratedCallButton callButton = 3; - } -} - -message QuickReplyButton { - optional HighlyStructuredMessage displayText = 1; - optional string id = 2; -} - -message URLButton { - optional HighlyStructuredMessage displayText = 1; - optional HighlyStructuredMessage url = 2; -} - -message CallButton { - optional HighlyStructuredMessage displayText = 1; - optional HighlyStructuredMessage phoneNumber = 2; -} - -message TemplateButton { - optional uint32 index = 4; - oneof button { - QuickReplyButton quickReplyButton = 1; - URLButton urlButton = 2; - CallButton callButton = 3; - } -} - -message Location { - optional double degreesLatitude = 1; - optional double degreesLongitude = 2; - optional string name = 3; -} - -message Point { - optional double x = 3; - optional double y = 4; -} - -message InteractiveAnnotation { - repeated Point polygonVertices = 1; - oneof action { - Location location = 2; - } -} - -message AdReplyInfo { - optional string advertiserName = 1; - enum AD_REPLY_INFO_MEDIATYPE { - NONE = 0; - IMAGE = 1; - VIDEO = 2; - } - optional AD_REPLY_INFO_MEDIATYPE mediaType = 2; - optional bytes jpegThumbnail = 16; - optional string caption = 17; -} - -message ContextInfo { - optional string stanzaId = 1; - optional string participant = 2; - optional Message quotedMessage = 3; - optional string remoteJid = 4; - repeated string mentionedJid = 15; - optional string conversionSource = 18; - optional bytes conversionData = 19; - optional uint32 conversionDelaySeconds = 20; - optional uint32 forwardingScore = 21; - optional bool isForwarded = 22; - optional AdReplyInfo quotedAd = 23; - optional MessageKey placeholderKey = 24; - optional uint32 expiration = 25; -} - -message SenderKeyDistributionMessage { - optional string groupId = 1; - optional bytes axolotlSenderKeyDistributionMessage = 2; -} - -message ImageMessage { - optional string url = 1; - optional string mimetype = 2; - optional string caption = 3; - optional bytes fileSha256 = 4; - optional uint64 fileLength = 5; - optional uint32 height = 6; - optional uint32 width = 7; - optional bytes mediaKey = 8; - optional bytes fileEncSha256 = 9; - repeated InteractiveAnnotation interactiveAnnotations = 10; - optional string directPath = 11; - optional int64 mediaKeyTimestamp = 12; - optional bytes jpegThumbnail = 16; - optional ContextInfo contextInfo = 17; - optional bytes firstScanSidecar = 18; - optional uint32 firstScanLength = 19; - optional uint32 experimentGroupId = 20; - optional bytes scansSidecar = 21; - repeated uint32 scanLengths = 22; - optional bytes midQualityFileSha256 = 23; - optional bytes midQualityFileEncSha256 = 24; -} - -message ContactMessage { - optional string displayName = 1; - optional string vcard = 16; - optional ContextInfo contextInfo = 17; -} - -message LocationMessage { - optional double degreesLatitude = 1; - optional double degreesLongitude = 2; - optional string name = 3; - optional string address = 4; - optional string url = 5; - optional bytes jpegThumbnail = 16; - optional ContextInfo contextInfo = 17; -} - -message ExtendedTextMessage { - optional string text = 1; - optional string matchedText = 2; - optional string canonicalUrl = 4; - optional string description = 5; - optional string title = 6; - optional fixed32 textArgb = 7; - optional fixed32 backgroundArgb = 8; - enum EXTENDED_TEXT_MESSAGE_FONTTYPE { - SANS_SERIF = 0; - SERIF = 1; - NORICAN_REGULAR = 2; - BRYNDAN_WRITE = 3; - BEBASNEUE_REGULAR = 4; - OSWALD_HEAVY = 5; - } - optional EXTENDED_TEXT_MESSAGE_FONTTYPE font = 9; - enum EXTENDED_TEXT_MESSAGE_PREVIEWTYPE { - NONE = 0; - VIDEO = 1; - } - optional EXTENDED_TEXT_MESSAGE_PREVIEWTYPE previewType = 10; - optional bytes jpegThumbnail = 16; - optional ContextInfo contextInfo = 17; - optional bool doNotPlayInline = 18; -} - -message DocumentMessage { - optional string url = 1; - optional string mimetype = 2; - optional string title = 3; - optional bytes fileSha256 = 4; - optional uint64 fileLength = 5; - optional uint32 pageCount = 6; - optional bytes mediaKey = 7; - optional string fileName = 8; - optional bytes fileEncSha256 = 9; - optional string directPath = 10; - optional int64 mediaKeyTimestamp = 11; - optional bytes jpegThumbnail = 16; - optional ContextInfo contextInfo = 17; -} - -message AudioMessage { - optional string url = 1; - optional string mimetype = 2; - optional bytes fileSha256 = 3; - optional uint64 fileLength = 4; - optional uint32 seconds = 5; - optional bool ptt = 6; - optional bytes mediaKey = 7; - optional bytes fileEncSha256 = 8; - optional string directPath = 9; - optional int64 mediaKeyTimestamp = 10; - optional ContextInfo contextInfo = 17; - optional bytes streamingSidecar = 18; -} - -message VideoMessage { - optional string url = 1; - optional string mimetype = 2; - optional bytes fileSha256 = 3; - optional uint64 fileLength = 4; - optional uint32 seconds = 5; - optional bytes mediaKey = 6; - optional string caption = 7; - optional bool gifPlayback = 8; - optional uint32 height = 9; - optional uint32 width = 10; - optional bytes fileEncSha256 = 11; - repeated InteractiveAnnotation interactiveAnnotations = 12; - optional string directPath = 13; - optional int64 mediaKeyTimestamp = 14; - optional bytes jpegThumbnail = 16; - optional ContextInfo contextInfo = 17; - optional bytes streamingSidecar = 18; - enum VIDEO_MESSAGE_ATTRIBUTION { - NONE = 0; - GIPHY = 1; - TENOR = 2; - } - optional VIDEO_MESSAGE_ATTRIBUTION gifAttribution = 19; -} - -message Call { - optional bytes callKey = 1; -} - -message Chat { - optional string displayName = 1; - optional string id = 2; -} - -message ProtocolMessage { - optional MessageKey key = 1; - enum PROTOCOL_MESSAGE_TYPE { - REVOKE = 0; - EPHEMERAL_SETTING = 3; - } - optional PROTOCOL_MESSAGE_TYPE type = 2; - optional uint32 ephemeralExpiration = 4; -} - -message ContactsArrayMessage { - optional string displayName = 1; - repeated ContactMessage contacts = 2; - optional ContextInfo contextInfo = 17; -} - -message HSMCurrency { - optional string currencyCode = 1; - optional int64 amount1000 = 2; -} - -message HSMDateTimeComponent { - enum HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE { - MONDAY = 1; - TUESDAY = 2; - WEDNESDAY = 3; - THURSDAY = 4; - FRIDAY = 5; - SATURDAY = 6; - SUNDAY = 7; - } - optional HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE dayOfWeek = 1; - optional uint32 year = 2; - optional uint32 month = 3; - optional uint32 dayOfMonth = 4; - optional uint32 hour = 5; - optional uint32 minute = 6; - enum HSM_DATE_TIME_COMPONENT_CALENDARTYPE { - GREGORIAN = 1; - SOLAR_HIJRI = 2; - } - optional HSM_DATE_TIME_COMPONENT_CALENDARTYPE calendar = 7; -} - -message HSMDateTimeUnixEpoch { - optional int64 timestamp = 1; -} - -message HSMDateTime { - oneof datetimeOneof { - HSMDateTimeComponent component = 1; - HSMDateTimeUnixEpoch unixEpoch = 2; - } -} - -message HSMLocalizableParameter { - optional string default = 1; - oneof paramOneof { - HSMCurrency currency = 2; - HSMDateTime dateTime = 3; - } -} - -message HighlyStructuredMessage { - optional string namespace = 1; - optional string elementName = 2; - repeated string params = 3; - optional string fallbackLg = 4; - optional string fallbackLc = 5; - repeated HSMLocalizableParameter localizableParams = 6; - optional string deterministicLg = 7; - optional string deterministicLc = 8; - optional TemplateMessage hydratedHsm = 9; -} - -message SendPaymentMessage { - optional Message noteMessage = 2; - optional MessageKey requestMessageKey = 3; -} - -message RequestPaymentMessage { - optional Message noteMessage = 4; - optional string currencyCodeIso4217 = 1; - optional uint64 amount1000 = 2; - optional string requestFrom = 3; - optional int64 expiryTimestamp = 5; -} - -message DeclinePaymentRequestMessage { - optional MessageKey key = 1; -} - -message CancelPaymentRequestMessage { - optional MessageKey key = 1; -} - -message LiveLocationMessage { - optional double degreesLatitude = 1; - optional double degreesLongitude = 2; - optional uint32 accuracyInMeters = 3; - optional float speedInMps = 4; - optional uint32 degreesClockwiseFromMagneticNorth = 5; - optional string caption = 6; - optional int64 sequenceNumber = 7; - optional uint32 timeOffset = 8; - optional bytes jpegThumbnail = 16; - optional ContextInfo contextInfo = 17; -} - -message StickerMessage { - optional string url = 1; - optional bytes fileSha256 = 2; - optional bytes fileEncSha256 = 3; - optional bytes mediaKey = 4; - optional string mimetype = 5; - optional uint32 height = 6; - optional uint32 width = 7; - optional string directPath = 8; - optional uint64 fileLength = 9; - optional int64 mediaKeyTimestamp = 10; - optional uint32 firstFrameLength = 11; - optional bytes firstFrameSidecar = 12; - optional ContextInfo contextInfo = 17; -} - -message FourRowTemplate { - optional HighlyStructuredMessage content = 6; - optional HighlyStructuredMessage footer = 7; - repeated TemplateButton buttons = 8; - oneof title { - DocumentMessage documentMessage = 1; - HighlyStructuredMessage highlyStructuredMessage = 2; - ImageMessage imageMessage = 3; - VideoMessage videoMessage = 4; - LocationMessage locationMessage = 5; - } -} - -message HydratedFourRowTemplate { - optional string hydratedContentText = 6; - optional string hydratedFooterText = 7; - repeated HydratedTemplateButton hydratedButtons = 8; - optional string templateId = 9; - oneof title { - DocumentMessage documentMessage = 1; - string hydratedTitleText = 2; - ImageMessage imageMessage = 3; - VideoMessage videoMessage = 4; - LocationMessage locationMessage = 5; - } -} - -message TemplateMessage { - optional ContextInfo contextInfo = 3; - optional HydratedFourRowTemplate hydratedTemplate = 4; - oneof format { - FourRowTemplate fourRowTemplate = 1; - HydratedFourRowTemplate hydratedFourRowTemplate = 2; - } -} - -message TemplateButtonReplyMessage { - optional string selectedId = 1; - optional string selectedDisplayText = 2; - optional ContextInfo contextInfo = 3; - optional uint32 selectedIndex = 4; -} - -message ProductSnapshot { - optional ImageMessage productImage = 1; - optional string productId = 2; - optional string title = 3; - optional string description = 4; - optional string currencyCode = 5; - optional int64 priceAmount1000 = 6; - optional string retailerId = 7; - optional string url = 8; - optional uint32 productImageCount = 9; - optional string firstImageId = 11; -} - -message ProductMessage { - optional ProductSnapshot product = 1; - optional string businessOwnerJid = 2; - optional ContextInfo contextInfo = 17; -} - -message GroupInviteMessage { - optional string groupJid = 1; - optional string inviteCode = 2; - optional int64 inviteExpiration = 3; - optional string groupName = 4; - optional bytes jpegThumbnail = 5; - optional string caption = 6; - optional ContextInfo contextInfo = 7; -} - -message DeviceSentMessage { - optional string destinationJid = 1; - optional Message message = 2; -} - -message DeviceSyncMessage { - optional bytes serializedXmlBytes = 1; -} - -message Message { - optional string conversation = 1; - optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2; - optional ImageMessage imageMessage = 3; - optional ContactMessage contactMessage = 4; - optional LocationMessage locationMessage = 5; - optional ExtendedTextMessage extendedTextMessage = 6; - optional DocumentMessage documentMessage = 7; - optional AudioMessage audioMessage = 8; - optional VideoMessage videoMessage = 9; - optional Call call = 10; - optional Chat chat = 11; - optional ProtocolMessage protocolMessage = 12; - optional ContactsArrayMessage contactsArrayMessage = 13; - optional HighlyStructuredMessage highlyStructuredMessage = 14; - optional SenderKeyDistributionMessage fastRatchetKeySenderKeyDistributionMessage = 15; - optional SendPaymentMessage sendPaymentMessage = 16; - optional LiveLocationMessage liveLocationMessage = 18; - optional RequestPaymentMessage requestPaymentMessage = 22; - optional DeclinePaymentRequestMessage declinePaymentRequestMessage = 23; - optional CancelPaymentRequestMessage cancelPaymentRequestMessage = 24; - optional TemplateMessage templateMessage = 25; - optional StickerMessage stickerMessage = 26; - optional GroupInviteMessage groupInviteMessage = 28; - optional TemplateButtonReplyMessage templateButtonReplyMessage = 29; - optional ProductMessage productMessage = 30; - optional DeviceSentMessage deviceSentMessage = 31; - optional DeviceSyncMessage deviceSyncMessage = 32; -} - -message MessageKey { - optional string remoteJid = 1; - optional bool fromMe = 2; - optional string id = 3; - optional string participant = 4; -} - -message WebFeatures { - enum WEB_FEATURES_FLAG { - NOT_STARTED = 0; - FORCE_UPGRADE = 1; - DEVELOPMENT = 2; - PRODUCTION = 3; - } - optional WEB_FEATURES_FLAG labelsDisplay = 1; - optional WEB_FEATURES_FLAG voipIndividualOutgoing = 2; - optional WEB_FEATURES_FLAG groupsV3 = 3; - optional WEB_FEATURES_FLAG groupsV3Create = 4; - optional WEB_FEATURES_FLAG changeNumberV2 = 5; - optional WEB_FEATURES_FLAG queryStatusV3Thumbnail = 6; - optional WEB_FEATURES_FLAG liveLocations = 7; - optional WEB_FEATURES_FLAG queryVname = 8; - optional WEB_FEATURES_FLAG voipIndividualIncoming = 9; - optional WEB_FEATURES_FLAG quickRepliesQuery = 10; - optional WEB_FEATURES_FLAG payments = 11; - optional WEB_FEATURES_FLAG stickerPackQuery = 12; - optional WEB_FEATURES_FLAG liveLocationsFinal = 13; - optional WEB_FEATURES_FLAG labelsEdit = 14; - optional WEB_FEATURES_FLAG mediaUpload = 15; - optional WEB_FEATURES_FLAG mediaUploadRichQuickReplies = 18; - optional WEB_FEATURES_FLAG vnameV2 = 19; - optional WEB_FEATURES_FLAG videoPlaybackUrl = 20; - optional WEB_FEATURES_FLAG statusRanking = 21; - optional WEB_FEATURES_FLAG voipIndividualVideo = 22; - optional WEB_FEATURES_FLAG thirdPartyStickers = 23; - optional WEB_FEATURES_FLAG frequentlyForwardedSetting = 24; - optional WEB_FEATURES_FLAG groupsV4JoinPermission = 25; - optional WEB_FEATURES_FLAG recentStickers = 26; - optional WEB_FEATURES_FLAG catalog = 27; - optional WEB_FEATURES_FLAG starredStickers = 28; - optional WEB_FEATURES_FLAG voipGroupCall = 29; - optional WEB_FEATURES_FLAG templateMessage = 30; - optional WEB_FEATURES_FLAG templateMessageInteractivity = 31; - optional WEB_FEATURES_FLAG ephemeralMessages = 32; -} - -message TabletNotificationsInfo { - optional uint64 timestamp = 2; - optional uint32 unreadChats = 3; - optional uint32 notifyMessageCount = 4; - repeated NotificationMessageInfo notifyMessage = 5; -} - -message NotificationMessageInfo { - optional MessageKey key = 1; - optional Message message = 2; - optional uint64 messageTimestamp = 3; - optional string participant = 4; -} - -message WebNotificationsInfo { - optional uint64 timestamp = 2; - optional uint32 unreadChats = 3; - optional uint32 notifyMessageCount = 4; - repeated WebMessageInfo notifyMessages = 5; -} - -message PaymentInfo { - optional uint64 amount1000 = 2; - optional string receiverJid = 3; - enum PAYMENT_INFO_STATUS { - UNKNOWN_STATUS = 0; - PROCESSING = 1; - SENT = 2; - NEED_TO_ACCEPT = 3; - COMPLETE = 4; - COULD_NOT_COMPLETE = 5; - REFUNDED = 6; - EXPIRED = 7; - REJECTED = 8; - CANCELLED = 9; - WAITING_FOR_PAYER = 10; - WAITING = 11; - } - optional PAYMENT_INFO_STATUS status = 4; - optional uint64 transactionTimestamp = 5; - optional MessageKey requestMessageKey = 6; - optional uint64 expiryTimestamp = 7; - optional bool futureproofed = 8; - optional string currency = 9; -} - -message WebMessageInfo { - required MessageKey key = 1; - optional Message message = 2; - optional uint64 messageTimestamp = 3; - enum WEB_MESSAGE_INFO_STATUS { - ERROR = 0; - PENDING = 1; - SERVER_ACK = 2; - DELIVERY_ACK = 3; - READ = 4; - PLAYED = 5; - } - optional WEB_MESSAGE_INFO_STATUS status = 4; - optional string participant = 5; - optional bool ignore = 16; - optional bool starred = 17; - optional bool broadcast = 18; - optional string pushName = 19; - optional bytes mediaCiphertextSha256 = 20; - optional bool multicast = 21; - optional bool urlText = 22; - optional bool urlNumber = 23; - enum WEB_MESSAGE_INFO_STUBTYPE { - UNKNOWN = 0; - REVOKE = 1; - CIPHERTEXT = 2; - FUTUREPROOF = 3; - NON_VERIFIED_TRANSITION = 4; - UNVERIFIED_TRANSITION = 5; - VERIFIED_TRANSITION = 6; - VERIFIED_LOW_UNKNOWN = 7; - VERIFIED_HIGH = 8; - VERIFIED_INITIAL_UNKNOWN = 9; - VERIFIED_INITIAL_LOW = 10; - VERIFIED_INITIAL_HIGH = 11; - VERIFIED_TRANSITION_ANY_TO_NONE = 12; - VERIFIED_TRANSITION_ANY_TO_HIGH = 13; - VERIFIED_TRANSITION_HIGH_TO_LOW = 14; - VERIFIED_TRANSITION_HIGH_TO_UNKNOWN = 15; - VERIFIED_TRANSITION_UNKNOWN_TO_LOW = 16; - VERIFIED_TRANSITION_LOW_TO_UNKNOWN = 17; - VERIFIED_TRANSITION_NONE_TO_LOW = 18; - VERIFIED_TRANSITION_NONE_TO_UNKNOWN = 19; - GROUP_CREATE = 20; - GROUP_CHANGE_SUBJECT = 21; - GROUP_CHANGE_ICON = 22; - GROUP_CHANGE_INVITE_LINK = 23; - GROUP_CHANGE_DESCRIPTION = 24; - GROUP_CHANGE_RESTRICT = 25; - GROUP_CHANGE_ANNOUNCE = 26; - GROUP_PARTICIPANT_ADD = 27; - GROUP_PARTICIPANT_REMOVE = 28; - GROUP_PARTICIPANT_PROMOTE = 29; - GROUP_PARTICIPANT_DEMOTE = 30; - GROUP_PARTICIPANT_INVITE = 31; - GROUP_PARTICIPANT_LEAVE = 32; - GROUP_PARTICIPANT_CHANGE_NUMBER = 33; - BROADCAST_CREATE = 34; - BROADCAST_ADD = 35; - BROADCAST_REMOVE = 36; - GENERIC_NOTIFICATION = 37; - E2E_IDENTITY_CHANGED = 38; - E2E_ENCRYPTED = 39; - CALL_MISSED_VOICE = 40; - CALL_MISSED_VIDEO = 41; - INDIVIDUAL_CHANGE_NUMBER = 42; - GROUP_DELETE = 43; - GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE = 44; - CALL_MISSED_GROUP_VOICE = 45; - CALL_MISSED_GROUP_VIDEO = 46; - PAYMENT_CIPHERTEXT = 47; - PAYMENT_FUTUREPROOF = 48; - PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED = 49; - PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED = 50; - PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED = 51; - PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP = 52; - PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP = 53; - PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER = 54; - PAYMENT_ACTION_SEND_PAYMENT_REMINDER = 55; - PAYMENT_ACTION_SEND_PAYMENT_INVITATION = 56; - PAYMENT_ACTION_REQUEST_DECLINED = 57; - PAYMENT_ACTION_REQUEST_EXPIRED = 58; - PAYMENT_ACTION_REQUEST_CANCELLED = 59; - BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM = 60; - BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP = 61; - BIZ_INTRO_TOP = 62; - BIZ_INTRO_BOTTOM = 63; - BIZ_NAME_CHANGE = 64; - BIZ_MOVE_TO_CONSUMER_APP = 65; - BIZ_TWO_TIER_MIGRATION_TOP = 66; - BIZ_TWO_TIER_MIGRATION_BOTTOM = 67; - OVERSIZED = 68; - GROUP_CHANGE_NO_FREQUENTLY_FORWARDED = 69; - GROUP_V4_ADD_INVITE_SENT = 70; - GROUP_PARTICIPANT_ADD_REQUEST_JOIN = 71; - CHANGE_EPHEMERAL_SETTING = 72; - } - optional WEB_MESSAGE_INFO_STUBTYPE messageStubType = 24; - optional bool clearMedia = 25; - repeated string messageStubParameters = 26; - optional uint32 duration = 27; - repeated string labels = 28; - optional PaymentInfo paymentInfo = 29; - optional LiveLocationMessage finalLiveLocation = 30; - optional PaymentInfo quotedPaymentInfo = 31; - optional uint64 ephemeralStartTimestamp = 32; - optional uint32 ephemeralDuration = 33; -} \ No newline at end of file diff --git a/binary_coding/whatsapp_message_coding.json b/binary_coding/whatsapp_message_coding.json deleted file mode 100644 index de6f89a2551..00000000000 --- a/binary_coding/whatsapp_message_coding.json +++ /dev/null @@ -1,1889 +0,0 @@ -{ - "nested": { - "proto": { - "nested": { - "HydratedQuickReplyButton": { - "fields": { - "displayText": { - "type": "string", - "id": 1 - }, - "id": { - "type": "string", - "id": 2 - } - } - }, - "HydratedURLButton": { - "fields": { - "displayText": { - "type": "string", - "id": 1 - }, - "url": { - "type": "string", - "id": 2 - } - } - }, - "HydratedCallButton": { - "fields": { - "displayText": { - "type": "string", - "id": 1 - }, - "phoneNumber": { - "type": "string", - "id": 2 - } - } - }, - "HydratedTemplateButton": { - "oneofs": { - "hydratedButton": { - "oneof": [ - "quickReplyButton", - "urlButton", - "callButton" - ] - } - }, - "fields": { - "index": { - "type": "uint32", - "id": 4 - }, - "quickReplyButton": { - "type": "HydratedQuickReplyButton", - "id": 1 - }, - "urlButton": { - "type": "HydratedURLButton", - "id": 2 - }, - "callButton": { - "type": "HydratedCallButton", - "id": 3 - } - } - }, - "QuickReplyButton": { - "fields": { - "displayText": { - "type": "HighlyStructuredMessage", - "id": 1 - }, - "id": { - "type": "string", - "id": 2 - } - } - }, - "URLButton": { - "fields": { - "displayText": { - "type": "HighlyStructuredMessage", - "id": 1 - }, - "url": { - "type": "HighlyStructuredMessage", - "id": 2 - } - } - }, - "CallButton": { - "fields": { - "displayText": { - "type": "HighlyStructuredMessage", - "id": 1 - }, - "phoneNumber": { - "type": "HighlyStructuredMessage", - "id": 2 - } - } - }, - "TemplateButton": { - "oneofs": { - "button": { - "oneof": [ - "quickReplyButton", - "urlButton", - "callButton" - ] - } - }, - "fields": { - "index": { - "type": "uint32", - "id": 4 - }, - "quickReplyButton": { - "type": "QuickReplyButton", - "id": 1 - }, - "urlButton": { - "type": "URLButton", - "id": 2 - }, - "callButton": { - "type": "CallButton", - "id": 3 - } - } - }, - "Location": { - "fields": { - "degreesLatitude": { - "type": "double", - "id": 1 - }, - "degreesLongitude": { - "type": "double", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - } - } - }, - "Point": { - "fields": { - "x": { - "type": "double", - "id": 3 - }, - "y": { - "type": "double", - "id": 4 - } - } - }, - "InteractiveAnnotation": { - "oneofs": { - "action": { - "oneof": [ - "location" - ] - } - }, - "fields": { - "polygonVertices": { - "rule": "repeated", - "type": "Point", - "id": 1 - }, - "location": { - "type": "Location", - "id": 2 - } - } - }, - "AdReplyInfo": { - "fields": { - "advertiserName": { - "type": "string", - "id": 1 - }, - "mediaType": { - "type": "AD_REPLY_INFO_MEDIATYPE", - "id": 2 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "caption": { - "type": "string", - "id": 17 - } - }, - "nested": { - "AD_REPLY_INFO_MEDIATYPE": { - "values": { - "NONE": 0, - "IMAGE": 1, - "VIDEO": 2 - } - } - } - }, - "ContextInfo": { - "fields": { - "stanzaId": { - "type": "string", - "id": 1 - }, - "participant": { - "type": "string", - "id": 2 - }, - "quotedMessage": { - "type": "Message", - "id": 3 - }, - "remoteJid": { - "type": "string", - "id": 4 - }, - "mentionedJid": { - "rule": "repeated", - "type": "string", - "id": 15 - }, - "conversionSource": { - "type": "string", - "id": 18 - }, - "conversionData": { - "type": "bytes", - "id": 19 - }, - "conversionDelaySeconds": { - "type": "uint32", - "id": 20 - }, - "forwardingScore": { - "type": "uint32", - "id": 21 - }, - "isForwarded": { - "type": "bool", - "id": 22 - }, - "quotedAd": { - "type": "AdReplyInfo", - "id": 23 - }, - "placeholderKey": { - "type": "MessageKey", - "id": 24 - }, - "expiration": { - "type": "uint32", - "id": 25 - } - } - }, - "SenderKeyDistributionMessage": { - "fields": { - "groupId": { - "type": "string", - "id": 1 - }, - "axolotlSenderKeyDistributionMessage": { - "type": "bytes", - "id": 2 - } - } - }, - "ImageMessage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "mimetype": { - "type": "string", - "id": 2 - }, - "caption": { - "type": "string", - "id": 3 - }, - "fileSha256": { - "type": "bytes", - "id": 4 - }, - "fileLength": { - "type": "uint64", - "id": 5 - }, - "height": { - "type": "uint32", - "id": 6 - }, - "width": { - "type": "uint32", - "id": 7 - }, - "mediaKey": { - "type": "bytes", - "id": 8 - }, - "fileEncSha256": { - "type": "bytes", - "id": 9 - }, - "interactiveAnnotations": { - "rule": "repeated", - "type": "InteractiveAnnotation", - "id": 10 - }, - "directPath": { - "type": "string", - "id": 11 - }, - "mediaKeyTimestamp": { - "type": "int64", - "id": 12 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - }, - "firstScanSidecar": { - "type": "bytes", - "id": 18 - }, - "firstScanLength": { - "type": "uint32", - "id": 19 - }, - "experimentGroupId": { - "type": "uint32", - "id": 20 - }, - "scansSidecar": { - "type": "bytes", - "id": 21 - }, - "scanLengths": { - "rule": "repeated", - "type": "uint32", - "id": 22, - "options": { - "packed": false - } - }, - "midQualityFileSha256": { - "type": "bytes", - "id": 23 - }, - "midQualityFileEncSha256": { - "type": "bytes", - "id": 24 - } - } - }, - "ContactMessage": { - "fields": { - "displayName": { - "type": "string", - "id": 1 - }, - "vcard": { - "type": "string", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "LocationMessage": { - "fields": { - "degreesLatitude": { - "type": "double", - "id": 1 - }, - "degreesLongitude": { - "type": "double", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "address": { - "type": "string", - "id": 4 - }, - "url": { - "type": "string", - "id": 5 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "ExtendedTextMessage": { - "fields": { - "text": { - "type": "string", - "id": 1 - }, - "matchedText": { - "type": "string", - "id": 2 - }, - "canonicalUrl": { - "type": "string", - "id": 4 - }, - "description": { - "type": "string", - "id": 5 - }, - "title": { - "type": "string", - "id": 6 - }, - "textArgb": { - "type": "fixed32", - "id": 7 - }, - "backgroundArgb": { - "type": "fixed32", - "id": 8 - }, - "font": { - "type": "EXTENDED_TEXT_MESSAGE_FONTTYPE", - "id": 9 - }, - "previewType": { - "type": "EXTENDED_TEXT_MESSAGE_PREVIEWTYPE", - "id": 10 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - }, - "doNotPlayInline": { - "type": "bool", - "id": 18 - } - }, - "nested": { - "EXTENDED_TEXT_MESSAGE_FONTTYPE": { - "values": { - "SANS_SERIF": 0, - "SERIF": 1, - "NORICAN_REGULAR": 2, - "BRYNDAN_WRITE": 3, - "BEBASNEUE_REGULAR": 4, - "OSWALD_HEAVY": 5 - } - }, - "EXTENDED_TEXT_MESSAGE_PREVIEWTYPE": { - "values": { - "NONE": 0, - "VIDEO": 1 - } - } - } - }, - "DocumentMessage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "mimetype": { - "type": "string", - "id": 2 - }, - "title": { - "type": "string", - "id": 3 - }, - "fileSha256": { - "type": "bytes", - "id": 4 - }, - "fileLength": { - "type": "uint64", - "id": 5 - }, - "pageCount": { - "type": "uint32", - "id": 6 - }, - "mediaKey": { - "type": "bytes", - "id": 7 - }, - "fileName": { - "type": "string", - "id": 8 - }, - "fileEncSha256": { - "type": "bytes", - "id": 9 - }, - "directPath": { - "type": "string", - "id": 10 - }, - "mediaKeyTimestamp": { - "type": "int64", - "id": 11 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "AudioMessage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "mimetype": { - "type": "string", - "id": 2 - }, - "fileSha256": { - "type": "bytes", - "id": 3 - }, - "fileLength": { - "type": "uint64", - "id": 4 - }, - "seconds": { - "type": "uint32", - "id": 5 - }, - "ptt": { - "type": "bool", - "id": 6 - }, - "mediaKey": { - "type": "bytes", - "id": 7 - }, - "fileEncSha256": { - "type": "bytes", - "id": 8 - }, - "directPath": { - "type": "string", - "id": 9 - }, - "mediaKeyTimestamp": { - "type": "int64", - "id": 10 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - }, - "streamingSidecar": { - "type": "bytes", - "id": 18 - } - } - }, - "VideoMessage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "mimetype": { - "type": "string", - "id": 2 - }, - "fileSha256": { - "type": "bytes", - "id": 3 - }, - "fileLength": { - "type": "uint64", - "id": 4 - }, - "seconds": { - "type": "uint32", - "id": 5 - }, - "mediaKey": { - "type": "bytes", - "id": 6 - }, - "caption": { - "type": "string", - "id": 7 - }, - "gifPlayback": { - "type": "bool", - "id": 8 - }, - "height": { - "type": "uint32", - "id": 9 - }, - "width": { - "type": "uint32", - "id": 10 - }, - "fileEncSha256": { - "type": "bytes", - "id": 11 - }, - "interactiveAnnotations": { - "rule": "repeated", - "type": "InteractiveAnnotation", - "id": 12 - }, - "directPath": { - "type": "string", - "id": 13 - }, - "mediaKeyTimestamp": { - "type": "int64", - "id": 14 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - }, - "streamingSidecar": { - "type": "bytes", - "id": 18 - }, - "gifAttribution": { - "type": "VIDEO_MESSAGE_ATTRIBUTION", - "id": 19 - } - }, - "nested": { - "VIDEO_MESSAGE_ATTRIBUTION": { - "values": { - "NONE": 0, - "GIPHY": 1, - "TENOR": 2 - } - } - } - }, - "Call": { - "fields": { - "callKey": { - "type": "bytes", - "id": 1 - } - } - }, - "Chat": { - "fields": { - "displayName": { - "type": "string", - "id": 1 - }, - "id": { - "type": "string", - "id": 2 - } - } - }, - "ProtocolMessage": { - "fields": { - "key": { - "type": "MessageKey", - "id": 1 - }, - "type": { - "type": "PROTOCOL_MESSAGE_TYPE", - "id": 2 - }, - "ephemeralExpiration": { - "type": "uint32", - "id": 4 - } - }, - "nested": { - "PROTOCOL_MESSAGE_TYPE": { - "values": { - "REVOKE": 0, - "EPHEMERAL_SETTING": 3 - } - } - } - }, - "ContactsArrayMessage": { - "fields": { - "displayName": { - "type": "string", - "id": 1 - }, - "contacts": { - "rule": "repeated", - "type": "ContactMessage", - "id": 2 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "HSMCurrency": { - "fields": { - "currencyCode": { - "type": "string", - "id": 1 - }, - "amount1000": { - "type": "int64", - "id": 2 - } - } - }, - "HSMDateTimeComponent": { - "fields": { - "dayOfWeek": { - "type": "HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE", - "id": 1 - }, - "year": { - "type": "uint32", - "id": 2 - }, - "month": { - "type": "uint32", - "id": 3 - }, - "dayOfMonth": { - "type": "uint32", - "id": 4 - }, - "hour": { - "type": "uint32", - "id": 5 - }, - "minute": { - "type": "uint32", - "id": 6 - }, - "calendar": { - "type": "HSM_DATE_TIME_COMPONENT_CALENDARTYPE", - "id": 7 - } - }, - "nested": { - "HSM_DATE_TIME_COMPONENT_DAYOFWEEKTYPE": { - "values": { - "MONDAY": 1, - "TUESDAY": 2, - "WEDNESDAY": 3, - "THURSDAY": 4, - "FRIDAY": 5, - "SATURDAY": 6, - "SUNDAY": 7 - } - }, - "HSM_DATE_TIME_COMPONENT_CALENDARTYPE": { - "values": { - "GREGORIAN": 1, - "SOLAR_HIJRI": 2 - } - } - } - }, - "HSMDateTimeUnixEpoch": { - "fields": { - "timestamp": { - "type": "int64", - "id": 1 - } - } - }, - "HSMDateTime": { - "oneofs": { - "datetimeOneof": { - "oneof": [ - "component", - "unixEpoch" - ] - } - }, - "fields": { - "component": { - "type": "HSMDateTimeComponent", - "id": 1 - }, - "unixEpoch": { - "type": "HSMDateTimeUnixEpoch", - "id": 2 - } - } - }, - "HSMLocalizableParameter": { - "oneofs": { - "paramOneof": { - "oneof": [ - "currency", - "dateTime" - ] - } - }, - "fields": { - "default": { - "type": "string", - "id": 1 - }, - "currency": { - "type": "HSMCurrency", - "id": 2 - }, - "dateTime": { - "type": "HSMDateTime", - "id": 3 - } - } - }, - "HighlyStructuredMessage": { - "fields": { - "namespace": { - "type": "string", - "id": 1 - }, - "elementName": { - "type": "string", - "id": 2 - }, - "params": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "fallbackLg": { - "type": "string", - "id": 4 - }, - "fallbackLc": { - "type": "string", - "id": 5 - }, - "localizableParams": { - "rule": "repeated", - "type": "HSMLocalizableParameter", - "id": 6 - }, - "deterministicLg": { - "type": "string", - "id": 7 - }, - "deterministicLc": { - "type": "string", - "id": 8 - }, - "hydratedHsm": { - "type": "TemplateMessage", - "id": 9 - } - } - }, - "SendPaymentMessage": { - "fields": { - "noteMessage": { - "type": "Message", - "id": 2 - }, - "requestMessageKey": { - "type": "MessageKey", - "id": 3 - } - } - }, - "RequestPaymentMessage": { - "fields": { - "noteMessage": { - "type": "Message", - "id": 4 - }, - "currencyCodeIso4217": { - "type": "string", - "id": 1 - }, - "amount1000": { - "type": "uint64", - "id": 2 - }, - "requestFrom": { - "type": "string", - "id": 3 - }, - "expiryTimestamp": { - "type": "int64", - "id": 5 - } - } - }, - "DeclinePaymentRequestMessage": { - "fields": { - "key": { - "type": "MessageKey", - "id": 1 - } - } - }, - "CancelPaymentRequestMessage": { - "fields": { - "key": { - "type": "MessageKey", - "id": 1 - } - } - }, - "LiveLocationMessage": { - "fields": { - "degreesLatitude": { - "type": "double", - "id": 1 - }, - "degreesLongitude": { - "type": "double", - "id": 2 - }, - "accuracyInMeters": { - "type": "uint32", - "id": 3 - }, - "speedInMps": { - "type": "float", - "id": 4 - }, - "degreesClockwiseFromMagneticNorth": { - "type": "uint32", - "id": 5 - }, - "caption": { - "type": "string", - "id": 6 - }, - "sequenceNumber": { - "type": "int64", - "id": 7 - }, - "timeOffset": { - "type": "uint32", - "id": 8 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 16 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "StickerMessage": { - "fields": { - "url": { - "type": "string", - "id": 1 - }, - "fileSha256": { - "type": "bytes", - "id": 2 - }, - "fileEncSha256": { - "type": "bytes", - "id": 3 - }, - "mediaKey": { - "type": "bytes", - "id": 4 - }, - "mimetype": { - "type": "string", - "id": 5 - }, - "height": { - "type": "uint32", - "id": 6 - }, - "width": { - "type": "uint32", - "id": 7 - }, - "directPath": { - "type": "string", - "id": 8 - }, - "fileLength": { - "type": "uint64", - "id": 9 - }, - "mediaKeyTimestamp": { - "type": "int64", - "id": 10 - }, - "firstFrameLength": { - "type": "uint32", - "id": 11 - }, - "firstFrameSidecar": { - "type": "bytes", - "id": 12 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "FourRowTemplate": { - "oneofs": { - "title": { - "oneof": [ - "documentMessage", - "highlyStructuredMessage", - "imageMessage", - "videoMessage", - "locationMessage" - ] - } - }, - "fields": { - "content": { - "type": "HighlyStructuredMessage", - "id": 6 - }, - "footer": { - "type": "HighlyStructuredMessage", - "id": 7 - }, - "buttons": { - "rule": "repeated", - "type": "TemplateButton", - "id": 8 - }, - "documentMessage": { - "type": "DocumentMessage", - "id": 1 - }, - "highlyStructuredMessage": { - "type": "HighlyStructuredMessage", - "id": 2 - }, - "imageMessage": { - "type": "ImageMessage", - "id": 3 - }, - "videoMessage": { - "type": "VideoMessage", - "id": 4 - }, - "locationMessage": { - "type": "LocationMessage", - "id": 5 - } - } - }, - "HydratedFourRowTemplate": { - "oneofs": { - "title": { - "oneof": [ - "documentMessage", - "hydratedTitleText", - "imageMessage", - "videoMessage", - "locationMessage" - ] - } - }, - "fields": { - "hydratedContentText": { - "type": "string", - "id": 6 - }, - "hydratedFooterText": { - "type": "string", - "id": 7 - }, - "hydratedButtons": { - "rule": "repeated", - "type": "HydratedTemplateButton", - "id": 8 - }, - "templateId": { - "type": "string", - "id": 9 - }, - "documentMessage": { - "type": "DocumentMessage", - "id": 1 - }, - "hydratedTitleText": { - "type": "string", - "id": 2 - }, - "imageMessage": { - "type": "ImageMessage", - "id": 3 - }, - "videoMessage": { - "type": "VideoMessage", - "id": 4 - }, - "locationMessage": { - "type": "LocationMessage", - "id": 5 - } - } - }, - "TemplateMessage": { - "oneofs": { - "format": { - "oneof": [ - "fourRowTemplate", - "hydratedFourRowTemplate" - ] - } - }, - "fields": { - "contextInfo": { - "type": "ContextInfo", - "id": 3 - }, - "hydratedTemplate": { - "type": "HydratedFourRowTemplate", - "id": 4 - }, - "fourRowTemplate": { - "type": "FourRowTemplate", - "id": 1 - }, - "hydratedFourRowTemplate": { - "type": "HydratedFourRowTemplate", - "id": 2 - } - } - }, - "TemplateButtonReplyMessage": { - "fields": { - "selectedId": { - "type": "string", - "id": 1 - }, - "selectedDisplayText": { - "type": "string", - "id": 2 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 3 - }, - "selectedIndex": { - "type": "uint32", - "id": 4 - } - } - }, - "ProductSnapshot": { - "fields": { - "productImage": { - "type": "ImageMessage", - "id": 1 - }, - "productId": { - "type": "string", - "id": 2 - }, - "title": { - "type": "string", - "id": 3 - }, - "description": { - "type": "string", - "id": 4 - }, - "currencyCode": { - "type": "string", - "id": 5 - }, - "priceAmount1000": { - "type": "int64", - "id": 6 - }, - "retailerId": { - "type": "string", - "id": 7 - }, - "url": { - "type": "string", - "id": 8 - }, - "productImageCount": { - "type": "uint32", - "id": 9 - }, - "firstImageId": { - "type": "string", - "id": 11 - } - } - }, - "ProductMessage": { - "fields": { - "product": { - "type": "ProductSnapshot", - "id": 1 - }, - "businessOwnerJid": { - "type": "string", - "id": 2 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 17 - } - } - }, - "GroupInviteMessage": { - "fields": { - "groupJid": { - "type": "string", - "id": 1 - }, - "inviteCode": { - "type": "string", - "id": 2 - }, - "inviteExpiration": { - "type": "int64", - "id": 3 - }, - "groupName": { - "type": "string", - "id": 4 - }, - "jpegThumbnail": { - "type": "bytes", - "id": 5 - }, - "caption": { - "type": "string", - "id": 6 - }, - "contextInfo": { - "type": "ContextInfo", - "id": 7 - } - } - }, - "DeviceSentMessage": { - "fields": { - "destinationJid": { - "type": "string", - "id": 1 - }, - "message": { - "type": "Message", - "id": 2 - } - } - }, - "DeviceSyncMessage": { - "fields": { - "serializedXmlBytes": { - "type": "bytes", - "id": 1 - } - } - }, - "Message": { - "fields": { - "conversation": { - "type": "string", - "id": 1 - }, - "senderKeyDistributionMessage": { - "type": "SenderKeyDistributionMessage", - "id": 2 - }, - "imageMessage": { - "type": "ImageMessage", - "id": 3 - }, - "contactMessage": { - "type": "ContactMessage", - "id": 4 - }, - "locationMessage": { - "type": "LocationMessage", - "id": 5 - }, - "extendedTextMessage": { - "type": "ExtendedTextMessage", - "id": 6 - }, - "documentMessage": { - "type": "DocumentMessage", - "id": 7 - }, - "audioMessage": { - "type": "AudioMessage", - "id": 8 - }, - "videoMessage": { - "type": "VideoMessage", - "id": 9 - }, - "call": { - "type": "Call", - "id": 10 - }, - "chat": { - "type": "Chat", - "id": 11 - }, - "protocolMessage": { - "type": "ProtocolMessage", - "id": 12 - }, - "contactsArrayMessage": { - "type": "ContactsArrayMessage", - "id": 13 - }, - "highlyStructuredMessage": { - "type": "HighlyStructuredMessage", - "id": 14 - }, - "fastRatchetKeySenderKeyDistributionMessage": { - "type": "SenderKeyDistributionMessage", - "id": 15 - }, - "sendPaymentMessage": { - "type": "SendPaymentMessage", - "id": 16 - }, - "liveLocationMessage": { - "type": "LiveLocationMessage", - "id": 18 - }, - "requestPaymentMessage": { - "type": "RequestPaymentMessage", - "id": 22 - }, - "declinePaymentRequestMessage": { - "type": "DeclinePaymentRequestMessage", - "id": 23 - }, - "cancelPaymentRequestMessage": { - "type": "CancelPaymentRequestMessage", - "id": 24 - }, - "templateMessage": { - "type": "TemplateMessage", - "id": 25 - }, - "stickerMessage": { - "type": "StickerMessage", - "id": 26 - }, - "groupInviteMessage": { - "type": "GroupInviteMessage", - "id": 28 - }, - "templateButtonReplyMessage": { - "type": "TemplateButtonReplyMessage", - "id": 29 - }, - "productMessage": { - "type": "ProductMessage", - "id": 30 - }, - "deviceSentMessage": { - "type": "DeviceSentMessage", - "id": 31 - }, - "deviceSyncMessage": { - "type": "DeviceSyncMessage", - "id": 32 - } - } - }, - "MessageKey": { - "fields": { - "remoteJid": { - "type": "string", - "id": 1 - }, - "fromMe": { - "type": "bool", - "id": 2 - }, - "id": { - "type": "string", - "id": 3 - }, - "participant": { - "type": "string", - "id": 4 - } - } - }, - "WebFeatures": { - "fields": { - "labelsDisplay": { - "type": "WEB_FEATURES_FLAG", - "id": 1 - }, - "voipIndividualOutgoing": { - "type": "WEB_FEATURES_FLAG", - "id": 2 - }, - "groupsV3": { - "type": "WEB_FEATURES_FLAG", - "id": 3 - }, - "groupsV3Create": { - "type": "WEB_FEATURES_FLAG", - "id": 4 - }, - "changeNumberV2": { - "type": "WEB_FEATURES_FLAG", - "id": 5 - }, - "queryStatusV3Thumbnail": { - "type": "WEB_FEATURES_FLAG", - "id": 6 - }, - "liveLocations": { - "type": "WEB_FEATURES_FLAG", - "id": 7 - }, - "queryVname": { - "type": "WEB_FEATURES_FLAG", - "id": 8 - }, - "voipIndividualIncoming": { - "type": "WEB_FEATURES_FLAG", - "id": 9 - }, - "quickRepliesQuery": { - "type": "WEB_FEATURES_FLAG", - "id": 10 - }, - "payments": { - "type": "WEB_FEATURES_FLAG", - "id": 11 - }, - "stickerPackQuery": { - "type": "WEB_FEATURES_FLAG", - "id": 12 - }, - "liveLocationsFinal": { - "type": "WEB_FEATURES_FLAG", - "id": 13 - }, - "labelsEdit": { - "type": "WEB_FEATURES_FLAG", - "id": 14 - }, - "mediaUpload": { - "type": "WEB_FEATURES_FLAG", - "id": 15 - }, - "mediaUploadRichQuickReplies": { - "type": "WEB_FEATURES_FLAG", - "id": 18 - }, - "vnameV2": { - "type": "WEB_FEATURES_FLAG", - "id": 19 - }, - "videoPlaybackUrl": { - "type": "WEB_FEATURES_FLAG", - "id": 20 - }, - "statusRanking": { - "type": "WEB_FEATURES_FLAG", - "id": 21 - }, - "voipIndividualVideo": { - "type": "WEB_FEATURES_FLAG", - "id": 22 - }, - "thirdPartyStickers": { - "type": "WEB_FEATURES_FLAG", - "id": 23 - }, - "frequentlyForwardedSetting": { - "type": "WEB_FEATURES_FLAG", - "id": 24 - }, - "groupsV4JoinPermission": { - "type": "WEB_FEATURES_FLAG", - "id": 25 - }, - "recentStickers": { - "type": "WEB_FEATURES_FLAG", - "id": 26 - }, - "catalog": { - "type": "WEB_FEATURES_FLAG", - "id": 27 - }, - "starredStickers": { - "type": "WEB_FEATURES_FLAG", - "id": 28 - }, - "voipGroupCall": { - "type": "WEB_FEATURES_FLAG", - "id": 29 - }, - "templateMessage": { - "type": "WEB_FEATURES_FLAG", - "id": 30 - }, - "templateMessageInteractivity": { - "type": "WEB_FEATURES_FLAG", - "id": 31 - }, - "ephemeralMessages": { - "type": "WEB_FEATURES_FLAG", - "id": 32 - } - }, - "nested": { - "WEB_FEATURES_FLAG": { - "values": { - "NOT_STARTED": 0, - "FORCE_UPGRADE": 1, - "DEVELOPMENT": 2, - "PRODUCTION": 3 - } - } - } - }, - "TabletNotificationsInfo": { - "fields": { - "timestamp": { - "type": "uint64", - "id": 2 - }, - "unreadChats": { - "type": "uint32", - "id": 3 - }, - "notifyMessageCount": { - "type": "uint32", - "id": 4 - }, - "notifyMessage": { - "rule": "repeated", - "type": "NotificationMessageInfo", - "id": 5 - } - } - }, - "NotificationMessageInfo": { - "fields": { - "key": { - "type": "MessageKey", - "id": 1 - }, - "message": { - "type": "Message", - "id": 2 - }, - "messageTimestamp": { - "type": "uint64", - "id": 3 - }, - "participant": { - "type": "string", - "id": 4 - } - } - }, - "WebNotificationsInfo": { - "fields": { - "timestamp": { - "type": "uint64", - "id": 2 - }, - "unreadChats": { - "type": "uint32", - "id": 3 - }, - "notifyMessageCount": { - "type": "uint32", - "id": 4 - }, - "notifyMessages": { - "rule": "repeated", - "type": "WebMessageInfo", - "id": 5 - } - } - }, - "PaymentInfo": { - "fields": { - "amount1000": { - "type": "uint64", - "id": 2 - }, - "receiverJid": { - "type": "string", - "id": 3 - }, - "status": { - "type": "PAYMENT_INFO_STATUS", - "id": 4 - }, - "transactionTimestamp": { - "type": "uint64", - "id": 5 - }, - "requestMessageKey": { - "type": "MessageKey", - "id": 6 - }, - "expiryTimestamp": { - "type": "uint64", - "id": 7 - }, - "futureproofed": { - "type": "bool", - "id": 8 - }, - "currency": { - "type": "string", - "id": 9 - } - }, - "nested": { - "PAYMENT_INFO_STATUS": { - "values": { - "UNKNOWN_STATUS": 0, - "PROCESSING": 1, - "SENT": 2, - "NEED_TO_ACCEPT": 3, - "COMPLETE": 4, - "COULD_NOT_COMPLETE": 5, - "REFUNDED": 6, - "EXPIRED": 7, - "REJECTED": 8, - "CANCELLED": 9, - "WAITING_FOR_PAYER": 10, - "WAITING": 11 - } - } - } - }, - "WebMessageInfo": { - "fields": { - "key": { - "rule": "required", - "type": "MessageKey", - "id": 1 - }, - "message": { - "type": "Message", - "id": 2 - }, - "messageTimestamp": { - "type": "uint64", - "id": 3 - }, - "status": { - "type": "WEB_MESSAGE_INFO_STATUS", - "id": 4 - }, - "participant": { - "type": "string", - "id": 5 - }, - "ignore": { - "type": "bool", - "id": 16 - }, - "starred": { - "type": "bool", - "id": 17 - }, - "broadcast": { - "type": "bool", - "id": 18 - }, - "pushName": { - "type": "string", - "id": 19 - }, - "mediaCiphertextSha256": { - "type": "bytes", - "id": 20 - }, - "multicast": { - "type": "bool", - "id": 21 - }, - "urlText": { - "type": "bool", - "id": 22 - }, - "urlNumber": { - "type": "bool", - "id": 23 - }, - "messageStubType": { - "type": "WEB_MESSAGE_INFO_STUBTYPE", - "id": 24 - }, - "clearMedia": { - "type": "bool", - "id": 25 - }, - "messageStubParameters": { - "rule": "repeated", - "type": "string", - "id": 26 - }, - "duration": { - "type": "uint32", - "id": 27 - }, - "labels": { - "rule": "repeated", - "type": "string", - "id": 28 - }, - "paymentInfo": { - "type": "PaymentInfo", - "id": 29 - }, - "finalLiveLocation": { - "type": "LiveLocationMessage", - "id": 30 - }, - "quotedPaymentInfo": { - "type": "PaymentInfo", - "id": 31 - }, - "ephemeralStartTimestamp": { - "type": "uint64", - "id": 32 - }, - "ephemeralDuration": { - "type": "uint32", - "id": 33 - } - }, - "nested": { - "WEB_MESSAGE_INFO_STATUS": { - "values": { - "ERROR": 0, - "PENDING": 1, - "SERVER_ACK": 2, - "DELIVERY_ACK": 3, - "READ": 4, - "PLAYED": 5 - } - }, - "WEB_MESSAGE_INFO_STUBTYPE": { - "values": { - "UNKNOWN": 0, - "REVOKE": 1, - "CIPHERTEXT": 2, - "FUTUREPROOF": 3, - "NON_VERIFIED_TRANSITION": 4, - "UNVERIFIED_TRANSITION": 5, - "VERIFIED_TRANSITION": 6, - "VERIFIED_LOW_UNKNOWN": 7, - "VERIFIED_HIGH": 8, - "VERIFIED_INITIAL_UNKNOWN": 9, - "VERIFIED_INITIAL_LOW": 10, - "VERIFIED_INITIAL_HIGH": 11, - "VERIFIED_TRANSITION_ANY_TO_NONE": 12, - "VERIFIED_TRANSITION_ANY_TO_HIGH": 13, - "VERIFIED_TRANSITION_HIGH_TO_LOW": 14, - "VERIFIED_TRANSITION_HIGH_TO_UNKNOWN": 15, - "VERIFIED_TRANSITION_UNKNOWN_TO_LOW": 16, - "VERIFIED_TRANSITION_LOW_TO_UNKNOWN": 17, - "VERIFIED_TRANSITION_NONE_TO_LOW": 18, - "VERIFIED_TRANSITION_NONE_TO_UNKNOWN": 19, - "GROUP_CREATE": 20, - "GROUP_CHANGE_SUBJECT": 21, - "GROUP_CHANGE_ICON": 22, - "GROUP_CHANGE_INVITE_LINK": 23, - "GROUP_CHANGE_DESCRIPTION": 24, - "GROUP_CHANGE_RESTRICT": 25, - "GROUP_CHANGE_ANNOUNCE": 26, - "GROUP_PARTICIPANT_ADD": 27, - "GROUP_PARTICIPANT_REMOVE": 28, - "GROUP_PARTICIPANT_PROMOTE": 29, - "GROUP_PARTICIPANT_DEMOTE": 30, - "GROUP_PARTICIPANT_INVITE": 31, - "GROUP_PARTICIPANT_LEAVE": 32, - "GROUP_PARTICIPANT_CHANGE_NUMBER": 33, - "BROADCAST_CREATE": 34, - "BROADCAST_ADD": 35, - "BROADCAST_REMOVE": 36, - "GENERIC_NOTIFICATION": 37, - "E2E_IDENTITY_CHANGED": 38, - "E2E_ENCRYPTED": 39, - "CALL_MISSED_VOICE": 40, - "CALL_MISSED_VIDEO": 41, - "INDIVIDUAL_CHANGE_NUMBER": 42, - "GROUP_DELETE": 43, - "GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE": 44, - "CALL_MISSED_GROUP_VOICE": 45, - "CALL_MISSED_GROUP_VIDEO": 46, - "PAYMENT_CIPHERTEXT": 47, - "PAYMENT_FUTUREPROOF": 48, - "PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED": 49, - "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED": 50, - "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED": 51, - "PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP": 52, - "PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP": 53, - "PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER": 54, - "PAYMENT_ACTION_SEND_PAYMENT_REMINDER": 55, - "PAYMENT_ACTION_SEND_PAYMENT_INVITATION": 56, - "PAYMENT_ACTION_REQUEST_DECLINED": 57, - "PAYMENT_ACTION_REQUEST_EXPIRED": 58, - "PAYMENT_ACTION_REQUEST_CANCELLED": 59, - "BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM": 60, - "BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP": 61, - "BIZ_INTRO_TOP": 62, - "BIZ_INTRO_BOTTOM": 63, - "BIZ_NAME_CHANGE": 64, - "BIZ_MOVE_TO_CONSUMER_APP": 65, - "BIZ_TWO_TIER_MIGRATION_TOP": 66, - "BIZ_TWO_TIER_MIGRATION_BOTTOM": 67, - "OVERSIZED": 68, - "GROUP_CHANGE_NO_FREQUENTLY_FORWARDED": 69, - "GROUP_V4_ADD_INVITE_SENT": 70, - "GROUP_PARTICIPANT_ADD_REQUEST_JOIN": 71, - "CHANGE_EPHEMERAL_SETTING": 72 - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000000..9d83927214f --- /dev/null +++ b/jest.config.js @@ -0,0 +1,14 @@ +module.exports = { + 'roots': [ + '/src' + ], + 'testMatch': [ + '**/Tests/test.*.+(ts|tsx|js)', + ], + 'transform': { + '^.+\\.(ts|tsx)$': 'ts-jest' + }, + moduleNameMapper: { + '^axios$': require.resolve('axios'), + }, +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 2914a0b6c58..00000000000 --- a/package-lock.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "name": "baileys", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "@types/long": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", - "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" - }, - "@types/node": { - "version": "10.17.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.17.tgz", - "integrity": "sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q==" - }, - "curve25519-js": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/curve25519-js/-/curve25519-js-0.0.4.tgz", - "integrity": "sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w==" - }, - "futoin-hkdf": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/futoin-hkdf/-/futoin-hkdf-1.3.1.tgz", - "integrity": "sha512-k1DvCXIFAIx3hK8CSwApotX3JUDwA2Wb55zxyIgqwQpCBF2ZHgVqfHpyjG8mRpmsjRH7SWS1N/vj8EdSF9zBhw==" - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "protobufjs": { - "version": "6.8.9", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.9.tgz", - "integrity": "sha512-j2JlRdUeL/f4Z6x4aU4gj9I2LECglC+5qR2TrWb193Tla1qfdaNQTZ8I27Pt7K0Ajmvjjpft7O3KWTGciz4gpw==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.0", - "@types/node": "^10.1.0", - "long": "^4.0.0" - } - }, - "qrcode-terminal": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz", - "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==" - }, - "ws": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", - "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" - } - } -} diff --git a/package.json b/package.json index 60bfd1d815f..b2e13c651df 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,96 @@ { "name": "baileys", - "version": "1.0.0", - "description": "Whatsapp Web API", - "main": "WhatsAppWeb.js", + "version": "6.0.9", + "description": "Baileys Fixed", + "homepage": "https://github.com/amiruldev20/Baileys", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "keywords": [ + "whatsapp", + "js-whatsapp", + "whatsapp-api", + "whatsapp-web", + "whatsapp", + "whatsapp-chat", + "whatsapp-group", + "automation", + "multi-device", + "Amirul Dev", + "Baileys" + ], "scripts": { - "test": "node test.js" + "test": "jest", + "prepare": "tsc", + "build:all": "tsc && typedoc", + "build:docs": "typedoc", + "build:tsc": "tsc", + "example": "node --inspect -r ts-node/register Example/example.ts", + "gen:protobuf": "sh WAProto/GenerateStatics.sh", + "lint": "eslint . --ext .js,.ts,.jsx,.tsx", + "lint:fix": "eslint . --fix --ext .js,.ts,.jsx,.tsx" + }, + "author": "Amirul Dev", + "license": "MIT", + "repository": { + "url": "git@github.com:amiruldev20/baileys.git" }, - "author": "Adhiraj Singh", - "license": "ISC", "dependencies": { - "curve25519-js": "0.0.4", - "futoin-hkdf": "^1.3.1", - "protobufjs": "^6.8.9", + "@hapi/boom": "^9.1.3", + "axios": "^1.3.3", + "futoin-hkdf": "^1.5.1", + "libsignal": "git+https://github.com/amiruldev20/signal", + "music-metadata": "^7.12.3", + "node-cache": "^5.1.2", + "pino": "^7.0.0", + "protobufjs": "^6.11.3", + "ws": "^8.0.0" + }, + "peerDependencies": { + "@adiwajshing/keyed-db": "^0.2.4", + "jimp": "^0.16.1", + "link-preview-js": "^3.0.0", + "qrcode-terminal": "^0.12.0", + "sharp": "^0.30.5" + }, + "peerDependenciesMeta": { + "@adiwajshing/keyed-db": { + "optional": true + }, + "jimp": { + "optional": true + }, + "qrcode-terminal": { + "optional": true + }, + "sharp": { + "optional": true + }, + "link-preview-js": { + "optional": true + } + }, + "files": [ + "lib/*", + "WAProto/*", + "WASignalGroup/*.js" + ], + "devDependencies": { + "@adiwajshing/eslint-config": "git+https://github.com/adiwajshing/eslint-config.git", + "@adiwajshing/keyed-db": "^0.2.4", + "@types/got": "^9.6.11", + "@types/jest": "^27.5.1", + "@types/node": "^16.0.0", + "@types/sharp": "^0.29.4", + "@types/ws": "^8.0.0", + "eslint": "^8.0.0", + "jest": "^27.0.6", + "jimp": "^0.16.1", + "link-preview-js": "^3.0.0", "qrcode-terminal": "^0.12.0", - "ws": "^7.2.3" + "sharp": "^0.30.5", + "ts-jest": "^27.0.3", + "ts-node": "^10.8.1", + "typedoc": "^0.22.0", + "typescript": "^4.0.0" } } diff --git a/proto-extract/.gitignore b/proto-extract/.gitignore new file mode 100644 index 00000000000..28f1ba7565f --- /dev/null +++ b/proto-extract/.gitignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store \ No newline at end of file diff --git a/proto-extract/README.md b/proto-extract/README.md new file mode 100644 index 00000000000..fc9e60329d6 --- /dev/null +++ b/proto-extract/README.md @@ -0,0 +1,8 @@ +# Proto Extract + +Derived initially from `whatseow`'s proto extract, this version generates a predictable diff friendly protobuf. It also does not rely on a hardcoded set of modules to look for but finds all proto modules on its own and extracts the proto from there. + +## Usage +1. Install dependencies with `yarn` (or `npm install`) +2. `yarn start` +3. The script will update `../WAProto/WAProto.proto` (except if something is broken) diff --git a/proto-extract/index.js b/proto-extract/index.js new file mode 100644 index 00000000000..648f48574b1 --- /dev/null +++ b/proto-extract/index.js @@ -0,0 +1,369 @@ +const request = require('request-promise-native') +const acorn = require('acorn') +const walk = require('acorn-walk') +const fs = require('fs/promises') + +const addPrefix = (lines, prefix) => lines.map(line => prefix + line) + +const extractAllExpressions = (node) => { + const expressions = [node] + const exp = node.expression + if(exp) { + expressions.push(exp) + } + + if(node.expression?.expressions?.length) { + for(const exp of node.expression?.expressions) { + expressions.push(...extractAllExpressions(exp)) + } + } + + return expressions +} + +async function findAppModules() { + const ua = { + headers: { + 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0', + 'Sec-Fetch-Dest': 'script', + 'Sec-Fetch-Mode': 'no-cors', + 'Sec-Fetch-Site': 'same-origin', + 'Referer': 'https://web.whatsapp.com/', + 'Accept': '*/*', + 'Accept-Language': 'Accept-Language: en-US,en;q=0.5', + } + } + const baseURL = 'https://web.whatsapp.com' + const index = await request.get(baseURL, ua) + const bootstrapQRID = index.match(/src="\/app.([0-9a-z]{10,}).js"/)[1] + const bootstrapQRURL = baseURL + '/app.' + bootstrapQRID + '.js' + + console.log('Found source JS URL:', bootstrapQRURL) + + + const qrData = await request.get(bootstrapQRURL, ua) + const waVersion = qrData.match(/appVersion:"(\d\.\d+\.\d+)"/)[1] + console.log('Current version:', waVersion) + // This one list of types is so long that it's split into two JavaScript declarations. + // The module finder below can't handle it, so just patch it manually here. + const patchedQrData = qrData.replace('t.ActionLinkSpec=void 0,t.TemplateButtonSpec', 't.ActionLinkSpec=t.TemplateButtonSpec') + //const patchedQrData = qrData.replace("Spec=void 0,t.", "Spec=t.") + const qrModules = acorn.parse(patchedQrData).body[0].expression.arguments[0].elements[1].properties + + const result = qrModules.filter(m => { + const hasProto = !!m.value.body.body.find(b => { + const expressions = extractAllExpressions(b) + return expressions?.find(e => e?.left?.property?.name === 'internalSpec') + }) + if(hasProto) { + return true + } + }) + + return result +} + +(async() => { + const unspecName = name => name.endsWith('Spec') ? name.slice(0, -4) : name + const unnestName = name => name.split('$').slice(-1)[0] + const getNesting = name => name.split('$').slice(0, -1).join('$') + const makeRenameFunc = () => ( + name => { + name = unspecName(name) + return name// .replaceAll('$', '__') + // return renames[name] ?? unnestName(name) + } + ) + // The constructor IDs that can be used for enum types + // const enumConstructorIDs = [76672, 54302] + + const modules = await findAppModules() + + // Sort modules so that whatsapp module id changes don't change the order in the output protobuf schema + // const modules = [] + // for (const mod of wantedModules) { + // modules.push(unsortedModules.find(node => node.key.value === mod)) + // } + + // find aliases of cross references between the wanted modules + const modulesInfo = {} + const moduleIndentationMap = {} + modules.forEach(({ key, value }) => { + const requiringParam = value.params[2].name + modulesInfo[key.value] = { crossRefs: [] } + walk.simple(value, { + VariableDeclarator(node) { + if(node.init && node.init.type === 'CallExpression' && node.init.callee.name === requiringParam && node.init.arguments.length === 1) { + modulesInfo[key.value].crossRefs.push({ alias: node.id.name, module: node.init.arguments[0].value }) + } + } + }) + }) + + // find all identifiers and, for enums, their array of values + for(const mod of modules) { + const modInfo = modulesInfo[mod.key.value] + const rename = makeRenameFunc(mod.key.value) + + // all identifiers will be initialized to "void 0" (i.e. "undefined") at the start, so capture them here + walk.ancestor(mod, { + UnaryExpression(node, anc) { + if(!modInfo.identifiers && node.operator === 'void') { + const assignments = [] + let i = 1 + anc.reverse() + while(anc[i].type === 'AssignmentExpression') { + assignments.push(anc[i++].left) + } + + const makeBlankIdent = a => { + const key = rename(a.property.name) + const indentation = getNesting(key) + const value = { name: key } + + moduleIndentationMap[key] = moduleIndentationMap[key] || { } + moduleIndentationMap[key].indentation = indentation + + if(indentation.length) { + moduleIndentationMap[indentation] = moduleIndentationMap[indentation] || { } + moduleIndentationMap[indentation].members = moduleIndentationMap[indentation].members || new Set() + moduleIndentationMap[indentation].members.add(key) + } + + return [key, value] + } + + modInfo.identifiers = Object.fromEntries(assignments.map(makeBlankIdent).reverse()) + + } + } + }) + const enumAliases = {} + // enums are defined directly, and both enums and messages get a one-letter alias + walk.simple(mod, { + VariableDeclarator(node) { + if( + node.init?.type === 'CallExpression' + // && enumConstructorIDs.includes(node.init.callee?.arguments?.[0]?.value) + && !!node.init.arguments.length + && node.init.arguments[0].type === 'ObjectExpression' + && node.init.arguments[0].properties.length + ) { + const values = node.init.arguments[0].properties.map(p => ({ + name: p.key.name, + id: p.value.value + })) + enumAliases[node.id.name] = values + } + }, + AssignmentExpression(node) { + if(node.left.type === 'MemberExpression' && modInfo.identifiers[rename(node.left.property.name)]) { + const ident = modInfo.identifiers[rename(node.left.property.name)] + ident.alias = node.right.name + // enumAliases[ident.alias] = enumAliases[ident.alias] || [] + ident.enumValues = enumAliases[ident.alias] + } + }, + }) + } + + // find the contents for all protobuf messages + for(const mod of modules) { + const modInfo = modulesInfo[mod.key.value] + const rename = makeRenameFunc(mod.key.value) + + // message specifications are stored in a "internalSpec" attribute of the respective identifier alias + walk.simple(mod, { + AssignmentExpression(node) { + if(node.left.type === 'MemberExpression' && node.left.property.name === 'internalSpec' && node.right.type === 'ObjectExpression') { + const targetIdent = Object.values(modInfo.identifiers).find(v => v.alias === node.left.object.name) + if(!targetIdent) { + console.warn(`found message specification for unknown identifier alias: ${node.left.object.name}`) + return + } + + // partition spec properties by normal members and constraints (like "__oneofs__") which will be processed afterwards + const constraints = [] + let members = [] + for(const p of node.right.properties) { + p.key.name = p.key.type === 'Identifier' ? p.key.name : p.key.value + const arr = p.key.name.substr(0, 2) === '__' ? constraints : members + arr.push(p) + } + + members = members.map(({ key: { name }, value: { elements } }) => { + let type + const flags = [] + const unwrapBinaryOr = n => (n.type === 'BinaryExpression' && n.operator === '|') ? [].concat(unwrapBinaryOr(n.left), unwrapBinaryOr(n.right)) : [n] + + // find type and flags + unwrapBinaryOr(elements[1]).forEach(m => { + if(m.type === 'MemberExpression' && m.object.type === 'MemberExpression') { + if(m.object.property.name === 'TYPES') { + type = m.property.name.toLowerCase() + } else if(m.object.property.name === 'FLAGS') { + flags.push(m.property.name.toLowerCase()) + } + } + }) + + // determine cross reference name from alias if this member has type "message" or "enum" + if(type === 'message' || type === 'enum') { + const currLoc = ` from member '${name}' of message '${targetIdent.name}'` + if(elements[2].type === 'Identifier') { + type = Object.values(modInfo.identifiers).find(v => v.alias === elements[2].name)?.name + if(!type) { + console.warn(`unable to find reference of alias '${elements[2].name}'` + currLoc) + } + } else if(elements[2].type === 'MemberExpression') { + const crossRef = modInfo.crossRefs.find(r => r.alias === elements[2].object.name) + if(crossRef && modulesInfo[crossRef.module].identifiers[rename(elements[2].property.name)]) { + type = rename(elements[2].property.name) + } else { + console.warn(`unable to find reference of alias to other module '${elements[2].object.name}' or to message ${elements[2].property.name} of this module` + currLoc) + } + } + } + + return { name, id: elements[0].value, type, flags } + }) + + // resolve constraints for members + constraints.forEach(c => { + if(c.key.name === '__oneofs__' && c.value.type === 'ObjectExpression') { + const newOneOfs = c.value.properties.map(p => ({ + name: p.key.name, + type: '__oneof__', + members: p.value.elements.map(e => { + const idx = members.findIndex(m => m.name === e.value) + const member = members[idx] + members.splice(idx, 1) + return member + }) + })) + members.push(...newOneOfs) + } + }) + + targetIdent.members = members + } + } + }) + } + + const decodedProtoMap = { } + const spaceIndent = ' '.repeat(4) + for(const mod of modules) { + const modInfo = modulesInfo[mod.key.value] + const identifiers = Object.values(modInfo.identifiers) + + // enum stringifying function + const stringifyEnum = (ident, overrideName = null) => [].concat( + [`enum ${overrideName || ident.displayName || ident.name} {`], + addPrefix(ident.enumValues.map(v => `${v.name} = ${v.id};`), spaceIndent), + ['}'] + ) + + // message specification member stringifying function + const stringifyMessageSpecMember = (info, completeFlags, parentName = undefined) => { + if(info.type === '__oneof__') { + return [].concat( + [`oneof ${info.name} {`], + addPrefix([].concat(...info.members.map(m => stringifyMessageSpecMember(m, false))), spaceIndent), + ['}'] + ) + } else { + if(info.flags.includes('packed')) { + info.flags.splice(info.flags.indexOf('packed')) + info.packed = ' [packed=true]' + } + + if(completeFlags && info.flags.length === 0) { + info.flags.push('optional') + } + + const ret = [] + const indentation = moduleIndentationMap[info.type]?.indentation + let typeName = unnestName(info.type) + if(indentation !== parentName && indentation) { + typeName = `${indentation.replaceAll('$', '.')}.${typeName}` + } + + // if(info.enumValues) { + // // typeName = unnestName(info.type) + // ret = stringifyEnum(info, typeName) + // } + + ret.push(`${info.flags.join(' ') + (info.flags.length === 0 ? '' : ' ')}${typeName} ${info.name} = ${info.id}${info.packed || ''};`) + return ret + } + } + + // message specification stringifying function + const stringifyMessageSpec = (ident) => { + const members = moduleIndentationMap[ident.name]?.members + const result = [] + result.push( + `message ${ident.displayName || ident.name} {`, + ...addPrefix([].concat(...ident.members.map(m => stringifyMessageSpecMember(m, true, ident.name))), spaceIndent), + ) + + if(members?.size) { + const sortedMembers = Array.from(members).sort() + for(const memberName of sortedMembers) { + let entity = modInfo.identifiers[memberName] + if(entity) { + const displayName = entity.name.slice(ident.name.length + 1) + entity = { ...entity, displayName } + result.push(...addPrefix(getEntity(entity), spaceIndent)) + } else { + console.log('missing nested entity ', memberName) + } + } + } + + result.push('}') + result.push('') + + return result + } + + const getEntity = (v) => { + let result + if(v.members) { + result = stringifyMessageSpec(v) + } else if(v.enumValues?.length) { + result = stringifyEnum(v) + } else { + result = ['// Unknown entity ' + v.name] + } + + return result + } + + const stringifyEntity = v => { + return { + content: getEntity(v).join('\n'), + name: v.name + } + } + + for(const value of identifiers) { + const { name, content } = stringifyEntity(value) + if(!moduleIndentationMap[name]?.indentation?.length) { + decodedProtoMap[name] = content + } + // decodedProtoMap[name] = content + } + } + + // console.log(moduleIndentationMap) + const decodedProto = Object.keys(decodedProtoMap).sort() + const sortedStr = decodedProto.map(d => decodedProtoMap[d]).join('\n') + + const decodedProtoStr = `syntax = "proto2";\npackage proto;\n\n${sortedStr}` + const destinationPath = '../WAProto/WAProto.proto' + await fs.writeFile(destinationPath, decodedProtoStr) + + console.log(`Extracted protobuf schema to "${destinationPath}"`) +})() diff --git a/proto-extract/package.json b/proto-extract/package.json new file mode 100644 index 00000000000..36cd6600e53 --- /dev/null +++ b/proto-extract/package.json @@ -0,0 +1,18 @@ +{ + "name": "whatsapp-web-protobuf-extractor", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "start": "node index.js" + }, + "dependencies": { + "acorn": "^6.4.1", + "acorn-walk": "^6.1.1", + "pbjs": "^0.0.14", + "protobufjs": "^7.2.2", + "protobufjs-cli": "^1.1.1", + "request": "^2.88.0", + "request-promise-core": "^1.1.2", + "request-promise-native": "^1.0.7" + } +} \ No newline at end of file diff --git a/proto-extract/yarn.lock b/proto-extract/yarn.lock new file mode 100644 index 00000000000..ca6342c1992 --- /dev/null +++ b/proto-extract/yarn.lock @@ -0,0 +1,357 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +acorn-walk@^6.1.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn@^6.4.1: + version "6.4.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" + integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== + +ajv@^6.12.3: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" + integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.3: + version "5.1.5" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" + integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== + dependencies: + ajv "^6.12.3" + har-schema "^2.0.0" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +lodash@^4.17.19: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +mime-db@1.50.0: + version "1.50.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.50.0.tgz#abd4ac94e98d3c0e185016c67ab45d5fde40c11f" + integrity sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.33" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.33.tgz#1fa12a904472fafd068e48d9e8401f74d3f70edb" + integrity sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g== + dependencies: + mime-db "1.50.0" + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +psl@^1.1.28: + version "1.8.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +request-promise-core@1.1.4, request-promise-core@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" + integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== + dependencies: + lodash "^4.17.19" + +request-promise-native@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.9.tgz#e407120526a5efdc9a39b28a5679bf47b9d9dc28" + integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g== + dependencies: + request-promise-core "1.1.4" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + +request@^2.88.0: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + +tough-cookie@^2.3.3, tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +uuid@^3.3.2: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" diff --git a/src/Defaults/baileys-version.json b/src/Defaults/baileys-version.json new file mode 100644 index 00000000000..1eb52b02ae1 --- /dev/null +++ b/src/Defaults/baileys-version.json @@ -0,0 +1,3 @@ +{ + "version": [2, 2308, 7] +} \ No newline at end of file diff --git a/src/Defaults/index.ts b/src/Defaults/index.ts new file mode 100644 index 00000000000..6491a8c2a93 --- /dev/null +++ b/src/Defaults/index.ts @@ -0,0 +1,111 @@ +import { proto } from '../../WAProto' +import { makeLibSignalRepository } from '../Signal/libsignal' +import type { AuthenticationState, MediaType, SocketConfig, WAVersion } from '../Types' +import { Browsers } from '../Utils' +import logger from '../Utils/logger' +import { version } from './baileys-version.json' + +export const UNAUTHORIZED_CODES = [401, 403, 419] + +export const DEFAULT_ORIGIN = 'https://web.whatsapp.com' +export const DEF_CALLBACK_PREFIX = 'CB:' +export const DEF_TAG_PREFIX = 'TAG:' +export const PHONE_CONNECTION_CB = 'CB:Pong' + +export const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60 + +export const NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0' +export const DICT_VERSION = 2 +export const KEY_BUNDLE_TYPE = Buffer.from([5]) +export const NOISE_WA_HEADER = Buffer.from( + [ 87, 65, 6, DICT_VERSION ] +) // last is "DICT_VERSION" +/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */ +export const URL_REGEX = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/ +export const URL_EXCLUDE_REGEX = /.*@.*/ + +export const WA_CERT_DETAILS = { + SERIAL: 0, +} + +export const PROCESSABLE_HISTORY_TYPES = [ + proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP, + proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME, + proto.Message.HistorySyncNotification.HistorySyncType.RECENT, + proto.Message.HistorySyncNotification.HistorySyncType.FULL +] + +export const DEFAULT_CONNECTION_CONFIG: SocketConfig = { + version: version as WAVersion, + browser: Browsers.baileys('Chrome'), + waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat', + connectTimeoutMs: 20_000, + keepAliveIntervalMs: 15_000, + logger: logger.child({ class: 'baileys' }), + printQRInTerminal: false, + emitOwnEvents: true, + defaultQueryTimeoutMs: 60_000, + customUploadHosts: [], + retryRequestDelayMs: 250, + fireInitQueries: true, + auth: undefined as unknown as AuthenticationState, + markOnlineOnConnect: true, + syncFullHistory: false, + patchMessageBeforeSending: msg => msg, + shouldSyncHistoryMessage: () => true, + shouldIgnoreJid: () => false, + linkPreviewImageThumbnailWidth: 192, + transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 }, + generateHighQualityLinkPreview: false, + options: { }, + appStateMacVerification: { + patch: false, + snapshot: false, + }, + getMessage: async() => undefined, + makeSignalRepository: makeLibSignalRepository +} + +export const MEDIA_PATH_MAP: { [T in MediaType]?: string } = { + image: '/mms/image', + video: '/mms/video', + document: '/mms/document', + audio: '/mms/audio', + sticker: '/mms/image', + 'thumbnail-link': '/mms/image', + 'product-catalog-image': '/product/image', + 'md-app-state': '' +} + +export const MEDIA_HKDF_KEY_MAPPING = { + 'audio': 'Audio', + 'document': 'Document', + 'gif': 'Video', + 'image': 'Image', + 'ppic': '', + 'product': 'Image', + 'ptt': 'Audio', + 'sticker': 'Image', + 'video': 'Video', + 'thumbnail-document': 'Document Thumbnail', + 'thumbnail-image': 'Image Thumbnail', + 'thumbnail-video': 'Video Thumbnail', + 'thumbnail-link': 'Link Thumbnail', + 'md-msg-hist': 'History', + 'md-app-state': 'App State', + 'product-catalog-image': '', + 'payment-bg-image': 'Payment Background', +} + +export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP) as MediaType[] + +export const MIN_PREKEY_COUNT = 5 + +export const INITIAL_PREKEY_COUNT = 30 + +export const DEFAULT_CACHE_TTLS = { + SIGNAL_STORE: 5 * 60, // 5 minutes + MSG_RETRY: 60 * 60, // 1 hour + CALL_OFFER: 5 * 60, // 5 minutes + USER_DEVICES: 5 * 60, // 5 minutes +} \ No newline at end of file diff --git a/src/Signal/libsignal.ts b/src/Signal/libsignal.ts new file mode 100644 index 00000000000..13750506c71 --- /dev/null +++ b/src/Signal/libsignal.ts @@ -0,0 +1,141 @@ +import * as libsignal from 'libsignal' +import { GroupCipher, GroupSessionBuilder, SenderKeyDistributionMessage, SenderKeyName, SenderKeyRecord } from '../../WASignalGroup' +import { SignalAuthState } from '../Types' +import { SignalRepository } from '../Types/Signal' +import { generateSignalPubKey } from '../Utils' + +export function makeLibSignalRepository(auth: SignalAuthState): SignalRepository { + const storage = signalStorage(auth) + return { + decryptGroupMessage({ group, authorJid, msg }) { + const senderName = jidToSignalSenderKeyName(group, authorJid) + const cipher = new GroupCipher(storage, senderName) + + return cipher.decrypt(msg) + }, + async processSenderKeyDistributionMessage({ item, authorJid }) { + const builder = new GroupSessionBuilder(storage) + const senderName = jidToSignalSenderKeyName(item.groupId!, authorJid) + + const senderMsg = new SenderKeyDistributionMessage(null, null, null, null, item.axolotlSenderKeyDistributionMessage) + const { [senderName]: senderKey } = await auth.keys.get('sender-key', [senderName]) + if(!senderKey) { + await storage.storeSenderKey(senderName, new SenderKeyRecord()) + } + + await builder.process(senderName, senderMsg) + }, + async decryptMessage({ jid, type, ciphertext }) { + const addr = jidToSignalProtocolAddress(jid) + const session = new libsignal.SessionCipher(storage, addr) + let result: Buffer + switch (type) { + case 'pkmsg': + result = await session.decryptPreKeyWhisperMessage(ciphertext) + break + case 'msg': + result = await session.decryptWhisperMessage(ciphertext) + break + } + + return result + }, + async encryptMessage({ jid, data }) { + const addr = jidToSignalProtocolAddress(jid) + const cipher = new libsignal.SessionCipher(storage, addr) + + const { type: sigType, body } = await cipher.encrypt(data) + const type = sigType === 3 ? 'pkmsg' : 'msg' + return { type, ciphertext: Buffer.from(body, 'binary') } + }, + async encryptGroupMessage({ group, meId, data }) { + const senderName = jidToSignalSenderKeyName(group, meId) + const builder = new GroupSessionBuilder(storage) + + const { [senderName]: senderKey } = await auth.keys.get('sender-key', [senderName]) + if(!senderKey) { + await storage.storeSenderKey(senderName, new SenderKeyRecord()) + } + + const senderKeyDistributionMessage = await builder.create(senderName) + const session = new GroupCipher(storage, senderName) + const ciphertext = await session.encrypt(data) + + return { + ciphertext, + senderKeyDistributionMessage: senderKeyDistributionMessage.serialize(), + } + }, + async injectE2ESession({ jid, session }) { + const cipher = new libsignal.SessionBuilder(storage, jidToSignalProtocolAddress(jid)) + await cipher.initOutgoing(session) + }, + jidToSignalProtocolAddress(jid) { + return jidToSignalProtocolAddress(jid).toString() + }, + } +} + +const jidToSignalAddress = (jid: string) => jid.split('@')[0] + +const jidToSignalProtocolAddress = (jid: string) => { + return new libsignal.ProtocolAddress(jidToSignalAddress(jid), 0) +} + +const jidToSignalSenderKeyName = (group: string, user: string): string => { + return new SenderKeyName(group, jidToSignalProtocolAddress(user)).toString() +} + +function signalStorage({ creds, keys }: SignalAuthState) { + return { + loadSession: async(id: string) => { + const { [id]: sess } = await keys.get('session', [id]) + if(sess) { + return libsignal.SessionRecord.deserialize(sess) + } + }, + storeSession: async(id, session) => { + await keys.set({ 'session': { [id]: session.serialize() } }) + }, + isTrustedIdentity: () => { + return true + }, + loadPreKey: async(id: number | string) => { + const keyId = id.toString() + const { [keyId]: key } = await keys.get('pre-key', [keyId]) + if(key) { + return { + privKey: Buffer.from(key.private), + pubKey: Buffer.from(key.public) + } + } + }, + removePreKey: (id: number) => keys.set({ 'pre-key': { [id]: null } }), + loadSignedPreKey: () => { + const key = creds.signedPreKey + return { + privKey: Buffer.from(key.keyPair.private), + pubKey: Buffer.from(key.keyPair.public) + } + }, + loadSenderKey: async(keyId: string) => { + const { [keyId]: key } = await keys.get('sender-key', [keyId]) + if(key) { + return new SenderKeyRecord(key) + } + }, + storeSenderKey: async(keyId, key) => { + await keys.set({ 'sender-key': { [keyId]: key.serialize() } }) + }, + getOurRegistrationId: () => ( + creds.registrationId + ), + getOurIdentity: () => { + const { signedIdentityKey } = creds + return { + privKey: Buffer.from(signedIdentityKey.private), + pubKey: generateSignalPubKey(signedIdentityKey.public), + } + } + } +} \ No newline at end of file diff --git a/src/Socket/business.ts b/src/Socket/business.ts new file mode 100644 index 00000000000..dddb8b03158 --- /dev/null +++ b/src/Socket/business.ts @@ -0,0 +1,280 @@ +import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types' +import { parseCatalogNode, parseCollectionsNode, parseOrderDetailsNode, parseProductNode, toProductNode, uploadingNecessaryImagesOfProduct } from '../Utils/business' +import { BinaryNode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary' +import { getBinaryNodeChild } from '../WABinary/generic-utils' +import { makeMessagesRecvSocket } from './messages-recv' + +export const makeBusinessSocket = (config: SocketConfig) => { + const sock = makeMessagesRecvSocket(config) + const { + authState, + query, + waUploadToServer + } = sock + + const getCatalog = async({ jid, limit, cursor }: GetCatalogOptions) => { + jid = jid || authState.creds.me?.id + jid = jidNormalizedUser(jid!) + + const queryParamNodes: BinaryNode[] = [ + { + tag: 'limit', + attrs: { }, + content: Buffer.from((limit || 10).toString()) + }, + { + tag: 'width', + attrs: { }, + content: Buffer.from('100') + }, + { + tag: 'height', + attrs: { }, + content: Buffer.from('100') + }, + ] + + if(cursor) { + queryParamNodes.push({ + tag: 'after', + attrs: { }, + content: cursor + }) + } + + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'get', + xmlns: 'w:biz:catalog' + }, + content: [ + { + tag: 'product_catalog', + attrs: { + jid, + 'allow_shop_source': 'true' + }, + content: queryParamNodes + } + ] + }) + return parseCatalogNode(result) + } + + const getCollections = async(jid?: string, limit = 51) => { + jid = jid || authState.creds.me?.id + jid = jidNormalizedUser(jid!) + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'get', + xmlns: 'w:biz:catalog', + 'smax_id': '35' + }, + content: [ + { + tag: 'collections', + attrs: { + 'biz_jid': jid, + }, + content: [ + { + tag: 'collection_limit', + attrs: { }, + content: Buffer.from(limit.toString()) + }, + { + tag: 'item_limit', + attrs: { }, + content: Buffer.from(limit.toString()) + }, + { + tag: 'width', + attrs: { }, + content: Buffer.from('100') + }, + { + tag: 'height', + attrs: { }, + content: Buffer.from('100') + } + ] + } + ] + }) + + return parseCollectionsNode(result) + } + + const getOrderDetails = async(orderId: string, tokenBase64: string) => { + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'get', + xmlns: 'fb:thrift_iq', + 'smax_id': '5' + }, + content: [ + { + tag: 'order', + attrs: { + op: 'get', + id: orderId + }, + content: [ + { + tag: 'image_dimensions', + attrs: { }, + content: [ + { + tag: 'width', + attrs: { }, + content: Buffer.from('100') + }, + { + tag: 'height', + attrs: { }, + content: Buffer.from('100') + } + ] + }, + { + tag: 'token', + attrs: { }, + content: Buffer.from(tokenBase64) + } + ] + } + ] + }) + + return parseOrderDetailsNode(result) + } + + const productUpdate = async(productId: string, update: ProductUpdate) => { + update = await uploadingNecessaryImagesOfProduct(update, waUploadToServer) + const editNode = toProductNode(productId, update) + + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'w:biz:catalog' + }, + content: [ + { + tag: 'product_catalog_edit', + attrs: { v: '1' }, + content: [ + editNode, + { + tag: 'width', + attrs: { }, + content: '100' + }, + { + tag: 'height', + attrs: { }, + content: '100' + } + ] + } + ] + }) + + const productCatalogEditNode = getBinaryNodeChild(result, 'product_catalog_edit') + const productNode = getBinaryNodeChild(productCatalogEditNode, 'product') + + return parseProductNode(productNode!) + } + + const productCreate = async(create: ProductCreate) => { + // ensure isHidden is defined + create.isHidden = !!create.isHidden + create = await uploadingNecessaryImagesOfProduct(create, waUploadToServer) + const createNode = toProductNode(undefined, create) + + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'w:biz:catalog' + }, + content: [ + { + tag: 'product_catalog_add', + attrs: { v: '1' }, + content: [ + createNode, + { + tag: 'width', + attrs: { }, + content: '100' + }, + { + tag: 'height', + attrs: { }, + content: '100' + } + ] + } + ] + }) + + const productCatalogAddNode = getBinaryNodeChild(result, 'product_catalog_add') + const productNode = getBinaryNodeChild(productCatalogAddNode, 'product') + + return parseProductNode(productNode!) + } + + const productDelete = async(productIds: string[]) => { + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'w:biz:catalog' + }, + content: [ + { + tag: 'product_catalog_delete', + attrs: { v: '1' }, + content: productIds.map( + id => ({ + tag: 'product', + attrs: { }, + content: [ + { + tag: 'id', + attrs: { }, + content: Buffer.from(id) + } + ] + }) + ) + } + ] + }) + + const productCatalogDelNode = getBinaryNodeChild(result, 'product_catalog_delete') + return { + deleted: +(productCatalogDelNode?.attrs.deleted_count || 0) + } + } + + return { + ...sock, + getOrderDetails, + getCatalog, + getCollections, + productCreate, + productDelete, + productUpdate + } +} \ No newline at end of file diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts new file mode 100644 index 00000000000..da53448d6d1 --- /dev/null +++ b/src/Socket/chats.ts @@ -0,0 +1,867 @@ +import { Boom } from '@hapi/boom' +import { proto } from '../../WAProto' +import { PROCESSABLE_HISTORY_TYPES } from '../Defaults' +import { ALL_WA_PATCH_NAMES, ChatModification, ChatMutation, LTHashState, MessageUpsertType, PresenceData, SocketConfig, WABusinessHoursConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPatchName, WAPresence } from '../Types' +import { chatModificationToAppPatch, ChatMutationMap, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils' +import { makeMutex } from '../Utils/make-mutex' +import processMessage from '../Utils/process-message' +import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary' +import { makeSocket } from './socket' + +const MAX_SYNC_ATTEMPTS = 2 + +export const makeChatsSocket = (config: SocketConfig) => { + const { + logger, + markOnlineOnConnect, + fireInitQueries, + appStateMacVerification, + shouldIgnoreJid, + shouldSyncHistoryMessage, + } = config + const sock = makeSocket(config) + const { + ev, + ws, + authState, + generateMessageTag, + sendNode, + query, + onUnexpectedError, + } = sock + + let privacySettings: { [_: string]: string } | undefined + let needToFlushWithAppStateSync = false + let pendingAppStateSync = false + /** this mutex ensures that the notifications (receipts, messages etc.) are processed in order */ + const processingMutex = makeMutex() + + /** helper function to fetch the given app state sync key */ + const getAppStateSyncKey = async(keyId: string) => { + const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId]) + return key + } + + const fetchPrivacySettings = async(force: boolean = false) => { + if(!privacySettings || force) { + const { content } = await query({ + tag: 'iq', + attrs: { + xmlns: 'privacy', + to: S_WHATSAPP_NET, + type: 'get' + }, + content: [ + { tag: 'privacy', attrs: { } } + ] + }) + privacySettings = reduceBinaryNodeToDictionary(content?.[0] as BinaryNode, 'category') + } + + return privacySettings + } + + /** helper function to run a generic IQ query */ + const interactiveQuery = async(userNodes: BinaryNode[], queryNode: BinaryNode) => { + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'get', + xmlns: 'usync', + }, + content: [ + { + tag: 'usync', + attrs: { + sid: generateMessageTag(), + mode: 'query', + last: 'true', + index: '0', + context: 'interactive', + }, + content: [ + { + tag: 'query', + attrs: { }, + content: [ queryNode ] + }, + { + tag: 'list', + attrs: { }, + content: userNodes + } + ] + } + ], + }) + + const usyncNode = getBinaryNodeChild(result, 'usync') + const listNode = getBinaryNodeChild(usyncNode, 'list') + const users = getBinaryNodeChildren(listNode, 'user') + + return users + } + + const onWhatsApp = async(...jids: string[]) => { + const results = await interactiveQuery( + [ + { + tag: 'user', + attrs: { }, + content: jids.map( + jid => ({ + tag: 'contact', + attrs: { }, + content: `+${jid}` + }) + ) + } + ], + { tag: 'contact', attrs: { } } + ) + + return results.map(user => { + const contact = getBinaryNodeChild(user, 'contact') + return { exists: contact?.attrs.type === 'in', jid: user.attrs.jid } + }).filter(item => item.exists) + } + + const fetchStatus = async(jid: string) => { + const [result] = await interactiveQuery( + [{ tag: 'user', attrs: { jid } }], + { tag: 'status', attrs: { } } + ) + if(result) { + const status = getBinaryNodeChild(result, 'status') + return { + status: status?.content!.toString(), + setAt: new Date(+(status?.attrs.t || 0) * 1000) + } + } + } + + /** update the profile picture for yourself or a group */ + const updateProfilePicture = async(jid: string, content: WAMediaUpload) => { + const { img } = await generateProfilePicture(content) + await query({ + tag: 'iq', + attrs: { + to: jidNormalizedUser(jid), + type: 'set', + xmlns: 'w:profile:picture' + }, + content: [ + { + tag: 'picture', + attrs: { type: 'image' }, + content: img + } + ] + }) + } + + /** update the profile status for yourself */ + const updateProfileStatus = async(status: string) => { + await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'status' + }, + content: [ + { + tag: 'status', + attrs: { }, + content: Buffer.from(status, 'utf-8') + } + ] + }) + } + + const updateProfileName = async(name: string) => { + await chatModify({ pushNameSetting: name }, '') + } + + const fetchBlocklist = async() => { + const result = await query({ + tag: 'iq', + attrs: { + xmlns: 'blocklist', + to: S_WHATSAPP_NET, + type: 'get' + } + }) + + const listNode = getBinaryNodeChild(result, 'list') + return getBinaryNodeChildren(listNode, 'item') + .map(n => n.attrs.jid) + } + + const updateBlockStatus = async(jid: string, action: 'block' | 'unblock') => { + await query({ + tag: 'iq', + attrs: { + xmlns: 'blocklist', + to: S_WHATSAPP_NET, + type: 'set' + }, + content: [ + { + tag: 'item', + attrs: { + action, + jid + } + } + ] + }) + } + + const getBusinessProfile = async(jid: string): Promise => { + const results = await query({ + tag: 'iq', + attrs: { + to: 's.whatsapp.net', + xmlns: 'w:biz', + type: 'get' + }, + content: [{ + tag: 'business_profile', + attrs: { v: '244' }, + content: [{ + tag: 'profile', + attrs: { jid } + }] + }] + }) + + const profileNode = getBinaryNodeChild(results, 'business_profile') + const profiles = getBinaryNodeChild(profileNode, 'profile') + if(profiles) { + const address = getBinaryNodeChild(profiles, 'address') + const description = getBinaryNodeChild(profiles, 'description') + const website = getBinaryNodeChild(profiles, 'website') + const email = getBinaryNodeChild(profiles, 'email') + const category = getBinaryNodeChild(getBinaryNodeChild(profiles, 'categories'), 'category') + const businessHours = getBinaryNodeChild(profiles, 'business_hours') + const businessHoursConfig = businessHours + ? getBinaryNodeChildren(businessHours, 'business_hours_config') + : undefined + const websiteStr = website?.content?.toString() + return { + wid: profiles.attrs?.jid, + address: address?.content?.toString(), + description: description?.content?.toString() || '', + website: websiteStr ? [websiteStr] : [], + email: email?.content?.toString(), + category: category?.content?.toString(), + 'business_hours': { + timezone: businessHours?.attrs?.timezone, + 'business_config': businessHoursConfig?.map(({ attrs }) => attrs as unknown as WABusinessHoursConfig) + } + } + } + } + + const updateAccountSyncTimestamp = async(fromTimestamp: number | string) => { + logger.info({ fromTimestamp }, 'requesting account sync') + await sendNode({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'urn:xmpp:whatsapp:dirty', + id: generateMessageTag(), + }, + content: [ + { + tag: 'clean', + attrs: { + type: 'account_sync', + timestamp: fromTimestamp.toString(), + } + } + ] + }) + } + + const newAppStateChunkHandler = (isInitialSync: boolean) => { + return { + onMutation(mutation: ChatMutation) { + processSyncAction( + mutation, + ev, + authState.creds.me!, + isInitialSync ? { accountSettings: authState.creds.accountSettings } : undefined, + logger + ) + } + } + } + + const resyncAppState = ev.createBufferedFunction(async(collections: readonly WAPatchName[], isInitialSync: boolean) => { + // we use this to determine which events to fire + // otherwise when we resync from scratch -- all notifications will fire + const initialVersionMap: { [T in WAPatchName]?: number } = { } + const globalMutationMap: ChatMutationMap = { } + + await authState.keys.transaction( + async() => { + const collectionsToHandle = new Set(collections) + // in case something goes wrong -- ensure we don't enter a loop that cannot be exited from + const attemptsMap: { [T in WAPatchName]?: number } = { } + // keep executing till all collections are done + // sometimes a single patch request will not return all the patches (God knows why) + // so we fetch till they're all done (this is determined by the "has_more_patches" flag) + while(collectionsToHandle.size) { + const states = { } as { [T in WAPatchName]: LTHashState } + const nodes: BinaryNode[] = [] + + for(const name of collectionsToHandle) { + const result = await authState.keys.get('app-state-sync-version', [name]) + let state = result[name] + + if(state) { + if(typeof initialVersionMap[name] === 'undefined') { + initialVersionMap[name] = state.version + } + } else { + state = newLTHashState() + } + + states[name] = state + + logger.info(`resyncing ${name} from v${state.version}`) + + nodes.push({ + tag: 'collection', + attrs: { + name, + version: state.version.toString(), + // return snapshot if being synced from scratch + 'return_snapshot': (!state.version).toString() + } + }) + } + + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + xmlns: 'w:sync:app:state', + type: 'set' + }, + content: [ + { + tag: 'sync', + attrs: { }, + content: nodes + } + ] + }) + + // extract from binary node + const decoded = await extractSyncdPatches(result, config?.options) + for(const key in decoded) { + const name = key as WAPatchName + const { patches, hasMorePatches, snapshot } = decoded[name] + try { + if(snapshot) { + const { state: newState, mutationMap } = await decodeSyncdSnapshot( + name, + snapshot, + getAppStateSyncKey, + initialVersionMap[name], + appStateMacVerification.snapshot + ) + states[name] = newState + Object.assign(globalMutationMap, mutationMap) + + logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`) + + await authState.keys.set({ 'app-state-sync-version': { [name]: newState } }) + } + + // only process if there are syncd patches + if(patches.length) { + const { state: newState, mutationMap } = await decodePatches( + name, + patches, + states[name], + getAppStateSyncKey, + config.options, + initialVersionMap[name], + logger, + appStateMacVerification.patch + ) + + await authState.keys.set({ 'app-state-sync-version': { [name]: newState } }) + + logger.info(`synced ${name} to v${newState.version}`) + initialVersionMap[name] = newState.version + + Object.assign(globalMutationMap, mutationMap) + } + + if(hasMorePatches) { + logger.info(`${name} has more patches...`) + } else { // collection is done with sync + collectionsToHandle.delete(name) + } + } catch(error) { + // if retry attempts overshoot + // or key not found + const isIrrecoverableError = attemptsMap[name]! >= MAX_SYNC_ATTEMPTS + || error.output?.statusCode === 404 + || error.name === 'TypeError' + logger.info( + { name, error: error.stack }, + `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}` + ) + await authState.keys.set({ 'app-state-sync-version': { [name]: null } }) + // increment number of retries + attemptsMap[name] = (attemptsMap[name] || 0) + 1 + + if(isIrrecoverableError) { + // stop retrying + collectionsToHandle.delete(name) + } + } + } + } + } + ) + + const { onMutation } = newAppStateChunkHandler(isInitialSync) + for(const key in globalMutationMap) { + onMutation(globalMutationMap[key]) + } + }) + + /** + * fetch the profile picture of a user/group + * type = "preview" for a low res picture + * type = "image for the high res picture" + */ + const profilePictureUrl = async(jid: string, type: 'preview' | 'image' = 'preview', timeoutMs?: number) => { + jid = jidNormalizedUser(jid) + const result = await query({ + tag: 'iq', + attrs: { + to: jid, + type: 'get', + xmlns: 'w:profile:picture' + }, + content: [ + { tag: 'picture', attrs: { type, query: 'url' } } + ] + }, timeoutMs) + const child = getBinaryNodeChild(result, 'picture') + return child?.attrs?.url + } + + const sendPresenceUpdate = async(type: WAPresence, toJid?: string) => { + const me = authState.creds.me! + if(type === 'available' || type === 'unavailable') { + if(!me!.name) { + logger.warn('no name present, ignoring presence update request...') + return + } + + ev.emit('connection.update', { isOnline: type === 'available' }) + + await sendNode({ + tag: 'presence', + attrs: { + name: me!.name, + type + } + }) + } else { + await sendNode({ + tag: 'chatstate', + attrs: { + from: me!.id!, + to: toJid!, + }, + content: [ + { + tag: type === 'recording' ? 'composing' : type, + attrs: type === 'recording' ? { media : 'audio' } : {} + } + ] + }) + } + } + + /** + * @param toJid the jid to subscribe to + * @param tcToken token for subscription, use if present + */ + const presenceSubscribe = (toJid: string, tcToken?: Buffer) => ( + sendNode({ + tag: 'presence', + attrs: { + to: toJid, + id: generateMessageTag(), + type: 'subscribe' + }, + content: tcToken + ? [ + { + tag: 'tctoken', + attrs: { }, + content: tcToken + } + ] + : undefined + }) + ) + + const handlePresenceUpdate = ({ tag, attrs, content }: BinaryNode) => { + let presence: PresenceData | undefined + const jid = attrs.from + const participant = attrs.participant || attrs.from + + if(shouldIgnoreJid(jid)) { + return + } + + if(tag === 'presence') { + presence = { + lastKnownPresence: attrs.type === 'unavailable' ? 'unavailable' : 'available', + lastSeen: attrs.last && attrs.last !== 'deny' ? +attrs.last : undefined + } + } else if(Array.isArray(content)) { + const [firstChild] = content + let type = firstChild.tag as WAPresence + if(type === 'paused') { + type = 'available' + } + + if(firstChild.attrs?.media === 'audio') { + type = 'recording' + } + + presence = { lastKnownPresence: type } + } else { + logger.error({ tag, attrs, content }, 'recv invalid presence node') + } + + if(presence) { + ev.emit('presence.update', { id: jid, presences: { [participant]: presence } }) + } + } + + const appPatch = async(patchCreate: WAPatchCreate) => { + const name = patchCreate.type + const myAppStateKeyId = authState.creds.myAppStateKeyId + if(!myAppStateKeyId) { + throw new Boom('App state key not present!', { statusCode: 400 }) + } + + let initial: LTHashState + let encodeResult: { patch: proto.ISyncdPatch, state: LTHashState } + + await processingMutex.mutex( + async() => { + await authState.keys.transaction( + async() => { + logger.debug({ patch: patchCreate }, 'applying app patch') + + await resyncAppState([name], false) + + const { [name]: currentSyncVersion } = await authState.keys.get('app-state-sync-version', [name]) + initial = currentSyncVersion || newLTHashState() + + encodeResult = await encodeSyncdPatch( + patchCreate, + myAppStateKeyId, + initial, + getAppStateSyncKey, + ) + const { patch, state } = encodeResult + + const node: BinaryNode = { + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'w:sync:app:state' + }, + content: [ + { + tag: 'sync', + attrs: { }, + content: [ + { + tag: 'collection', + attrs: { + name, + version: (state.version - 1).toString(), + 'return_snapshot': 'false' + }, + content: [ + { + tag: 'patch', + attrs: { }, + content: proto.SyncdPatch.encode(patch).finish() + } + ] + } + ] + } + ] + } + await query(node) + + await authState.keys.set({ 'app-state-sync-version': { [name]: state } }) + } + ) + } + ) + + if(config.emitOwnEvents) { + const { onMutation } = newAppStateChunkHandler(false) + const { mutationMap } = await decodePatches( + name, + [{ ...encodeResult!.patch, version: { version: encodeResult!.state.version }, }], + initial!, + getAppStateSyncKey, + config.options, + undefined, + logger, + ) + for(const key in mutationMap) { + onMutation(mutationMap[key]) + } + } + } + + /** sending abt props may fix QR scan fail if server expects */ + const fetchAbt = async() => { + const abtNode = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + xmlns: 'abt', + type: 'get', + }, + content: [ + { tag: 'props', attrs: { protocol: '1' } } + ] + }) + + const propsNode = getBinaryNodeChild(abtNode, 'props') + + let props: { [_: string]: string } = { } + if(propsNode) { + props = reduceBinaryNodeToDictionary(propsNode, 'prop') + } + + logger.debug('fetched abt') + + return props + } + + /** sending non-abt props may fix QR scan fail if server expects */ + const fetchProps = async() => { + const resultNode = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + xmlns: 'w', + type: 'get', + }, + content: [ + { tag: 'props', attrs: { } } + ] + }) + + const propsNode = getBinaryNodeChild(resultNode, 'props') + + let props: { [_: string]: string } = { } + if(propsNode) { + props = reduceBinaryNodeToDictionary(propsNode, 'prop') + } + + logger.debug('fetched props') + + return props + } + + /** + * modify a chat -- mark unread, read etc. + * lastMessages must be sorted in reverse chronologically + * requires the last messages till the last message received; required for archive & unread + */ + const chatModify = (mod: ChatModification, jid: string) => { + const patch = chatModificationToAppPatch(mod, jid) + return appPatch(patch) + } + + /** + * queries need to be fired on connection open + * help ensure parity with WA Web + * */ + const executeInitQueries = async() => { + await Promise.all([ + fetchAbt(), + fetchProps(), + fetchBlocklist(), + fetchPrivacySettings(), + ]) + } + + const upsertMessage = ev.createBufferedFunction(async(msg: WAMessage, type: MessageUpsertType) => { + ev.emit('messages.upsert', { messages: [msg], type }) + + if(!!msg.pushName) { + let jid = msg.key.fromMe ? authState.creds.me!.id : (msg.key.participant || msg.key.remoteJid) + jid = jidNormalizedUser(jid!) + + if(!msg.key.fromMe) { + ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName! }]) + } + + // update our pushname too + if(msg.key.fromMe && msg.pushName && authState.creds.me?.name !== msg.pushName) { + ev.emit('creds.update', { me: { ...authState.creds.me!, name: msg.pushName! } }) + } + } + + const historyMsg = getHistoryMsg(msg.message!) + const shouldProcessHistoryMsg = historyMsg + ? ( + shouldSyncHistoryMessage(historyMsg) + && PROCESSABLE_HISTORY_TYPES.includes(historyMsg.syncType!) + ) + : false + + if(historyMsg && !authState.creds.myAppStateKeyId) { + logger.warn('skipping app state sync, as myAppStateKeyId is not set') + pendingAppStateSync = true + } + + await Promise.all([ + (async() => { + if( + historyMsg + && authState.creds.myAppStateKeyId + ) { + pendingAppStateSync = false + await doAppStateSync() + } + })(), + processMessage( + msg, + { + shouldProcessHistoryMsg, + ev, + creds: authState.creds, + keyStore: authState.keys, + logger, + options: config.options, + getMessage: config.getMessage, + } + ) + ]) + + if( + msg.message?.protocolMessage?.appStateSyncKeyShare + && pendingAppStateSync + ) { + await doAppStateSync() + pendingAppStateSync = false + } + + async function doAppStateSync() { + if(!authState.creds.accountSyncCounter) { + logger.info('doing initial app state sync') + await resyncAppState(ALL_WA_PATCH_NAMES, true) + + const accountSyncCounter = (authState.creds.accountSyncCounter || 0) + 1 + ev.emit('creds.update', { accountSyncCounter }) + + if(needToFlushWithAppStateSync) { + logger.debug('flushing with app state sync') + ev.flush() + } + } + } + }) + + ws.on('CB:presence', handlePresenceUpdate) + ws.on('CB:chatstate', handlePresenceUpdate) + + ws.on('CB:ib,,dirty', async(node: BinaryNode) => { + const { attrs } = getBinaryNodeChild(node, 'dirty')! + const type = attrs.type + switch (type) { + case 'account_sync': + if(attrs.timestamp) { + let { lastAccountSyncTimestamp } = authState.creds + if(lastAccountSyncTimestamp) { + await updateAccountSyncTimestamp(lastAccountSyncTimestamp) + } + + lastAccountSyncTimestamp = +attrs.timestamp + ev.emit('creds.update', { lastAccountSyncTimestamp }) + } + + break + default: + logger.info({ node }, 'received unknown sync') + break + } + }) + + ev.on('connection.update', ({ connection, receivedPendingNotifications }) => { + if(connection === 'open') { + if(fireInitQueries) { + executeInitQueries() + .catch( + error => onUnexpectedError(error, 'init queries') + ) + } + + sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable') + .catch( + error => onUnexpectedError(error, 'presence update requests') + ) + } + + if(receivedPendingNotifications) { + // if we don't have the app state key + // we keep buffering events until we finally have + // the key and can sync the messages + if(!authState.creds?.myAppStateKeyId) { + ev.buffer() + needToFlushWithAppStateSync = true + } + } + }) + + return { + ...sock, + processingMutex, + fetchPrivacySettings, + upsertMessage, + appPatch, + sendPresenceUpdate, + presenceSubscribe, + profilePictureUrl, + onWhatsApp, + fetchBlocklist, + fetchStatus, + updateProfilePicture, + updateProfileStatus, + updateProfileName, + updateBlockStatus, + getBusinessProfile, + resyncAppState, + chatModify + } +} diff --git a/src/Socket/groups.ts b/src/Socket/groups.ts new file mode 100644 index 00000000000..6a0dcca9de4 --- /dev/null +++ b/src/Socket/groups.ts @@ -0,0 +1,288 @@ +import { proto } from '../../WAProto' +import { GroupMetadata, GroupParticipant, ParticipantAction, SocketConfig, WAMessageKey, WAMessageStubType } from '../Types' +import { generateMessageID, unixTimestampSeconds } from '../Utils' +import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString, jidEncode, jidNormalizedUser } from '../WABinary' +import { makeChatsSocket } from './chats' + +export const makeGroupsSocket = (config: SocketConfig) => { + const sock = makeChatsSocket(config) + const { authState, ev, query, upsertMessage } = sock + + const groupQuery = async(jid: string, type: 'get' | 'set', content: BinaryNode[]) => ( + query({ + tag: 'iq', + attrs: { + type, + xmlns: 'w:g2', + to: jid, + }, + content + }) + ) + + const groupMetadata = async(jid: string) => { + const result = await groupQuery( + jid, + 'get', + [ { tag: 'query', attrs: { request: 'interactive' } } ] + ) + return extractGroupMetadata(result) + } + + return { + ...sock, + groupMetadata, + groupCreate: async(subject: string, participants: string[]) => { + const key = generateMessageID() + const result = await groupQuery( + '@g.us', + 'set', + [ + { + tag: 'create', + attrs: { + subject, + key + }, + content: participants.map(jid => ({ + tag: 'participant', + attrs: { jid } + })) + } + ] + ) + return extractGroupMetadata(result) + }, + groupLeave: async(id: string) => { + await groupQuery( + '@g.us', + 'set', + [ + { + tag: 'leave', + attrs: { }, + content: [ + { tag: 'group', attrs: { id } } + ] + } + ] + ) + }, + groupUpdateSubject: async(jid: string, subject: string) => { + await groupQuery( + jid, + 'set', + [ + { + tag: 'subject', + attrs: { }, + content: Buffer.from(subject, 'utf-8') + } + ] + ) + }, + groupParticipantsUpdate: async( + jid: string, + participants: string[], + action: ParticipantAction + ) => { + const result = await groupQuery( + jid, + 'set', + [ + { + tag: action, + attrs: { }, + content: participants.map(jid => ({ + tag: 'participant', + attrs: { jid } + })) + } + ] + ) + const node = getBinaryNodeChild(result, action) + const participantsAffected = getBinaryNodeChildren(node!, 'participant') + return participantsAffected.map(p => { + return { status: p.attrs.error || '200', jid: p.attrs.jid } + }) + }, + groupUpdateDescription: async(jid: string, description?: string) => { + const metadata = await groupMetadata(jid) + const prev = metadata.descId ?? null + + await groupQuery( + jid, + 'set', + [ + { + tag: 'description', + attrs: { + ...(description ? { id: generateMessageID() } : { delete: 'true' }), + ...(prev ? { prev } : {}) + }, + content: description ? [ + { tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') } + ] : undefined + } + ] + ) + }, + groupInviteCode: async(jid: string) => { + const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]) + const inviteNode = getBinaryNodeChild(result, 'invite') + return inviteNode?.attrs.code + }, + groupRevokeInvite: async(jid: string) => { + const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]) + const inviteNode = getBinaryNodeChild(result, 'invite') + return inviteNode?.attrs.code + }, + groupAcceptInvite: async(code: string) => { + const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]) + const result = getBinaryNodeChild(results, 'group') + return result?.attrs.jid + }, + /** + * accept a GroupInviteMessage + * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite + * @param inviteMessage the message to accept + */ + groupAcceptInviteV4: ev.createBufferedFunction(async(key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => { + key = typeof key === 'string' ? { remoteJid: key } : key + const results = await groupQuery(inviteMessage.groupJid!, 'set', [{ + tag: 'accept', + attrs: { + code: inviteMessage.inviteCode!, + expiration: inviteMessage.inviteExpiration!.toString(), + admin: key.remoteJid! + } + }]) + + // if we have the full message key + // update the invite message to be expired + if(key.id) { + // create new invite message that is expired + inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage) + inviteMessage.inviteExpiration = 0 + inviteMessage.inviteCode = '' + ev.emit('messages.update', [ + { + key, + update: { + message: { + groupInviteMessage: inviteMessage + } + } + } + ]) + } + + // generate the group add message + await upsertMessage( + { + key: { + remoteJid: inviteMessage.groupJid, + id: generateMessageID(), + fromMe: false, + participant: key.remoteJid, + }, + messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD, + messageStubParameters: [ + authState.creds.me!.id + ], + participant: key.remoteJid, + messageTimestamp: unixTimestampSeconds() + }, + 'notify' + ) + + return results.attrs.from + }), + groupGetInviteInfo: async(code: string) => { + const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]) + return extractGroupMetadata(results) + }, + groupToggleEphemeral: async(jid: string, ephemeralExpiration: number) => { + const content: BinaryNode = ephemeralExpiration ? + { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } : + { tag: 'not_ephemeral', attrs: { } } + await groupQuery(jid, 'set', [content]) + }, + groupSettingUpdate: async(jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => { + await groupQuery(jid, 'set', [ { tag: setting, attrs: { } } ]) + }, + groupFetchAllParticipating: async() => { + const result = await query({ + tag: 'iq', + attrs: { + to: '@g.us', + xmlns: 'w:g2', + type: 'get', + }, + content: [ + { + tag: 'participating', + attrs: { }, + content: [ + { tag: 'participants', attrs: { } }, + { tag: 'description', attrs: { } } + ] + } + ] + }) + const data: { [_: string]: GroupMetadata } = { } + const groupsChild = getBinaryNodeChild(result, 'groups') + if(groupsChild) { + const groups = getBinaryNodeChildren(groupsChild, 'group') + for(const groupNode of groups) { + const meta = extractGroupMetadata({ + tag: 'result', + attrs: { }, + content: [groupNode] + }) + data[meta.id] = meta + } + } + + return data + } + } +} + + +export const extractGroupMetadata = (result: BinaryNode) => { + const group = getBinaryNodeChild(result, 'group')! + const descChild = getBinaryNodeChild(group, 'description') + let desc: string | undefined + let descId: string | undefined + if(descChild) { + desc = getBinaryNodeChildString(descChild, 'body') + descId = descChild.attrs.id + } + + const groupId = group.attrs.id.includes('@') ? group.attrs.id : jidEncode(group.attrs.id, 'g.us') + const eph = getBinaryNodeChild(group, 'ephemeral')?.attrs.expiration + const metadata: GroupMetadata = { + id: groupId, + subject: group.attrs.subject, + subjectOwner: group.attrs.s_o, + subjectTime: +group.attrs.s_t, + size: +group.attrs.size, + creation: +group.attrs.creation, + owner: group.attrs.creator ? jidNormalizedUser(group.attrs.creator) : undefined, + desc, + descId, + restrict: !!getBinaryNodeChild(group, 'locked'), + announce: !!getBinaryNodeChild(group, 'announcement'), + participants: getBinaryNodeChildren(group, 'participant').map( + ({ attrs }) => { + return { + id: attrs.jid, + admin: (attrs.type || null) as GroupParticipant['admin'], + } + } + ), + ephemeralDuration: eph ? +eph : undefined + } + return metadata +} diff --git a/src/Socket/index.ts b/src/Socket/index.ts new file mode 100644 index 00000000000..7efebf0b2b5 --- /dev/null +++ b/src/Socket/index.ts @@ -0,0 +1,13 @@ +import { DEFAULT_CONNECTION_CONFIG } from '../Defaults' +import { UserFacingSocketConfig } from '../Types' +import { makeBusinessSocket as _makeSocket } from './business' + +// export the last socket layer +const makeWASocket = (config: UserFacingSocketConfig) => ( + _makeSocket({ + ...DEFAULT_CONNECTION_CONFIG, + ...config + }) +) + +export default makeWASocket \ No newline at end of file diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts new file mode 100644 index 00000000000..88d8fa5ffa9 --- /dev/null +++ b/src/Socket/messages-recv.ts @@ -0,0 +1,766 @@ + +import NodeCache from 'node-cache' +import { proto } from '../../WAProto' +import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT } from '../Defaults' +import { MessageReceiptType, MessageRelayOptions, MessageUserReceipt, SocketConfig, WACallEvent, WAMessageKey, WAMessageStatus, WAMessageStubType, WAPatchName } from '../Types' +import { decodeMediaRetryNode, decryptMessageNode, delay, encodeBigEndian, encodeSignedDeviceIdentity, getCallStatusFromNode, getHistoryMsg, getNextPreKeys, getStatusFromReceiptType, unixTimestampSeconds, xmppPreKey, xmppSignedPreKey } from '../Utils' +import { makeMutex } from '../Utils/make-mutex' +import { cleanMessage } from '../Utils/process-message' +import { areJidsSameUser, BinaryNode, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildren, isJidGroup, isJidUser, jidDecode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary' +import { extractGroupMetadata } from './groups' +import { makeMessagesSocket } from './messages-send' + +export const makeMessagesRecvSocket = (config: SocketConfig) => { + const { + logger, + retryRequestDelayMs, + getMessage, + shouldIgnoreJid + } = config + const sock = makeMessagesSocket(config) + const { + ev, + authState, + ws, + processingMutex, + signalRepository, + query, + upsertMessage, + resyncAppState, + onUnexpectedError, + assertSessions, + sendNode, + relayMessage, + sendReceipt, + uploadPreKeys, + } = sock + + /** this mutex ensures that each retryRequest will wait for the previous one to finish */ + const retryMutex = makeMutex() + + const msgRetryCache = config.msgRetryCounterCache || new NodeCache({ + stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour + useClones: false + }) + const callOfferCache = config.callOfferCache || new NodeCache({ + stdTTL: DEFAULT_CACHE_TTLS.CALL_OFFER, // 5 mins + useClones: false + }) + + let sendActiveReceipts = false + + const sendMessageAck = async({ tag, attrs }: BinaryNode) => { + const stanza: BinaryNode = { + tag: 'ack', + attrs: { + id: attrs.id, + to: attrs.from, + class: tag, + } + } + + if(!!attrs.participant) { + stanza.attrs.participant = attrs.participant + } + + if(!!attrs.recipient) { + stanza.attrs.recipient = attrs.recipient + } + + if(tag !== 'message' && attrs.type) { + stanza.attrs.type = attrs.type + } + + logger.debug({ recv: { tag, attrs }, sent: stanza.attrs }, 'sent ack') + await sendNode(stanza) + } + + const rejectCall = async(callId: string, callFrom: string) => { + const stanza: BinaryNode = ({ + tag: 'call', + attrs: { + from: authState.creds.me!.id, + to: callFrom, + }, + content: [{ + tag: 'reject', + attrs: { + 'call-id': callId, + 'call-creator': callFrom, + count: '0', + }, + content: undefined, + }], + }) + await query(stanza) + } + + const sendRetryRequest = async(node: BinaryNode, forceIncludeKeys = false) => { + const msgId = node.attrs.id + + let retryCount = msgRetryCache.get(msgId) || 0 + if(retryCount >= 5) { + logger.debug({ retryCount, msgId }, 'reached retry limit, clearing') + msgRetryCache.del(msgId) + return + } + + retryCount += 1 + msgRetryCache.set(msgId, retryCount) + + const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds + + const deviceIdentity = encodeSignedDeviceIdentity(account!, true) + await authState.keys.transaction( + async() => { + const receipt: BinaryNode = { + tag: 'receipt', + attrs: { + id: msgId, + type: 'retry', + to: node.attrs.from + }, + content: [ + { + tag: 'retry', + attrs: { + count: retryCount.toString(), + id: node.attrs.id, + t: node.attrs.t, + v: '1' + } + }, + { + tag: 'registration', + attrs: { }, + content: encodeBigEndian(authState.creds.registrationId) + } + ] + } + + if(node.attrs.recipient) { + receipt.attrs.recipient = node.attrs.recipient + } + + if(node.attrs.participant) { + receipt.attrs.participant = node.attrs.participant + } + + if(retryCount > 1 || forceIncludeKeys) { + const { update, preKeys } = await getNextPreKeys(authState, 1) + + const [keyId] = Object.keys(preKeys) + const key = preKeys[+keyId] + + const content = receipt.content! as BinaryNode[] + content.push({ + tag: 'keys', + attrs: { }, + content: [ + { tag: 'type', attrs: { }, content: Buffer.from(KEY_BUNDLE_TYPE) }, + { tag: 'identity', attrs: { }, content: identityKey.public }, + xmppPreKey(key, +keyId), + xmppSignedPreKey(signedPreKey), + { tag: 'device-identity', attrs: { }, content: deviceIdentity } + ] + }) + + ev.emit('creds.update', update) + } + + await sendNode(receipt) + + logger.info({ msgAttrs: node.attrs, retryCount }, 'sent retry receipt') + } + ) + } + + const handleEncryptNotification = async(node: BinaryNode) => { + const from = node.attrs.from + if(from === S_WHATSAPP_NET) { + const countChild = getBinaryNodeChild(node, 'count') + const count = +countChild!.attrs.value + const shouldUploadMorePreKeys = count < MIN_PREKEY_COUNT + + logger.debug({ count, shouldUploadMorePreKeys }, 'recv pre-key count') + if(shouldUploadMorePreKeys) { + await uploadPreKeys() + } + } else { + const identityNode = getBinaryNodeChild(node, 'identity') + if(identityNode) { + logger.info({ jid: from }, 'identity changed') + // not handling right now + // signal will override new identity anyway + } else { + logger.info({ node }, 'unknown encrypt notification') + } + } + } + + const handleGroupNotification = ( + participant: string, + child: BinaryNode, + msg: Partial + ) => { + switch (child?.tag) { + case 'create': + const metadata = extractGroupMetadata(child) + + msg.messageStubType = WAMessageStubType.GROUP_CREATE + msg.messageStubParameters = [metadata.subject] + msg.key = { participant: metadata.owner } + + ev.emit('chats.upsert', [{ + id: metadata.id, + name: metadata.subject, + conversationTimestamp: metadata.creation, + }]) + ev.emit('groups.upsert', [metadata]) + break + case 'ephemeral': + case 'not_ephemeral': + msg.message = { + protocolMessage: { + type: proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING, + ephemeralExpiration: +(child.attrs.expiration || 0) + } + } + break + case 'promote': + case 'demote': + case 'remove': + case 'add': + case 'leave': + const stubType = `GROUP_PARTICIPANT_${child.tag!.toUpperCase()}` + msg.messageStubType = WAMessageStubType[stubType] + + const participants = getBinaryNodeChildren(child, 'participant').map(p => p.attrs.jid) + if( + participants.length === 1 && + // if recv. "remove" message and sender removed themselves + // mark as left + areJidsSameUser(participants[0], participant) && + child.tag === 'remove' + ) { + msg.messageStubType = WAMessageStubType.GROUP_PARTICIPANT_LEAVE + } + + msg.messageStubParameters = participants + break + case 'subject': + msg.messageStubType = WAMessageStubType.GROUP_CHANGE_SUBJECT + msg.messageStubParameters = [ child.attrs.subject ] + break + case 'announcement': + case 'not_announcement': + msg.messageStubType = WAMessageStubType.GROUP_CHANGE_ANNOUNCE + msg.messageStubParameters = [ (child.tag === 'announcement') ? 'on' : 'off' ] + break + case 'locked': + case 'unlocked': + msg.messageStubType = WAMessageStubType.GROUP_CHANGE_RESTRICT + msg.messageStubParameters = [ (child.tag === 'locked') ? 'on' : 'off' ] + break + case 'invite': + msg.messageStubType = WAMessageStubType.GROUP_CHANGE_INVITE_LINK + msg.messageStubParameters = [ child.attrs.code ] + break + } + } + + const processNotification = async(node: BinaryNode) => { + const result: Partial = { } + const [child] = getAllBinaryNodeChildren(node) + const nodeType = node.attrs.type + const from = jidNormalizedUser(node.attrs.from) + + switch (nodeType) { + case 'privacy_token': + const tokenList = getBinaryNodeChildren(child, 'token') + for(const { attrs, content } of tokenList) { + const jid = attrs.jid + ev.emit('chats.update', [ + { + id: jid, + tcToken: content as Buffer + } + ]) + + logger.debug({ jid }, 'got privacy token update') + } + + break + case 'w:gp2': + handleGroupNotification(node.attrs.participant, child, result) + break + case 'mediaretry': + const event = decodeMediaRetryNode(node) + ev.emit('messages.media-update', [event]) + break + case 'encrypt': + await handleEncryptNotification(node) + break + case 'devices': + const devices = getBinaryNodeChildren(child, 'device') + if(areJidsSameUser(child.attrs.jid, authState.creds!.me!.id)) { + const deviceJids = devices.map(d => d.attrs.jid) + logger.info({ deviceJids }, 'got my own devices') + } + + break + case 'server_sync': + const update = getBinaryNodeChild(node, 'collection') + if(update) { + const name = update.attrs.name as WAPatchName + await resyncAppState([name], false) + } + + break + case 'picture': + const setPicture = getBinaryNodeChild(node, 'set') + const delPicture = getBinaryNodeChild(node, 'delete') + + ev.emit('contacts.update', [{ + id: from, + imgUrl: setPicture ? 'changed' : null + }]) + + if(isJidGroup(from)) { + const node = setPicture || delPicture + result.messageStubType = WAMessageStubType.GROUP_CHANGE_ICON + + if(setPicture) { + result.messageStubParameters = [ setPicture.attrs.id ] + } + + result.participant = node?.attrs.author + result.key = { + ...result.key || {}, + participant: setPicture?.attrs.author + } + } + + break + case 'account_sync': + if(child.tag === 'disappearing_mode') { + const newDuration = +child.attrs.duration + const timestamp = +child.attrs.t + + logger.info({ newDuration }, 'updated account disappearing mode') + + ev.emit('creds.update', { + accountSettings: { + ...authState.creds.accountSettings, + defaultDisappearingMode: { + ephemeralExpiration: newDuration, + ephemeralSettingTimestamp: timestamp, + }, + } + }) + } + + break + } + + if(Object.keys(result).length) { + return result + } + } + + const willSendMessageAgain = (id: string, participant: string) => { + const key = `${id}:${participant}` + const retryCount = msgRetryCache.get(key) || 0 + return retryCount < 5 + } + + const updateSendMessageAgainCount = (id: string, participant: string) => { + const key = `${id}:${participant}` + const newValue = (msgRetryCache.get(key) || 0) + 1 + msgRetryCache.set(key, newValue) + } + + const sendMessagesAgain = async( + key: proto.IMessageKey, + ids: string[], + retryNode: BinaryNode + ) => { + const msgs = await Promise.all(ids.map(id => getMessage({ ...key, id }))) + const remoteJid = key.remoteJid! + const participant = key.participant || remoteJid + // if it's the primary jid sending the request + // just re-send the message to everyone + // prevents the first message decryption failure + const sendToAll = !jidDecode(participant)?.device + await assertSessions([participant], true) + + if(isJidGroup(remoteJid)) { + await authState.keys.set({ 'sender-key-memory': { [remoteJid]: null } }) + } + + logger.debug({ participant, sendToAll }, 'forced new session for retry recp') + + for(let i = 0; i < msgs.length;i++) { + const msg = msgs[i] + if(msg) { + updateSendMessageAgainCount(ids[i], participant) + const msgRelayOpts: MessageRelayOptions = { messageId: ids[i] } + + if(sendToAll) { + msgRelayOpts.useUserDevicesCache = false + } else { + msgRelayOpts.participant = { + jid: participant, + count: +retryNode.attrs.count + } + } + + await relayMessage(key.remoteJid!, msg, msgRelayOpts) + } else { + logger.debug({ jid: key.remoteJid, id: ids[i] }, 'recv retry request, but message not available') + } + } + } + + const handleReceipt = async(node: BinaryNode) => { + const { attrs, content } = node + const isNodeFromMe = areJidsSameUser(attrs.participant || attrs.from, authState.creds.me?.id) + const remoteJid = !isNodeFromMe || isJidGroup(attrs.from) ? attrs.from : attrs.recipient + const fromMe = !attrs.recipient || (attrs.type === 'retry' && isNodeFromMe) + + const key: proto.IMessageKey = { + remoteJid, + id: '', + fromMe, + participant: attrs.participant + } + + if(shouldIgnoreJid(remoteJid)) { + logger.debug({ remoteJid }, 'ignoring receipt from jid') + await sendMessageAck(node) + return + } + + const ids = [attrs.id] + if(Array.isArray(content)) { + const items = getBinaryNodeChildren(content[0], 'item') + ids.push(...items.map(i => i.attrs.id)) + } + + await Promise.all([ + processingMutex.mutex( + async() => { + const status = getStatusFromReceiptType(attrs.type) + if( + typeof status !== 'undefined' && + ( + // basically, we only want to know when a message from us has been delivered to/read by the other person + // or another device of ours has read some messages + status > proto.WebMessageInfo.Status.DELIVERY_ACK || + !isNodeFromMe + ) + ) { + if(isJidGroup(remoteJid)) { + if(attrs.participant) { + const updateKey: keyof MessageUserReceipt = status === proto.WebMessageInfo.Status.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp' + ev.emit( + 'message-receipt.update', + ids.map(id => ({ + key: { ...key, id }, + receipt: { + userJid: jidNormalizedUser(attrs.participant), + [updateKey]: +attrs.t + } + })) + ) + } + } else { + ev.emit( + 'messages.update', + ids.map(id => ({ + key: { ...key, id }, + update: { status } + })) + ) + } + } + + if(attrs.type === 'retry') { + // correctly set who is asking for the retry + key.participant = key.participant || attrs.from + const retryNode = getBinaryNodeChild(node, 'retry') + if(willSendMessageAgain(ids[0], key.participant)) { + if(key.fromMe) { + try { + logger.debug({ attrs, key }, 'recv retry request') + await sendMessagesAgain(key, ids, retryNode!) + } catch(error) { + logger.error({ key, ids, trace: error.stack }, 'error in sending message again') + } + } else { + logger.info({ attrs, key }, 'recv retry for not fromMe message') + } + } else { + logger.info({ attrs, key }, 'will not send message again, as sent too many times') + } + } + } + ), + sendMessageAck(node) + ]) + } + + const handleNotification = async(node: BinaryNode) => { + const remoteJid = node.attrs.from + if(shouldIgnoreJid(remoteJid)) { + logger.debug({ remoteJid, id: node.attrs.id }, 'ignored notification') + await sendMessageAck(node) + return + } + + await Promise.all([ + processingMutex.mutex( + async() => { + const msg = await processNotification(node) + if(msg) { + const fromMe = areJidsSameUser(node.attrs.participant || remoteJid, authState.creds.me!.id) + msg.key = { + remoteJid, + fromMe, + participant: node.attrs.participant, + id: node.attrs.id, + ...(msg.key || {}) + } + msg.participant ??= node.attrs.participant + msg.messageTimestamp = +node.attrs.t + + const fullMsg = proto.WebMessageInfo.fromObject(msg) + await upsertMessage(fullMsg, 'append') + } + } + ), + sendMessageAck(node) + ]) + } + + const handleMessage = async(node: BinaryNode) => { + const { fullMessage: msg, category, author, decrypt } = decryptMessageNode( + node, + authState.creds.me!.id, + signalRepository, + logger, + ) + if(shouldIgnoreJid(msg.key.remoteJid!)) { + logger.debug({ key: msg.key }, 'ignored message') + await sendMessageAck(node) + return + } + + await Promise.all([ + processingMutex.mutex( + async() => { + await decrypt() + // message failed to decrypt + if(msg.messageStubType === proto.WebMessageInfo.StubType.CIPHERTEXT) { + retryMutex.mutex( + async() => { + if(ws.readyState === ws.OPEN) { + const encNode = getBinaryNodeChild(node, 'enc') + await sendRetryRequest(node, !encNode) + if(retryRequestDelayMs) { + await delay(retryRequestDelayMs) + } + } else { + logger.debug({ node }, 'connection closed, ignoring retry req') + } + } + ) + } else { + // no type in the receipt => message delivered + let type: MessageReceiptType = undefined + let participant = msg.key.participant + if(category === 'peer') { // special peer message + type = 'peer_msg' + } else if(msg.key.fromMe) { // message was sent by us from a different device + type = 'sender' + // need to specially handle this case + if(isJidUser(msg.key.remoteJid!)) { + participant = author + } + } else if(!sendActiveReceipts) { + type = 'inactive' + } + + await sendReceipt(msg.key.remoteJid!, participant!, [msg.key.id!], type) + + // send ack for history message + const isAnyHistoryMsg = getHistoryMsg(msg.message!) + if(isAnyHistoryMsg) { + const jid = jidNormalizedUser(msg.key.remoteJid!) + await sendReceipt(jid, undefined, [msg.key.id!], 'hist_sync') + } + } + + cleanMessage(msg, authState.creds.me!.id) + + await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify') + } + ), + sendMessageAck(node) + ]) + } + + const handleCall = async(node: BinaryNode) => { + const { attrs } = node + const [infoChild] = getAllBinaryNodeChildren(node) + const callId = infoChild.attrs['call-id'] + const from = infoChild.attrs.from || infoChild.attrs['call-creator'] + const status = getCallStatusFromNode(infoChild) + const call: WACallEvent = { + chatId: attrs.from, + from, + id: callId, + date: new Date(+attrs.t * 1000), + offline: !!attrs.offline, + status, + } + + if(status === 'offer') { + call.isVideo = !!getBinaryNodeChild(infoChild, 'video') + call.isGroup = infoChild.attrs.type === 'group' + callOfferCache.set(call.id, call) + } + + const existingCall = callOfferCache.get(call.id) + + // use existing call info to populate this event + if(existingCall) { + call.isVideo = existingCall.isVideo + call.isGroup = existingCall.isGroup + } + + // delete data once call has ended + if(status === 'reject' || status === 'accept' || status === 'timeout') { + callOfferCache.del(call.id) + } + + ev.emit('call', [call]) + + await sendMessageAck(node) + } + + const handleBadAck = async({ attrs }: BinaryNode) => { + const key: WAMessageKey = { remoteJid: attrs.from, fromMe: true, id: attrs.id } + // current hypothesis is that if pash is sent in the ack + // it means -- the message hasn't reached all devices yet + // we'll retry sending the message here + if(attrs.phash) { + logger.info({ attrs }, 'received phash in ack, resending message...') + const msg = await getMessage(key) + if(msg) { + await relayMessage(key.remoteJid!, msg, { messageId: key.id!, useUserDevicesCache: false }) + } else { + logger.warn({ attrs }, 'could not send message again, as it was not found') + } + } + + // error in acknowledgement, + // device could not display the message + if(attrs.error) { + logger.warn({ attrs }, 'received error in ack') + ev.emit( + 'messages.update', + [ + { + key, + update: { + status: WAMessageStatus.ERROR, + messageStubParameters: [ + attrs.error + ] + } + } + ] + ) + } + } + + /// processes a node with the given function + /// and adds the task to the existing buffer if we're buffering events + const processNodeWithBuffer = async( + node: BinaryNode, + identifier: string, + exec: (node: BinaryNode) => Promise + ) => { + ev.buffer() + await execTask() + ev.flush() + + function execTask() { + return exec(node) + .catch(err => onUnexpectedError(err, identifier)) + } + } + + // recv a message + ws.on('CB:message', (node: BinaryNode) => { + processNodeWithBuffer(node, 'processing message', handleMessage) + }) + + ws.on('CB:call', async(node: BinaryNode) => { + processNodeWithBuffer(node, 'handling call', handleCall) + }) + + ws.on('CB:receipt', node => { + processNodeWithBuffer(node, 'handling receipt', handleReceipt) + }) + + ws.on('CB:notification', async(node: BinaryNode) => { + processNodeWithBuffer(node, 'handling notification', handleNotification) + }) + + ws.on('CB:ack,class:message', (node: BinaryNode) => { + handleBadAck(node) + .catch(error => onUnexpectedError(error, 'handling bad ack')) + }) + + ev.on('call', ([ call ]) => { + // missed call + group call notification message generation + if(call.status === 'timeout' || (call.status === 'offer' && call.isGroup)) { + const msg: proto.IWebMessageInfo = { + key: { + remoteJid: call.chatId, + id: call.id, + fromMe: false + }, + messageTimestamp: unixTimestampSeconds(call.date), + } + if(call.status === 'timeout') { + if(call.isGroup) { + msg.messageStubType = call.isVideo ? WAMessageStubType.CALL_MISSED_GROUP_VIDEO : WAMessageStubType.CALL_MISSED_GROUP_VOICE + } else { + msg.messageStubType = call.isVideo ? WAMessageStubType.CALL_MISSED_VIDEO : WAMessageStubType.CALL_MISSED_VOICE + } + } else { + msg.message = { call: { callKey: Buffer.from(call.id) } } + } + + const protoMsg = proto.WebMessageInfo.fromObject(msg) + upsertMessage(protoMsg, call.offline ? 'append' : 'notify') + } + }) + + ev.on('connection.update', ({ isOnline }) => { + if(typeof isOnline !== 'undefined') { + sendActiveReceipts = isOnline + logger.trace(`sendActiveReceipts set to "${sendActiveReceipts}"`) + } + }) + + return { + ...sock, + sendMessageAck, + sendRetryRequest, + rejectCall + } +} diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts new file mode 100644 index 00000000000..142823c410c --- /dev/null +++ b/src/Socket/messages-send.ts @@ -0,0 +1,755 @@ +import { Boom } from '@hapi/boom' +import NodeCache from 'node-cache' +import { proto } from '../../WAProto' +import { DEFAULT_CACHE_TTLS, WA_DEFAULT_EPHEMERAL } from '../Defaults' +import { AnyMessageContent, MediaConnInfo, MessageReceiptType, MessageRelayOptions, MiscMessageGenerationOptions, SocketConfig, WAMessageKey } from '../Types' +import { aggregateMessageKeysNotFromMe, assertMediaContent, bindWaitForEvent, decryptMediaRetryData, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageID, generateWAMessage, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils' +import { getUrlInfo } from '../Utils/link-preview' +import { areJidsSameUser, BinaryNode, BinaryNodeAttributes, getBinaryNodeChild, getBinaryNodeChildren, isJidGroup, isJidUser, jidDecode, jidEncode, jidNormalizedUser, JidWithDevice, S_WHATSAPP_NET } from '../WABinary' +import { makeGroupsSocket } from './groups' +import ListType = proto.Message.ListMessage.ListType; + +export const makeMessagesSocket = (config: SocketConfig) => { + const { + logger, + linkPreviewImageThumbnailWidth, + generateHighQualityLinkPreview, + options: axiosOptions, + patchMessageBeforeSending, + } = config + const sock = makeGroupsSocket(config) + const { + ev, + authState, + processingMutex, + signalRepository, + upsertMessage, + query, + fetchPrivacySettings, + generateMessageTag, + sendNode, + groupMetadata, + groupToggleEphemeral + } = sock + + const userDevicesCache = config.userDevicesCache || new NodeCache({ + stdTTL: DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes + useClones: false + }) + + let mediaConn: Promise + const refreshMediaConn = async (forceGet = false) => { + const media = await mediaConn + if (!media || forceGet || (new Date().getTime() - media.fetchDate.getTime()) > media.ttl * 1000) { + mediaConn = (async () => { + const result = await query({ + tag: 'iq', + attrs: { + type: 'set', + xmlns: 'w:m', + to: S_WHATSAPP_NET, + }, + content: [{ tag: 'media_conn', attrs: {} }] + }) + const mediaConnNode = getBinaryNodeChild(result, 'media_conn') + const node: MediaConnInfo = { + hosts: getBinaryNodeChildren(mediaConnNode, 'host').map( + ({ attrs }) => ({ + hostname: attrs.hostname, + maxContentLengthBytes: +attrs.maxContentLengthBytes, + }) + ), + auth: mediaConnNode!.attrs.auth, + ttl: +mediaConnNode!.attrs.ttl, + fetchDate: new Date() + } + logger.debug('fetched media conn') + return node + })() + } + + return mediaConn + } + + /** + * generic send receipt function + * used for receipts of phone call, read, delivery etc. + * */ + const sendReceipt = async (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => { + const node: BinaryNode = { + tag: 'receipt', + attrs: { + id: messageIds[0], + }, + } + const isReadReceipt = type === 'read' || type === 'read-self' + if (isReadReceipt) { + node.attrs.t = unixTimestampSeconds().toString() + } + + if (type === 'sender' && isJidUser(jid)) { + node.attrs.recipient = jid + node.attrs.to = participant! + } else { + node.attrs.to = jid + if (participant) { + node.attrs.participant = participant + } + } + + if (type) { + node.attrs.type = type + } + + const remainingMessageIds = messageIds.slice(1) + if (remainingMessageIds.length) { + node.content = [ + { + tag: 'list', + attrs: {}, + content: remainingMessageIds.map(id => ({ + tag: 'item', + attrs: { id } + })) + } + ] + } + + logger.debug({ attrs: node.attrs, messageIds }, 'sending receipt for messages') + await sendNode(node) + } + + /** Correctly bulk send receipts to multiple chats, participants */ + const sendReceipts = async (keys: WAMessageKey[], type: MessageReceiptType) => { + const recps = aggregateMessageKeysNotFromMe(keys) + for (const { jid, participant, messageIds } of recps) { + await sendReceipt(jid, participant, messageIds, type) + } + } + + /** Bulk read messages. Keys can be from different chats & participants */ + const readMessages = async (keys: WAMessageKey[]) => { + const privacySettings = await fetchPrivacySettings() + // based on privacy settings, we have to change the read type + const readType = privacySettings.readreceipts === 'all' ? 'read' : 'read-self' + await sendReceipts(keys, readType) + } + + /** Fetch all the devices we've to send a message to */ + const getUSyncDevices = async (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => { + const deviceResults: JidWithDevice[] = [] + + if (!useCache) { + logger.debug('not using cache for devices') + } + + const users: BinaryNode[] = [] + jids = Array.from(new Set(jids)) + for (let jid of jids) { + const user = jidDecode(jid)?.user + jid = jidNormalizedUser(jid) + + const devices = userDevicesCache.get(user!) + if (devices && useCache) { + deviceResults.push(...devices) + + logger.trace({ user }, 'using cache for devices') + } else { + users.push({ tag: 'user', attrs: { jid } }) + } + } + + const iq: BinaryNode = { + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'get', + xmlns: 'usync', + }, + content: [ + { + tag: 'usync', + attrs: { + sid: generateMessageTag(), + mode: 'query', + last: 'true', + index: '0', + context: 'message', + }, + content: [ + { + tag: 'query', + attrs: {}, + content: [ + { + tag: 'devices', + attrs: { version: '2' } + } + ] + }, + { tag: 'list', attrs: {}, content: users } + ] + }, + ], + } + const result = await query(iq) + const extracted = extractDeviceJids(result, authState.creds.me!.id, ignoreZeroDevices) + const deviceMap: { [_: string]: JidWithDevice[] } = {} + + for (const item of extracted) { + deviceMap[item.user] = deviceMap[item.user] || [] + deviceMap[item.user].push(item) + + deviceResults.push(item) + } + + for (const key in deviceMap) { + userDevicesCache.set(key, deviceMap[key]) + } + + return deviceResults + } + + const assertSessions = async (jids: string[], force: boolean) => { + let didFetchNewSession = false + let jidsRequiringFetch: string[] = [] + if (force) { + jidsRequiringFetch = jids + } else { + const addrs = jids.map(jid => ( + signalRepository + .jidToSignalProtocolAddress(jid) + )) + const sessions = await authState.keys.get('session', addrs) + for (const jid of jids) { + const signalId = signalRepository + .jidToSignalProtocolAddress(jid) + if (!sessions[signalId]) { + jidsRequiringFetch.push(jid) + } + } + } + + if (jidsRequiringFetch.length) { + logger.debug({ jidsRequiringFetch }, 'fetching sessions') + const result = await query({ + tag: 'iq', + attrs: { + xmlns: 'encrypt', + type: 'get', + to: S_WHATSAPP_NET, + }, + content: [ + { + tag: 'key', + attrs: {}, + content: jidsRequiringFetch.map( + jid => ({ + tag: 'user', + attrs: { jid }, + }) + ) + } + ] + }) + await parseAndInjectE2ESessions(result, signalRepository) + + didFetchNewSession = true + } + + return didFetchNewSession + } + + const createParticipantNodes = async ( + jids: string[], + message: proto.IMessage, + extraAttrs?: BinaryNode['attrs'] + ) => { + const patched = await patchMessageBeforeSending(message, jids) + const bytes = encodeWAMessage(patched) + + let shouldIncludeDeviceIdentity = false + const nodes = await Promise.all( + jids.map( + async jid => { + const { type, ciphertext } = await signalRepository + .encryptMessage({ jid, data: bytes }) + if (type === 'pkmsg') { + shouldIncludeDeviceIdentity = true + } + + const node: BinaryNode = { + tag: 'to', + attrs: { jid }, + content: [{ + tag: 'enc', + attrs: { + v: '2', + type, + ...extraAttrs || {} + }, + content: ciphertext + }] + } + return node + } + ) + ) + return { nodes, shouldIncludeDeviceIdentity } + } + + const relayMessage = async ( + jid: string, + message: proto.IMessage, + { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata }: MessageRelayOptions + ) => { + const meId = authState.creds.me!.id + + let shouldIncludeDeviceIdentity = false + + const { user, server } = jidDecode(jid)! + const isGroup = server === 'g.us' + msgId = msgId || generateMessageID() + useUserDevicesCache = useUserDevicesCache !== false + + const participants: BinaryNode[] = [] + const destinationJid = jidEncode(user, isGroup ? 'g.us' : 's.whatsapp.net') + const binaryNodeContent: BinaryNode[] = [] + const devices: JidWithDevice[] = [] + + const meMsg: proto.IMessage = { + deviceSentMessage: { + destinationJid, + message + } + } + + if (participant) { + // when the retry request is not for a group + // only send to the specific device that asked for a retry + // otherwise the message is sent out to every device that should be a recipient + if (!isGroup) { + additionalAttributes = { ...additionalAttributes, 'device_fanout': 'false' } + } + + const { user, device } = jidDecode(participant.jid)! + devices.push({ user, device }) + } + + await authState.keys.transaction( + async () => { + const mediaType = getMediaType(message) + if (isGroup) { + const [groupData, senderKeyMap] = await Promise.all([ + (async () => { + let groupData = cachedGroupMetadata ? await cachedGroupMetadata(jid) : undefined + if (groupData) { + logger.trace({ jid, participants: groupData.participants.length }, 'using cached group metadata') + } + + if (!groupData) { + groupData = await groupMetadata(jid) + } + + return groupData + })(), + (async () => { + if (!participant) { + const result = await authState.keys.get('sender-key-memory', [jid]) + return result[jid] || {} + } + + return {} + })() + ]) + + if (!participant) { + const participantsList = groupData.participants.map(p => p.id) + const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false) + devices.push(...additionalDevices) + } + + const patched = await patchMessageBeforeSending(message, devices.map(d => jidEncode(d.user, 's.whatsapp.net', d.device))) + const bytes = encodeWAMessage(patched) + + const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage( + { + group: destinationJid, + data: bytes, + meId, + } + ) + + const senderKeyJids: string[] = [] + // ensure a connection is established with every device + for (const { user, device } of devices) { + const jid = jidEncode(user, 's.whatsapp.net', device) + if (!senderKeyMap[jid] || !!participant) { + senderKeyJids.push(jid) + // store that this person has had the sender keys sent to them + senderKeyMap[jid] = true + } + } + + // if there are some participants with whom the session has not been established + // if there are, we re-send the senderkey + if (senderKeyJids.length) { + logger.debug({ senderKeyJids }, 'sending new sender key') + + const senderKeyMsg: proto.IMessage = { + senderKeyDistributionMessage: { + axolotlSenderKeyDistributionMessage: senderKeyDistributionMessage, + groupId: destinationJid + } + } + + await assertSessions(senderKeyJids, false) + + const result = await createParticipantNodes(senderKeyJids, senderKeyMsg, mediaType ? { mediatype: mediaType } : undefined) + shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || result.shouldIncludeDeviceIdentity + + participants.push(...result.nodes) + } + + binaryNodeContent.push({ + tag: 'enc', + attrs: { v: '2', type: 'skmsg' }, + content: ciphertext + }) + + await authState.keys.set({ 'sender-key-memory': { [jid]: senderKeyMap } }) + } else { + const { user: meUser } = jidDecode(meId)! + + if (!participant) { + devices.push({ user }) + devices.push({ user: meUser }) + + const additionalDevices = await getUSyncDevices([meId, jid], !!useUserDevicesCache, true) + devices.push(...additionalDevices) + } + + const allJids: string[] = [] + const meJids: string[] = [] + const otherJids: string[] = [] + for (const { user, device } of devices) { + const jid = jidEncode(user, 's.whatsapp.net', device) + const isMe = user === meUser + if (isMe) { + meJids.push(jid) + } else { + otherJids.push(jid) + } + + allJids.push(jid) + } + + await assertSessions(allJids, false) + + const [ + { nodes: meNodes, shouldIncludeDeviceIdentity: s1 }, + { nodes: otherNodes, shouldIncludeDeviceIdentity: s2 } + ] = await Promise.all([ + createParticipantNodes(meJids, meMsg, mediaType ? { mediatype: mediaType } : undefined), + createParticipantNodes(otherJids, message, mediaType ? { mediatype: mediaType } : undefined) + ]) + participants.push(...meNodes) + participants.push(...otherNodes) + + shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2 + } + + if (participants.length) { + binaryNodeContent.push({ + tag: 'participants', + attrs: {}, + content: participants + }) + } + + const stanza: BinaryNode = { + tag: 'message', + attrs: { + id: msgId!, + type: 'text', + ...(additionalAttributes || {}) + }, + content: binaryNodeContent + } + // if the participant to send to is explicitly specified (generally retry recp) + // ensure the message is only sent to that person + // if a retry receipt is sent to everyone -- it'll fail decryption for everyone else who received the msg + if (participant) { + if (isJidGroup(destinationJid)) { + stanza.attrs.to = destinationJid + stanza.attrs.participant = participant.jid + } else if (areJidsSameUser(participant.jid, meId)) { + stanza.attrs.to = participant.jid + stanza.attrs.recipient = destinationJid + } else { + stanza.attrs.to = participant.jid + } + } else { + stanza.attrs.to = destinationJid + } + + if (shouldIncludeDeviceIdentity) { + (stanza.content as BinaryNode[]).push({ + tag: 'device-identity', + attrs: {}, + content: encodeSignedDeviceIdentity(authState.creds.account!, true) + }) + + logger.debug({ jid }, 'adding device identity') + } + const buttonType = getButtonType(message) + if (buttonType) { + (stanza.content as BinaryNode[]).push({ + tag: 'biz', + attrs: {}, + content: [ + { + tag: buttonType, + attrs: getButtonArgs(message), + } + ] + }) + + logger.debug({ jid }, 'adding business node') + } + + logger.debug({ msgId }, `sending message to ${participants.length} devices`) + + await sendNode(stanza) + } + ) + + return msgId + } + + const getMediaType = (message: proto.IMessage) => { + if (message.imageMessage) { + return 'image' + } else if (message.videoMessage) { + return message.videoMessage.gifPlayback ? 'gif' : 'video' + } else if (message.audioMessage) { + return message.audioMessage.ptt ? 'ptt' : 'audio' + } else if (message.contactMessage) { + return 'vcard' + } else if (message.documentMessage) { + return 'document' + } else if (message.contactsArrayMessage) { + return 'contact_array' + } else if (message.liveLocationMessage) { + return 'livelocation' + } else if (message.stickerMessage) { + return 'sticker' + } else if (message.listMessage) { + return 'list' + } else if (message.listResponseMessage) { + return 'list_response' + } else if (message.buttonsResponseMessage) { + return 'buttons_response' + } else if (message.orderMessage) { + return 'order' + } else if (message.productMessage) { + return 'product' + } else if (message.interactiveResponseMessage) { + return 'native_flow_response' + } + } + + const getButtonType = (message: proto.IMessage) => { + if (message.buttonsMessage) { + return 'buttons' + } else if (message.buttonsResponseMessage) { + return 'buttons_response' + } else if (message.interactiveResponseMessage) { + return 'interactive_response' + } else if (message.listMessage) { + return 'list' + } else if (message.listResponseMessage) { + return 'list_response' + } + } + + const getButtonArgs = (message: proto.IMessage): BinaryNode['attrs'] => { + if (message.templateMessage) { + // TODO: Add attributes + return {} + } else if (message.listMessage) { + const type = message.listMessage.listType + if (!type) { + throw new Boom("Expected list type inside message") + } + return { v: '2', type: ListType[type].toLowerCase() }; + } else { + return {}; + } + } + const getPrivacyTokens = async (jids: string[]) => { + const t = unixTimestampSeconds().toString() + const result = await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'privacy' + }, + content: [ + { + tag: 'tokens', + attrs: {}, + content: jids.map( + jid => ({ + tag: 'token', + attrs: { + jid: jidNormalizedUser(jid), + t, + type: 'trusted_contact' + } + }) + ) + } + ] + }) + + return result + } + + const waUploadToServer = getWAUploadToServer(config, refreshMediaConn) + + const waitForMsgMediaUpdate = bindWaitForEvent(ev, 'messages.media-update') + + return { + ...sock, + getPrivacyTokens, + assertSessions, + relayMessage, + sendReceipt, + sendReceipts, + readMessages, + refreshMediaConn, + waUploadToServer, + fetchPrivacySettings, + updateMediaMessage: async (message: proto.IWebMessageInfo) => { + const content = assertMediaContent(message.message) + const mediaKey = content.mediaKey! + const meId = authState.creds.me!.id + const node = encryptMediaRetryRequest(message.key, mediaKey, meId) + + let error: Error | undefined = undefined + await Promise.all( + [ + sendNode(node), + waitForMsgMediaUpdate(update => { + const result = update.find(c => c.key.id === message.key.id) + if (result) { + if (result.error) { + error = result.error + } else { + try { + const media = decryptMediaRetryData(result.media!, mediaKey, result.key.id!) + if (media.result !== proto.MediaRetryNotification.ResultType.SUCCESS) { + const resultStr = proto.MediaRetryNotification.ResultType[media.result] + throw new Boom( + `Media re-upload failed by device (${resultStr})`, + { data: media, statusCode: getStatusCodeForMediaRetry(media.result) || 404 } + ) + } + + content.directPath = media.directPath + content.url = getUrlFromDirectPath(content.directPath!) + + logger.debug({ directPath: media.directPath, key: result.key }, 'media update successful') + } catch (err) { + error = err + } + } + + return true + } + }) + ] + ) + + if (error) { + throw error + } + + ev.emit('messages.update', [ + { key: message.key, update: { message: message.message } } + ]) + + return message + }, + sendMessage: async ( + jid: string, + content: AnyMessageContent, + options: MiscMessageGenerationOptions = {} + ) => { + const userJid = authState.creds.me!.id + if ( + typeof content === 'object' && + 'disappearingMessagesInChat' in content && + typeof content['disappearingMessagesInChat'] !== 'undefined' && + isJidGroup(jid) + ) { + const { disappearingMessagesInChat } = content + const value = typeof disappearingMessagesInChat === 'boolean' ? + (disappearingMessagesInChat ? WA_DEFAULT_EPHEMERAL : 0) : + disappearingMessagesInChat + await groupToggleEphemeral(jid, value) + } else { + const fullMsg = await generateWAMessage( + jid, + content, + { + logger, + userJid, + getUrlInfo: text => getUrlInfo( + text, + { + thumbnailWidth: linkPreviewImageThumbnailWidth, + fetchOpts: { + timeout: 3_000, + ...axiosOptions || {} + }, + logger, + uploadImage: generateHighQualityLinkPreview + ? waUploadToServer + : undefined + }, + ), + upload: waUploadToServer, + mediaCache: config.mediaCache, + options: config.options, + ...options, + } + ) + const isDeleteMsg = 'delete' in content && !!content.delete + const additionalAttributes: BinaryNodeAttributes = {} + // required for delete + if (isDeleteMsg) { + // if the chat is a group, and I am not the author, then delete the message as an admin + if (isJidGroup(content.delete?.remoteJid as string) && !content.delete?.fromMe) { + additionalAttributes.edit = '8' + } else { + additionalAttributes.edit = '7' + } + } + + await relayMessage(jid, fullMsg.message!, { messageId: fullMsg.key.id!, cachedGroupMetadata: options.cachedGroupMetadata, additionalAttributes }) + if (config.emitOwnEvents) { + process.nextTick(() => { + processingMutex.mutex(() => ( + upsertMessage(fullMsg, 'append') + )) + }) + } + + return fullMsg + } + } + } +} \ No newline at end of file diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts new file mode 100644 index 00000000000..b91a3a3e764 --- /dev/null +++ b/src/Socket/socket.ts @@ -0,0 +1,633 @@ +import { Boom } from '@hapi/boom' +import { promisify } from 'util' +import WebSocket from 'ws' +import { proto } from '../../WAProto' +import { DEF_CALLBACK_PREFIX, DEF_TAG_PREFIX, DEFAULT_ORIGIN, INITIAL_PREKEY_COUNT, MIN_PREKEY_COUNT } from '../Defaults' +import { DisconnectReason, SocketConfig } from '../Types' +import { addTransactionCapability, bindWaitForConnectionUpdate, configureSuccessfulPairing, Curve, generateLoginNode, generateMdTagPrefix, generateRegistrationNode, getCodeFromWSError, getErrorCodeFromStreamError, getNextPreKeysNode, makeNoiseHandler, printQRIfNecessaryListener, promiseTimeout } from '../Utils' +import { makeEventBuffer } from '../Utils/event-buffer' +import { assertNodeErrorFree, BinaryNode, encodeBinaryNode, getBinaryNodeChild, getBinaryNodeChildren, S_WHATSAPP_NET } from '../WABinary' + +/** + * Connects to WA servers and performs: + * - simple queries (no retry mechanism, wait for connection establishment) + * - listen to messages and emit events + * - query phone connection + */ +export const makeSocket = ({ + waWebSocketUrl, + connectTimeoutMs, + logger, + agent, + keepAliveIntervalMs, + version, + browser, + auth: authState, + printQRInTerminal, + defaultQueryTimeoutMs, + syncFullHistory, + transactionOpts, + qrTimeout, + options, + makeSignalRepository +}: SocketConfig) => { + const ws = new WebSocket(waWebSocketUrl, undefined, { + origin: DEFAULT_ORIGIN, + headers: options.headers as {}, + handshakeTimeout: connectTimeoutMs, + timeout: connectTimeoutMs, + agent + }) + ws.setMaxListeners(0) + + const ev = makeEventBuffer(logger) + /** ephemeral key pair used to encrypt/decrypt communication. Unique for each connection */ + const ephemeralKeyPair = Curve.generateKeyPair() + /** WA noise protocol wrapper */ + const noise = makeNoiseHandler(ephemeralKeyPair, logger) + + const { creds } = authState + // add transaction capability + const keys = addTransactionCapability(authState.keys, logger, transactionOpts) + const signalRepository = makeSignalRepository({ creds, keys }) + + let lastDateRecv: Date + let epoch = 1 + let keepAliveReq: NodeJS.Timeout + let qrTimer: NodeJS.Timeout + let closed = false + + const uqTagId = generateMdTagPrefix() + const generateMessageTag = () => `${uqTagId}${epoch++}` + + const sendPromise = promisify(ws.send) + /** send a raw buffer */ + const sendRawMessage = async(data: Uint8Array | Buffer) => { + if(ws.readyState !== ws.OPEN) { + throw new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed }) + } + + const bytes = noise.encodeFrame(data) + await promiseTimeout( + connectTimeoutMs, + async(resolve, reject) => { + try { + await sendPromise.call(ws, bytes) + resolve() + } catch(error) { + reject(error) + } + } + ) + } + + /** send a binary node */ + const sendNode = (frame: BinaryNode) => { + if(logger.level === 'trace') { + logger.trace({ msgId: frame.attrs.id, fromMe: true, frame }, 'communication') + } + + const buff = encodeBinaryNode(frame) + return sendRawMessage(buff) + } + + /** log & process any unexpected errors */ + const onUnexpectedError = (err: Error | Boom, msg: string) => { + logger.error( + { err }, + `unexpected error in '${msg}'` + ) + } + + /** await the next incoming message */ + const awaitNextMessage = async(sendMsg?: Uint8Array) => { + if(ws.readyState !== ws.OPEN) { + throw new Boom('Connection Closed', { + statusCode: DisconnectReason.connectionClosed + }) + } + + let onOpen: (data: T) => void + let onClose: (err: Error) => void + + const result = promiseTimeout(connectTimeoutMs, (resolve, reject) => { + onOpen = resolve + onClose = mapWebSocketError(reject) + ws.on('frame', onOpen) + ws.on('close', onClose) + ws.on('error', onClose) + }) + .finally(() => { + ws.off('frame', onOpen) + ws.off('close', onClose) + ws.off('error', onClose) + }) + + if(sendMsg) { + sendRawMessage(sendMsg).catch(onClose!) + } + + return result + } + + /** + * Wait for a message with a certain tag to be received + * @param tag the message tag to await + * @param json query that was sent + * @param timeoutMs timeout after which the promise will reject + */ + const waitForMessage = async(msgId: string, timeoutMs = defaultQueryTimeoutMs) => { + let onRecv: (json) => void + let onErr: (err) => void + try { + const result = await promiseTimeout(timeoutMs, + (resolve, reject) => { + onRecv = resolve + onErr = err => { + reject(err || new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed })) + } + + ws.on(`TAG:${msgId}`, onRecv) + ws.on('close', onErr) // if the socket closes, you'll never receive the message + ws.off('error', onErr) + }, + ) + return result + } finally { + ws.off(`TAG:${msgId}`, onRecv!) + ws.off('close', onErr!) // if the socket closes, you'll never receive the message + ws.off('error', onErr!) + } + } + + /** send a query, and wait for its response. auto-generates message ID if not provided */ + const query = async(node: BinaryNode, timeoutMs?: number) => { + if(!node.attrs.id) { + node.attrs.id = generateMessageTag() + } + + const msgId = node.attrs.id + const wait = waitForMessage(msgId, timeoutMs) + + await sendNode(node) + + const result = await (wait as Promise) + if('tag' in result) { + assertNodeErrorFree(result) + } + + return result + } + + /** connection handshake */ + const validateConnection = async() => { + let helloMsg: proto.IHandshakeMessage = { + clientHello: { ephemeral: ephemeralKeyPair.public } + } + helloMsg = proto.HandshakeMessage.fromObject(helloMsg) + + logger.info({ browser, helloMsg }, 'connected to WA Web') + + const init = proto.HandshakeMessage.encode(helloMsg).finish() + + const result = await awaitNextMessage(init) + const handshake = proto.HandshakeMessage.decode(result) + + logger.trace({ handshake }, 'handshake recv from WA Web') + + const keyEnc = noise.processHandshake(handshake, creds.noiseKey) + + const config = { version, browser, syncFullHistory } + + let node: proto.IClientPayload + if(!creds.me) { + node = generateRegistrationNode(creds, config) + logger.info({ node }, 'not logged in, attempting registration...') + } else { + node = generateLoginNode(creds.me!.id, config) + logger.info({ node }, 'logging in...') + } + + const payloadEnc = noise.encrypt( + proto.ClientPayload.encode(node).finish() + ) + await sendRawMessage( + proto.HandshakeMessage.encode({ + clientFinish: { + static: keyEnc, + payload: payloadEnc, + }, + }).finish() + ) + noise.finishInit() + startKeepAliveRequest() + } + + const getAvailablePreKeysOnServer = async() => { + const result = await query({ + tag: 'iq', + attrs: { + id: generateMessageTag(), + xmlns: 'encrypt', + type: 'get', + to: S_WHATSAPP_NET + }, + content: [ + { tag: 'count', attrs: { } } + ] + }) + const countChild = getBinaryNodeChild(result, 'count') + return +countChild!.attrs.value + } + + /** generates and uploads a set of pre-keys to the server */ + const uploadPreKeys = async(count = INITIAL_PREKEY_COUNT) => { + await keys.transaction( + async() => { + logger.info({ count }, 'uploading pre-keys') + const { update, node } = await getNextPreKeysNode({ creds, keys }, count) + + await query(node) + ev.emit('creds.update', update) + + logger.info({ count }, 'uploaded pre-keys') + } + ) + } + + const uploadPreKeysToServerIfRequired = async() => { + const preKeyCount = await getAvailablePreKeysOnServer() + logger.info(`${preKeyCount} pre-keys found on server`) + if(preKeyCount <= MIN_PREKEY_COUNT) { + await uploadPreKeys() + } + } + + const onMessageRecieved = (data: Buffer) => { + noise.decodeFrame(data, frame => { + // reset ping timeout + lastDateRecv = new Date() + + let anyTriggered = false + + anyTriggered = ws.emit('frame', frame) + // if it's a binary node + if(!(frame instanceof Uint8Array)) { + const msgId = frame.attrs.id + + if(logger.level === 'trace') { + logger.trace({ msgId, fromMe: false, frame }, 'communication') + } + + /* Check if this is a response to a message we sent */ + anyTriggered = ws.emit(`${DEF_TAG_PREFIX}${msgId}`, frame) || anyTriggered + /* Check if this is a response to a message we are expecting */ + const l0 = frame.tag + const l1 = frame.attrs || { } + const l2 = Array.isArray(frame.content) ? frame.content[0]?.tag : '' + + Object.keys(l1).forEach(key => { + anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]},${l2}`, frame) || anyTriggered + anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]}`, frame) || anyTriggered + anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}`, frame) || anyTriggered + }) + anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},,${l2}`, frame) || anyTriggered + anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0}`, frame) || anyTriggered + + if(!anyTriggered && logger.level === 'debug') { + logger.debug({ unhandled: true, msgId, fromMe: false, frame }, 'communication recv') + } + } + }) + } + + const end = (error: Error | undefined) => { + if(closed) { + logger.trace({ trace: error?.stack }, 'connection already closed') + return + } + + closed = true + logger.info( + { trace: error?.stack }, + error ? 'connection errored' : 'connection closed' + ) + + clearInterval(keepAliveReq) + clearTimeout(qrTimer) + + ws.removeAllListeners('close') + ws.removeAllListeners('error') + ws.removeAllListeners('open') + ws.removeAllListeners('message') + + if(ws.readyState !== ws.CLOSED && ws.readyState !== ws.CLOSING) { + try { + ws.close() + } catch{ } + } + + ev.emit('connection.update', { + connection: 'close', + lastDisconnect: { + error, + date: new Date() + } + }) + ev.removeAllListeners('connection.update') + } + + const waitForSocketOpen = async() => { + if(ws.readyState === ws.OPEN) { + return + } + + if(ws.readyState === ws.CLOSED || ws.readyState === ws.CLOSING) { + throw new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed }) + } + + let onOpen: () => void + let onClose: (err: Error) => void + await new Promise((resolve, reject) => { + onOpen = () => resolve(undefined) + onClose = mapWebSocketError(reject) + ws.on('open', onOpen) + ws.on('close', onClose) + ws.on('error', onClose) + }) + .finally(() => { + ws.off('open', onOpen) + ws.off('close', onClose) + ws.off('error', onClose) + }) + } + + const startKeepAliveRequest = () => ( + keepAliveReq = setInterval(() => { + if(!lastDateRecv) { + lastDateRecv = new Date() + } + + const diff = Date.now() - lastDateRecv.getTime() + /* + check if it's been a suspicious amount of time since the server responded with our last seen + it could be that the network is down + */ + if(diff > keepAliveIntervalMs + 5000) { + end(new Boom('Connection was lost', { statusCode: DisconnectReason.connectionLost })) + } else if(ws.readyState === ws.OPEN) { + // if its all good, send a keep alive request + query( + { + tag: 'iq', + attrs: { + id: generateMessageTag(), + to: S_WHATSAPP_NET, + type: 'get', + xmlns: 'w:p', + }, + content: [{ tag: 'ping', attrs: { } }] + } + ) + .catch(err => { + logger.error({ trace: err.stack }, 'error in sending keep alive') + }) + } else { + logger.warn('keep alive called when WS not open') + } + }, keepAliveIntervalMs) + ) + /** i have no idea why this exists. pls enlighten me */ + const sendPassiveIq = (tag: 'passive' | 'active') => ( + query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + xmlns: 'passive', + type: 'set', + }, + content: [ + { tag, attrs: { } } + ] + }) + ) + + /** logout & invalidate connection */ + const logout = async(msg?: string) => { + const jid = authState.creds.me?.id + if(jid) { + await sendNode({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + id: generateMessageTag(), + xmlns: 'md' + }, + content: [ + { + tag: 'remove-companion-device', + attrs: { + jid, + reason: 'user_initiated' + } + } + ] + }) + } + + end(new Boom(msg || 'Intentional Logout', { statusCode: DisconnectReason.loggedOut })) + } + + ws.on('message', onMessageRecieved) + ws.on('open', async() => { + try { + await validateConnection() + } catch(err) { + logger.error({ err }, 'error in validating connection') + end(err) + } + }) + ws.on('error', mapWebSocketError(end)) + ws.on('close', () => end(new Boom('Connection Terminated', { statusCode: DisconnectReason.connectionClosed }))) + // the server terminated the connection + ws.on('CB:xmlstreamend', () => end(new Boom('Connection Terminated by Server', { statusCode: DisconnectReason.connectionClosed }))) + // QR gen + ws.on('CB:iq,type:set,pair-device', async(stanza: BinaryNode) => { + const iq: BinaryNode = { + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'result', + id: stanza.attrs.id, + } + } + await sendNode(iq) + + const pairDeviceNode = getBinaryNodeChild(stanza, 'pair-device') + const refNodes = getBinaryNodeChildren(pairDeviceNode, 'ref') + const noiseKeyB64 = Buffer.from(creds.noiseKey.public).toString('base64') + const identityKeyB64 = Buffer.from(creds.signedIdentityKey.public).toString('base64') + const advB64 = creds.advSecretKey + + let qrMs = qrTimeout || 60_000 // time to let a QR live + const genPairQR = () => { + if(ws.readyState !== ws.OPEN) { + return + } + + const refNode = refNodes.shift() + if(!refNode) { + end(new Boom('QR refs attempts ended', { statusCode: DisconnectReason.timedOut })) + return + } + + const ref = (refNode.content as Buffer).toString('utf-8') + const qr = [ref, noiseKeyB64, identityKeyB64, advB64].join(',') + + ev.emit('connection.update', { qr }) + + qrTimer = setTimeout(genPairQR, qrMs) + qrMs = qrTimeout || 20_000 // shorter subsequent qrs + } + + genPairQR() + }) + // device paired for the first time + // if device pairs successfully, the server asks to restart the connection + ws.on('CB:iq,,pair-success', async(stanza: BinaryNode) => { + logger.debug('pair success recv') + try { + const { reply, creds: updatedCreds } = configureSuccessfulPairing(stanza, creds) + + logger.info( + { me: updatedCreds.me, platform: updatedCreds.platform }, + 'pairing configured successfully, expect to restart the connection...' + ) + + ev.emit('creds.update', updatedCreds) + ev.emit('connection.update', { isNewLogin: true, qr: undefined }) + + await sendNode(reply) + } catch(error) { + logger.info({ trace: error.stack }, 'error in pairing') + end(error) + } + }) + // login complete + ws.on('CB:success', async() => { + await uploadPreKeysToServerIfRequired() + await sendPassiveIq('active') + + logger.info('opened connection to WA') + clearTimeout(qrTimer) // will never happen in all likelyhood -- but just in case WA sends success on first try + + ev.emit('connection.update', { connection: 'open' }) + }) + + ws.on('CB:stream:error', (node: BinaryNode) => { + logger.error({ node }, 'stream errored out') + + const { reason, statusCode } = getErrorCodeFromStreamError(node) + + end(new Boom(`Stream Errored (${reason})`, { statusCode, data: node })) + }) + // stream fail, possible logout + ws.on('CB:failure', (node: BinaryNode) => { + const reason = +(node.attrs.reason || 500) + end(new Boom('Connection Failure', { statusCode: reason, data: node.attrs })) + }) + + ws.on('CB:ib,,downgrade_webclient', () => { + end(new Boom('Multi-device beta not joined', { statusCode: DisconnectReason.multideviceMismatch })) + }) + + let didStartBuffer = false + process.nextTick(() => { + if(creds.me?.id) { + // start buffering important events + // if we're logged in + ev.buffer() + didStartBuffer = true + } + + ev.emit('connection.update', { connection: 'connecting', receivedPendingNotifications: false, qr: undefined }) + }) + + // called when all offline notifs are handled + ws.on('CB:ib,,offline', (node: BinaryNode) => { + const child = getBinaryNodeChild(node, 'offline') + const offlineNotifs = +(child?.attrs.count || 0) + + logger.info(`handled ${offlineNotifs} offline messages/notifications`) + if(didStartBuffer) { + ev.flush() + logger.trace('flushed events for initial buffer') + } + + ev.emit('connection.update', { receivedPendingNotifications: true }) + }) + + // update credentials when required + ev.on('creds.update', update => { + const name = update.me?.name + // if name has just been received + if(creds.me?.name !== name) { + logger.debug({ name }, 'updated pushName') + sendNode({ + tag: 'presence', + attrs: { name: name! } + }) + .catch(err => { + logger.warn({ trace: err.stack }, 'error in sending presence update on name change') + }) + } + + Object.assign(creds, update) + }) + + if(printQRInTerminal) { + printQRIfNecessaryListener(ev, logger) + } + + return { + type: 'md' as 'md', + ws, + ev, + authState: { creds, keys }, + signalRepository, + get user() { + return authState.creds.me + }, + generateMessageTag, + query, + waitForMessage, + waitForSocketOpen, + sendRawMessage, + sendNode, + logout, + end, + onUnexpectedError, + uploadPreKeys, + uploadPreKeysToServerIfRequired, + /** Waits for the connection to WA to reach a state */ + waitForConnectionUpdate: bindWaitForConnectionUpdate(ev), + } +} + +/** + * map the websocket error to the right type + * so it can be retried by the caller + * */ +function mapWebSocketError(handler: (err: Error) => void) { + return (error: Error) => { + handler( + new Boom( + `WebSocket Error (${error.message})`, + { statusCode: getCodeFromWSError(error), data: error } + ) + ) + } +} + +export type Socket = ReturnType diff --git a/src/Store/index.ts b/src/Store/index.ts new file mode 100644 index 00000000000..f7446716043 --- /dev/null +++ b/src/Store/index.ts @@ -0,0 +1,2 @@ +import makeInMemoryStore from './make-in-memory-store' +export { makeInMemoryStore } \ No newline at end of file diff --git a/src/Store/make-in-memory-store.ts b/src/Store/make-in-memory-store.ts new file mode 100644 index 00000000000..f8d7a6be81c --- /dev/null +++ b/src/Store/make-in-memory-store.ts @@ -0,0 +1,358 @@ +import type KeyedDB from '@adiwajshing/keyed-db' +import type { Comparable } from '@adiwajshing/keyed-db/lib/Types' +import type { Logger } from 'pino' +import { proto } from '../../WAProto' +import { DEFAULT_CONNECTION_CONFIG } from '../Defaults' +import type makeMDSocket from '../Socket' +import type { BaileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessage, WAMessageCursor, WAMessageKey } from '../Types' +import { toNumber, updateMessageWithReaction, updateMessageWithReceipt } from '../Utils' +import { jidNormalizedUser } from '../WABinary' +import makeOrderedDictionary from './make-ordered-dictionary' + +type WASocket = ReturnType + +export const waChatKey = (pin: boolean) => ({ + key: (c: Chat) => (pin ? (c.pinned ? '1' : '0') : '') + (c.archived ? '0' : '1') + (c.conversationTimestamp ? c.conversationTimestamp.toString(16).padStart(8, '0') : '') + c.id, + compare: (k1: string, k2: string) => k2.localeCompare (k1) +}) + +export const waMessageID = (m: WAMessage) => m.key.id || '' + +export type BaileysInMemoryStoreConfig = { + chatKey?: Comparable + logger?: Logger +} + +const makeMessagesDictionary = () => makeOrderedDictionary(waMessageID) + +export default ( + { logger: _logger, chatKey }: BaileysInMemoryStoreConfig +) => { + const logger = _logger || DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' }) + chatKey = chatKey || waChatKey(true) + const KeyedDB = require('@adiwajshing/keyed-db').default as new (...args: any[]) => KeyedDB + + const chats = new KeyedDB(chatKey, c => c.id) + const messages: { [_: string]: ReturnType } = { } + const contacts: { [_: string]: Contact } = { } + const groupMetadata: { [_: string]: GroupMetadata } = { } + const presences: { [id: string]: { [participant: string]: PresenceData } } = { } + const state: ConnectionState = { connection: 'close' } + + const assertMessageList = (jid: string) => { + if(!messages[jid]) { + messages[jid] = makeMessagesDictionary() + } + + return messages[jid] + } + + const contactsUpsert = (newContacts: Contact[]) => { + const oldContacts = new Set(Object.keys(contacts)) + for(const contact of newContacts) { + oldContacts.delete(contact.id) + contacts[contact.id] = Object.assign( + contacts[contact.id] || {}, + contact + ) + } + + return oldContacts + } + + /** + * binds to a BaileysEventEmitter. + * It listens to all events and constructs a state that you can query accurate data from. + * Eg. can use the store to fetch chats, contacts, messages etc. + * @param ev typically the event emitter from the socket connection + */ + const bind = (ev: BaileysEventEmitter) => { + ev.on('connection.update', update => { + Object.assign(state, update) + }) + + ev.on('messaging-history.set', ({ + chats: newChats, + contacts: newContacts, + messages: newMessages, + isLatest + }) => { + if(isLatest) { + chats.clear() + + for(const id in messages) { + delete messages[id] + } + } + + const chatsAdded = chats.insertIfAbsent(...newChats).length + logger.debug({ chatsAdded }, 'synced chats') + + const oldContacts = contactsUpsert(newContacts) + for(const jid of oldContacts) { + delete contacts[jid] + } + + logger.debug({ deletedContacts: oldContacts.size, newContacts }, 'synced contacts') + + for(const msg of newMessages) { + const jid = msg.key.remoteJid! + const list = assertMessageList(jid) + list.upsert(msg, 'prepend') + } + + logger.debug({ messages: newMessages.length }, 'synced messages') + }) + + ev.on('contacts.update', updates => { + for(const update of updates) { + if(contacts[update.id!]) { + Object.assign(contacts[update.id!], update) + } else { + logger.debug({ update }, 'got update for non-existant contact') + } + } + }) + ev.on('chats.upsert', newChats => { + chats.upsert(...newChats) + }) + ev.on('chats.update', updates => { + for(let update of updates) { + const result = chats.update(update.id!, chat => { + if(update.unreadCount! > 0) { + update = { ...update } + update.unreadCount = (chat.unreadCount || 0) + update.unreadCount! + } + + Object.assign(chat, update) + }) + if(!result) { + logger.debug({ update }, 'got update for non-existant chat') + } + } + }) + ev.on('presence.update', ({ id, presences: update }) => { + presences[id] = presences[id] || {} + Object.assign(presences[id], update) + }) + ev.on('chats.delete', deletions => { + for(const item of deletions) { + chats.deleteById(item) + } + }) + ev.on('messages.upsert', ({ messages: newMessages, type }) => { + switch (type) { + case 'append': + case 'notify': + for(const msg of newMessages) { + const jid = jidNormalizedUser(msg.key.remoteJid!) + const list = assertMessageList(jid) + list.upsert(msg, 'append') + + if(type === 'notify') { + if(!chats.get(jid)) { + ev.emit('chats.upsert', [ + { + id: jid, + conversationTimestamp: toNumber(msg.messageTimestamp), + unreadCount: 1 + } + ]) + } + } + } + + break + } + }) + ev.on('messages.update', updates => { + for(const { update, key } of updates) { + const list = assertMessageList(key.remoteJid!) + const result = list.updateAssign(key.id!, update) + if(!result) { + logger.debug({ update }, 'got update for non-existent message') + } + } + }) + ev.on('messages.delete', item => { + if('all' in item) { + const list = messages[item.jid] + list?.clear() + } else { + const jid = item.keys[0].remoteJid! + const list = messages[jid] + if(list) { + const idSet = new Set(item.keys.map(k => k.id)) + list.filter(m => !idSet.has(m.key.id)) + } + } + }) + + ev.on('groups.update', updates => { + for(const update of updates) { + const id = update.id! + if(groupMetadata[id]) { + Object.assign(groupMetadata[id], update) + } else { + logger.debug({ update }, 'got update for non-existant group metadata') + } + } + }) + + ev.on('group-participants.update', ({ id, participants, action }) => { + const metadata = groupMetadata[id] + if(metadata) { + switch (action) { + case 'add': + metadata.participants.push(...participants.map(id => ({ id, isAdmin: false, isSuperAdmin: false }))) + break + case 'demote': + case 'promote': + for(const participant of metadata.participants) { + if(participants.includes(participant.id)) { + participant.isAdmin = action === 'promote' + } + } + + break + case 'remove': + metadata.participants = metadata.participants.filter(p => !participants.includes(p.id)) + break + } + } + }) + + ev.on('message-receipt.update', updates => { + for(const { key, receipt } of updates) { + const obj = messages[key.remoteJid!] + const msg = obj?.get(key.id!) + if(msg) { + updateMessageWithReceipt(msg, receipt) + } + } + }) + + ev.on('messages.reaction', (reactions) => { + for(const { key, reaction } of reactions) { + const obj = messages[key.remoteJid!] + const msg = obj?.get(key.id!) + if(msg) { + updateMessageWithReaction(msg, reaction) + } + } + }) + } + + const toJSON = () => ({ + chats, + contacts, + messages + }) + + const fromJSON = (json: { chats: Chat[], contacts: { [id: string]: Contact }, messages: { [id: string]: WAMessage[] } }) => { + chats.upsert(...json.chats) + contactsUpsert(Object.values(json.contacts)) + for(const jid in json.messages) { + const list = assertMessageList(jid) + for(const msg of json.messages[jid]) { + list.upsert(proto.WebMessageInfo.fromObject(msg), 'append') + } + } + } + + + return { + chats, + contacts, + messages, + groupMetadata, + state, + presences, + bind, + /** loads messages from the store, if not found -- uses the legacy connection */ + loadMessages: async(jid: string, count: number, cursor: WAMessageCursor) => { + const list = assertMessageList(jid) + const mode = !cursor || 'before' in cursor ? 'before' : 'after' + const cursorKey = !!cursor ? ('before' in cursor ? cursor.before : cursor.after) : undefined + const cursorValue = cursorKey ? list.get(cursorKey.id!) : undefined + + let messages: WAMessage[] + if(list && mode === 'before' && (!cursorKey || cursorValue)) { + if(cursorValue) { + const msgIdx = list.array.findIndex(m => m.key.id === cursorKey?.id) + messages = list.array.slice(0, msgIdx) + } else { + messages = list.array + } + + const diff = count - messages.length + if(diff < 0) { + messages = messages.slice(-count) // get the last X messages + } + } else { + messages = [] + } + + return messages + }, + loadMessage: async(jid: string, id: string) => messages[jid]?.get(id), + mostRecentMessage: async(jid: string) => { + const message: WAMessage | undefined = messages[jid]?.array.slice(-1)[0] + return message + }, + fetchImageUrl: async(jid: string, sock: WASocket | undefined) => { + const contact = contacts[jid] + if(!contact) { + return sock?.profilePictureUrl(jid) + } + + if(typeof contact.imgUrl === 'undefined') { + contact.imgUrl = await sock?.profilePictureUrl(jid) + } + + return contact.imgUrl + }, + fetchGroupMetadata: async(jid: string, sock: WASocket | undefined) => { + if(!groupMetadata[jid]) { + const metadata = await sock?.groupMetadata(jid) + if(metadata) { + groupMetadata[jid] = metadata + } + } + + return groupMetadata[jid] + }, + // fetchBroadcastListInfo: async(jid: string, sock: WASocket | undefined) => { + // if(!groupMetadata[jid]) { + // const metadata = await sock?.getBroadcastListInfo(jid) + // if(metadata) { + // groupMetadata[jid] = metadata + // } + // } + + // return groupMetadata[jid] + // }, + fetchMessageReceipts: async({ remoteJid, id }: WAMessageKey) => { + const list = messages[remoteJid!] + const msg = list?.get(id!) + return msg?.userReceipt + }, + toJSON, + fromJSON, + writeToFile: (path: string) => { + // require fs here so that in case "fs" is not available -- the app does not crash + const { writeFileSync } = require('fs') + writeFileSync(path, JSON.stringify(toJSON())) + }, + readFromFile: (path: string) => { + // require fs here so that in case "fs" is not available -- the app does not crash + const { readFileSync, existsSync } = require('fs') + if(existsSync(path)) { + logger.debug({ path }, 'reading from file') + const jsonStr = readFileSync(path, { encoding: 'utf-8' }) + const json = JSON.parse(jsonStr) + fromJSON(json) + } + } + } +} diff --git a/src/Store/make-ordered-dictionary.ts b/src/Store/make-ordered-dictionary.ts new file mode 100644 index 00000000000..83b8f519864 --- /dev/null +++ b/src/Store/make-ordered-dictionary.ts @@ -0,0 +1,86 @@ +function makeOrderedDictionary(idGetter: (item: T) => string) { + const array: T[] = [] + const dict: { [_: string]: T } = { } + + const get = (id: string): T | undefined => dict[id] + + const update = (item: T) => { + const id = idGetter(item) + const idx = array.findIndex(i => idGetter(i) === id) + if(idx >= 0) { + array[idx] = item + dict[id] = item + } + + return false + } + + const upsert = (item: T, mode: 'append' | 'prepend') => { + const id = idGetter(item) + if(get(id)) { + update(item) + } else { + if(mode === 'append') { + array.push(item) + } else { + array.splice(0, 0, item) + } + + dict[id] = item + } + } + + const remove = (item: T) => { + const id = idGetter(item) + const idx = array.findIndex(i => idGetter(i) === id) + if(idx >= 0) { + array.splice(idx, 1) + delete dict[id] + return true + } + + return false + } + + return { + array, + get, + upsert, + update, + remove, + updateAssign: (id: string, update: Partial) => { + const item = get(id) + if(item) { + Object.assign(item, update) + delete dict[id] + dict[idGetter(item)] = item + return true + } + + return false + }, + clear: () => { + array.splice(0, array.length) + Object.keys(dict).forEach(key => { + delete dict[key] + }) + }, + filter: (contain: (item: T) => boolean) => { + let i = 0 + while(i < array.length) { + if(!contain(array[i])) { + delete dict[idGetter(array[i])] + array.splice(i, 1) + } else { + i += 1 + } + } + }, + toJSON: () => array, + fromJSON: (newItems: T[]) => { + array.splice(0, array.length, ...newItems) + } + } +} + +export default makeOrderedDictionary \ No newline at end of file diff --git a/src/Tests/test.app-state-sync.ts b/src/Tests/test.app-state-sync.ts new file mode 100644 index 00000000000..14f925e6e25 --- /dev/null +++ b/src/Tests/test.app-state-sync.ts @@ -0,0 +1,207 @@ +import { AccountSettings, ChatMutation, Contact, InitialAppStateSyncOptions } from '../Types' +import { unixTimestampSeconds } from '../Utils' +import { processSyncAction } from '../Utils/chat-utils' +import logger from '../Utils/logger' + +describe('App State Sync Tests', () => { + + const me: Contact = { id: randomJid() } + // case when initial sync is off + it('should return archive=false event', () => { + const jid = randomJid() + const index = ['archive', jid] + + const CASES: ChatMutation[][] = [ + [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: false, + messageRange: { + lastMessageTimestamp: unixTimestampSeconds() + } + } + } + } + } + ], + [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: true, + messageRange: { + lastMessageTimestamp: unixTimestampSeconds() + } + } + } + } + }, + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: false, + messageRange: { + lastMessageTimestamp: unixTimestampSeconds() + } + } + } + } + } + ] + ] + + for(const mutations of CASES) { + const events = processSyncAction(mutations, me, undefined, logger) + expect(events['chats.update']).toHaveLength(1) + const event = events['chats.update']?.[0] + expect(event.archive).toEqual(false) + } + }) + // case when initial sync is on + // and unarchiveChats = true + it('should not fire any archive event', () => { + const jid = randomJid() + const index = ['archive', jid] + const now = unixTimestampSeconds() + + const CASES: ChatMutation[][] = [ + [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: true, + messageRange: { + lastMessageTimestamp: now - 1 + } + } + } + } + } + ], + [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: false, + messageRange: { + lastMessageTimestamp: now + 10 + } + } + } + } + } + ], + [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: true, + messageRange: { + lastMessageTimestamp: now + 10 + } + } + } + } + }, + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: false, + messageRange: { + lastMessageTimestamp: now + 11 + } + } + } + } + } + ], + ] + + const ctx: InitialAppStateSyncOptions = { + recvChats: { + [jid]: { lastMsgRecvTimestamp: now } + }, + accountSettings: { unarchiveChats: true } + } + + for(const mutations of CASES) { + const events = processSyncActions(mutations, me, ctx, logger) + expect(events['chats.update']?.length).toBeFalsy() + } + }) + + // case when initial sync is on + // with unarchiveChats = true & unarchiveChats = false + it('should fire archive=true events', () => { + const jid = randomJid() + const index = ['archive', jid] + const now = unixTimestampSeconds() + + const CASES: { settings: AccountSettings, mutations: ChatMutation[] }[] = [ + { + settings: { unarchiveChats: true }, + mutations: [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: true, + messageRange: { + lastMessageTimestamp: now + } + } + } + } + } + ], + }, + { + settings: { unarchiveChats: false }, + mutations: [ + { + index, + syncAction: { + value: { + archiveChatAction: { + archived: true, + messageRange: { + lastMessageTimestamp: now - 10 + } + } + } + } + } + ], + } + ] + + for(const { mutations, settings } of CASES) { + const ctx: InitialAppStateSyncOptions = { + recvChats: { + [jid]: { lastMsgRecvTimestamp: now } + }, + accountSettings: settings + } + const events = processSyncActions(mutations, me, ctx, logger) + expect(events['chats.update']).toHaveLength(1) + const event = events['chats.update']?.[0] + expect(event.archive).toEqual(true) + } + }) +}) \ No newline at end of file diff --git a/src/Tests/test.event-buffer.ts b/src/Tests/test.event-buffer.ts new file mode 100644 index 00000000000..e2453e1262c --- /dev/null +++ b/src/Tests/test.event-buffer.ts @@ -0,0 +1,319 @@ +import { proto } from '../../WAProto' +import { Chat, WAMessageKey, WAMessageStatus, WAMessageStubType, WAMessageUpdate } from '../Types' +import { delay, generateMessageID, makeEventBuffer, toNumber, unixTimestampSeconds } from '../Utils' +import logger from '../Utils/logger' +import { randomJid } from './utils' + +describe('Event Buffer Tests', () => { + + let ev: ReturnType + beforeEach(() => { + const _logger = logger.child({ }) + _logger.level = 'trace' + ev = makeEventBuffer(_logger) + }) + + it('should buffer a chat upsert & update event', async() => { + const chatId = randomJid() + + const chats: Chat[] = [] + + ev.on('chats.upsert', c => chats.push(...c)) + ev.on('chats.update', () => fail('should not emit update event')) + + ev.buffer() + await Promise.all([ + (async() => { + ev.buffer() + await delay(100) + ev.emit('chats.upsert', [{ id: chatId, conversationTimestamp: 123, unreadCount: 1 }]) + const flushed = ev.flush() + expect(flushed).toBeFalsy() + })(), + (async() => { + ev.buffer() + await delay(200) + ev.emit('chats.update', [{ id: chatId, conversationTimestamp: 124, unreadCount: 1 }]) + const flushed = ev.flush() + expect(flushed).toBeFalsy() + })() + ]) + + const flushed = ev.flush() + expect(flushed).toBeTruthy() + + expect(chats).toHaveLength(1) + expect(chats[0].conversationTimestamp).toEqual(124) + expect(chats[0].unreadCount).toEqual(2) + }) + + it('should overwrite a chats.delete event', async() => { + const chatId = randomJid() + const chats: Partial[] = [] + + ev.on('chats.update', c => chats.push(...c)) + ev.on('chats.delete', () => fail('not should have emitted')) + + ev.buffer() + + ev.emit('chats.update', [{ id: chatId, conversationTimestamp: 123, unreadCount: 1 }]) + ev.emit('chats.delete', [chatId]) + ev.emit('chats.update', [{ id: chatId, conversationTimestamp: 124, unreadCount: 1 }]) + + ev.flush() + + expect(chats).toHaveLength(1) + }) + + it('should overwrite a chats.update event', async() => { + const chatId = randomJid() + const chatsDeleted: string[] = [] + + ev.on('chats.delete', c => chatsDeleted.push(...c)) + ev.on('chats.update', () => fail('not should have emitted')) + + ev.buffer() + + ev.emit('chats.update', [{ id: chatId, conversationTimestamp: 123, unreadCount: 1 }]) + ev.emit('chats.delete', [chatId]) + + ev.flush() + + expect(chatsDeleted).toHaveLength(1) + }) + + it('should release a conditional update at the right time', async() => { + const chatId = randomJid() + const chatId2 = randomJid() + const chatsUpserted: Chat[] = [] + const chatsSynced: Chat[] = [] + + ev.on('chats.upsert', c => chatsUpserted.push(...c)) + ev.on('messaging-history.set', c => chatsSynced.push(...c.chats)) + ev.on('chats.update', () => fail('not should have emitted')) + + ev.buffer() + ev.emit('chats.update', [{ + id: chatId, + archived: true, + conditional(buff) { + if(buff.chatUpserts[chatId]) { + return true + } + } + }]) + ev.emit('chats.update', [{ + id: chatId2, + archived: true, + conditional(buff) { + if(buff.historySets.chats[chatId2]) { + return true + } + } + }]) + + ev.flush() + + ev.buffer() + ev.emit('chats.upsert', [{ + id: chatId, + conversationTimestamp: 123, + unreadCount: 1, + muteEndTime: 123 + }]) + ev.emit('messaging-history.set', { + chats: [{ + id: chatId2, + conversationTimestamp: 123, + unreadCount: 1, + muteEndTime: 123 + }], + contacts: [], + messages: [], + isLatest: false + }) + ev.flush() + + expect(chatsUpserted).toHaveLength(1) + expect(chatsUpserted[0].id).toEqual(chatId) + expect(chatsUpserted[0].archived).toEqual(true) + expect(chatsUpserted[0].muteEndTime).toEqual(123) + + expect(chatsSynced).toHaveLength(1) + expect(chatsSynced[0].id).toEqual(chatId2) + expect(chatsSynced[0].archived).toEqual(true) + }) + + it('should discard a conditional update', async() => { + const chatId = randomJid() + const chatsUpserted: Chat[] = [] + + ev.on('chats.upsert', c => chatsUpserted.push(...c)) + ev.on('chats.update', () => fail('not should have emitted')) + + ev.buffer() + ev.emit('chats.update', [{ + id: chatId, + archived: true, + conditional(buff) { + if(buff.chatUpserts[chatId]) { + return false + } + } + }]) + ev.emit('chats.upsert', [{ + id: chatId, + conversationTimestamp: 123, + unreadCount: 1, + muteEndTime: 123 + }]) + + ev.flush() + + expect(chatsUpserted).toHaveLength(1) + expect(chatsUpserted[0].archived).toBeUndefined() + }) + + it('should overwrite a chats.update event with a history event', async() => { + const chatId = randomJid() + let chatRecv: Chat | undefined + + ev.on('messaging-history.set', ({ chats }) => { + chatRecv = chats[0] + }) + ev.on('chats.update', () => fail('not should have emitted')) + + ev.buffer() + + ev.emit('messaging-history.set', { + chats: [{ id: chatId, conversationTimestamp: 123, unreadCount: 1 }], + messages: [], + contacts: [], + isLatest: true + }) + ev.emit('chats.update', [{ id: chatId, archived: true }]) + + ev.flush() + + expect(chatRecv).toBeDefined() + expect(chatRecv?.archived).toBeTruthy() + }) + + it('should buffer message upsert events', async() => { + const messageTimestamp = unixTimestampSeconds() + const msg: proto.IWebMessageInfo = { + key: { + remoteJid: randomJid(), + id: generateMessageID(), + fromMe: false + }, + messageStubType: WAMessageStubType.CIPHERTEXT, + messageTimestamp + } + + const msgs: proto.IWebMessageInfo[] = [] + + ev.on('messages.upsert', c => { + msgs.push(...c.messages) + expect(c.type).toEqual('notify') + }) + + ev.buffer() + ev.emit('messages.upsert', { messages: [proto.WebMessageInfo.fromObject(msg)], type: 'notify' }) + + msg.messageTimestamp = unixTimestampSeconds() + 1 + msg.messageStubType = undefined + msg.message = { conversation: 'Test' } + ev.emit('messages.upsert', { messages: [proto.WebMessageInfo.fromObject(msg)], type: 'notify' }) + ev.emit('messages.update', [{ key: msg.key, update: { status: WAMessageStatus.READ } }]) + + ev.flush() + + expect(msgs).toHaveLength(1) + expect(msgs[0].message).toBeTruthy() + expect(toNumber(msgs[0].messageTimestamp!)).toEqual(messageTimestamp) + expect(msgs[0].status).toEqual(WAMessageStatus.READ) + }) + + it('should buffer a message receipt update', async() => { + const msg: proto.IWebMessageInfo = { + key: { + remoteJid: randomJid(), + id: generateMessageID(), + fromMe: false + }, + messageStubType: WAMessageStubType.CIPHERTEXT, + messageTimestamp: unixTimestampSeconds() + } + + const msgs: proto.IWebMessageInfo[] = [] + + ev.on('messages.upsert', c => msgs.push(...c.messages)) + ev.on('message-receipt.update', () => fail('should not emit')) + + ev.buffer() + ev.emit('messages.upsert', { messages: [proto.WebMessageInfo.fromObject(msg)], type: 'notify' }) + ev.emit('message-receipt.update', [ + { + key: msg.key, + receipt: { + userJid: randomJid(), + readTimestamp: unixTimestampSeconds() + } + } + ]) + + ev.flush() + + expect(msgs).toHaveLength(1) + expect(msgs[0].userReceipt).toHaveLength(1) + }) + + it('should buffer multiple status updates', async() => { + const key: WAMessageKey = { + remoteJid: randomJid(), + id: generateMessageID(), + fromMe: false + } + + const msgs: WAMessageUpdate[] = [] + + ev.on('messages.update', c => msgs.push(...c)) + + ev.buffer() + ev.emit('messages.update', [{ key, update: { status: WAMessageStatus.DELIVERY_ACK } }]) + ev.emit('messages.update', [{ key, update: { status: WAMessageStatus.READ } }]) + + ev.flush() + + expect(msgs).toHaveLength(1) + expect(msgs[0].update.status).toEqual(WAMessageStatus.READ) + }) + + it('should remove chat unread counter', async() => { + const msg: proto.IWebMessageInfo = { + key: { + remoteJid: '12345@s.whatsapp.net', + id: generateMessageID(), + fromMe: false + }, + message: { + conversation: 'abcd' + }, + messageTimestamp: unixTimestampSeconds() + } + + const chats: Partial[] = [] + + ev.on('chats.update', c => chats.push(...c)) + + ev.buffer() + ev.emit('messages.upsert', { messages: [proto.WebMessageInfo.fromObject(msg)], type: 'notify' }) + ev.emit('chats.update', [{ id: msg.key.remoteJid!, unreadCount: 1, conversationTimestamp: msg.messageTimestamp }]) + ev.emit('messages.update', [{ key: msg.key, update: { status: WAMessageStatus.READ } }]) + + ev.flush() + + expect(chats[0].unreadCount).toBeUndefined() + }) +}) \ No newline at end of file diff --git a/src/Tests/test.key-store.ts b/src/Tests/test.key-store.ts new file mode 100644 index 00000000000..f6b86b24ae9 --- /dev/null +++ b/src/Tests/test.key-store.ts @@ -0,0 +1,92 @@ +import { addTransactionCapability, delay } from '../Utils' +import logger from '../Utils/logger' +import { makeMockSignalKeyStore } from './utils' + +logger.level = 'trace' + +describe('Key Store w Transaction Tests', () => { + + const rawStore = makeMockSignalKeyStore() + const store = addTransactionCapability( + rawStore, + logger, + { + maxCommitRetries: 1, + delayBetweenTriesMs: 10 + } + ) + + it('should use transaction cache when mutated', async() => { + const key = '123' + const value = new Uint8Array(1) + const ogGet = rawStore.get + await store.transaction( + async() => { + await store.set({ 'session': { [key]: value } }) + + rawStore.get = () => { + throw new Error('should not have been called') + } + + const { [key]: stored } = await store.get('session', [key]) + expect(stored).toEqual(new Uint8Array(1)) + } + ) + + rawStore.get = ogGet + }) + + it('should not commit a failed transaction', async() => { + const key = 'abcd' + await expect( + store.transaction( + async() => { + await store.set({ 'session': { [key]: new Uint8Array(1) } }) + throw new Error('fail') + } + ) + ).rejects.toThrowError( + 'fail' + ) + + const { [key]: stored } = await store.get('session', [key]) + expect(stored).toBeUndefined() + }) + + it('should handle overlapping transactions', async() => { + // promise to let transaction 2 + // know that transaction 1 has started + let promiseResolve: () => void + const promise = new Promise(resolve => { + promiseResolve = resolve + }) + + store.transaction( + async() => { + await store.set({ + 'session': { + '1': new Uint8Array(1) + } + }) + // wait for the other transaction to start + await delay(5) + // reolve the promise to let the other transaction continue + promiseResolve() + } + ) + + await store.transaction( + async() => { + await promise + await delay(5) + + expect(store.isInTransaction()).toBe(true) + } + ) + + expect(store.isInTransaction()).toBe(false) + // ensure that the transaction were committed + const { ['1']: stored } = await store.get('session', ['1']) + expect(stored).toEqual(new Uint8Array(1)) + }) +}) \ No newline at end of file diff --git a/src/Tests/test.libsignal.ts b/src/Tests/test.libsignal.ts new file mode 100644 index 00000000000..a71fd5c9ab0 --- /dev/null +++ b/src/Tests/test.libsignal.ts @@ -0,0 +1,186 @@ +import { makeLibSignalRepository } from '../Signal/libsignal' +import { SignalAuthState, SignalDataTypeMap } from '../Types' +import { Curve, generateRegistrationId, generateSignalPubKey, signedKeyPair } from '../Utils' + +describe('Signal Tests', () => { + + it('should correctly encrypt/decrypt 1 message', async() => { + const user1 = makeUser() + const user2 = makeUser() + + const msg = Buffer.from('hello there!') + + await prepareForSendingMessage(user1, user2) + + const result = await user1.repository.encryptMessage( + { jid: user2.jid, data: msg } + ) + + const dec = await user2.repository.decryptMessage( + { jid: user1.jid, ...result } + ) + + expect(dec).toEqual(msg) + }) + + it('should correctly override a session', async() => { + const user1 = makeUser() + const user2 = makeUser() + + const msg = Buffer.from('hello there!') + + for(let preKeyId = 2; preKeyId <= 3;preKeyId++) { + await prepareForSendingMessage(user1, user2, preKeyId) + + const result = await user1.repository.encryptMessage( + { jid: user2.jid, data: msg } + ) + + const dec = await user2.repository.decryptMessage( + { jid: user1.jid, ...result } + ) + + expect(dec).toEqual(msg) + } + }) + + it('should correctly encrypt/decrypt multiple messages', async() => { + const user1 = makeUser() + const user2 = makeUser() + + const msg = Buffer.from('hello there!') + + await prepareForSendingMessage(user1, user2) + + for(let i = 0;i < 10;i++) { + const result = await user1.repository.encryptMessage( + { jid: user2.jid, data: msg } + ) + + const dec = await user2.repository.decryptMessage( + { jid: user1.jid, ...result } + ) + + expect(dec).toEqual(msg) + } + }) + + it('should encrypt/decrypt messages from group', async() => { + const groupId = '123456@g.us' + const participants = [...Array(5)].map(makeUser) + + const msg = Buffer.from('hello there!') + + const sender = participants[0] + const enc = await sender.repository.encryptGroupMessage( + { + group: groupId, + meId: sender.jid, + data: msg + } + ) + + for(const participant of participants) { + if(participant === sender) { + continue + } + + await participant.repository.processSenderKeyDistributionMessage( + { + item: { + groupId, + axolotlSenderKeyDistributionMessage: enc.senderKeyDistributionMessage + }, + authorJid: sender.jid + } + ) + + const dec = await participant.repository.decryptGroupMessage( + { + group: groupId, + authorJid: sender.jid, + msg: enc.ciphertext + } + ) + expect(dec).toEqual(msg) + } + }) +}) + +type User = ReturnType + +function makeUser() { + const store = makeTestAuthState() + const jid = `${Math.random().toString().replace('.', '')}@s.whatsapp.net` + const repository = makeLibSignalRepository(store) + return { store, jid, repository } +} + +async function prepareForSendingMessage( + sender: User, + receiver: User, + preKeyId = 2 +) { + const preKey = Curve.generateKeyPair() + await sender.repository.injectE2ESession( + { + jid: receiver.jid, + session: { + registrationId: receiver.store.creds.registrationId, + identityKey: generateSignalPubKey(receiver.store.creds.signedIdentityKey.public), + signedPreKey: { + keyId: receiver.store.creds.signedPreKey.keyId, + publicKey: generateSignalPubKey(receiver.store.creds.signedPreKey.keyPair.public), + signature: receiver.store.creds.signedPreKey.signature, + }, + preKey: { + keyId: preKeyId, + publicKey: generateSignalPubKey(preKey.public), + } + } + } + ) + + await receiver.store.keys.set({ + 'pre-key': { + [preKeyId]: preKey + } + }) +} + +function makeTestAuthState(): SignalAuthState { + const identityKey = Curve.generateKeyPair() + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const store: { [_: string]: any } = {} + return { + creds: { + signedIdentityKey: identityKey, + registrationId: generateRegistrationId(), + signedPreKey: signedKeyPair(identityKey, 1), + }, + keys: { + get(type, ids) { + const data: { [_: string]: SignalDataTypeMap[typeof type] } = { } + for(const id of ids) { + const item = store[getUniqueId(type, id)] + if(typeof item !== 'undefined') { + data[id] = item + } + } + + return data + }, + set(data) { + for(const type in data) { + for(const id in data[type]) { + store[getUniqueId(type, id)] = data[type][id] + } + } + }, + } + } + + function getUniqueId(type: string, id: string) { + return `${type}.${id}` + } +} \ No newline at end of file diff --git a/src/Tests/test.media-download.ts b/src/Tests/test.media-download.ts new file mode 100644 index 00000000000..f00638cc399 --- /dev/null +++ b/src/Tests/test.media-download.ts @@ -0,0 +1,76 @@ +import { readFileSync } from 'fs' +import { proto } from '../../WAProto' +import { DownloadableMessage, MediaType } from '../Types' +import { downloadContentFromMessage } from '../Utils' + +jest.setTimeout(20_000) + +type TestVector = { + type: MediaType + message: DownloadableMessage + plaintext: Buffer +} + +const TEST_VECTORS: TestVector[] = [ + { + type: 'image', + message: proto.Message.ImageMessage.decode( + Buffer.from( + 'Ck1odHRwczovL21tZy53aGF0c2FwcC5uZXQvZC9mL0FwaHR4WG9fWXZZcDZlUVNSa0tjOHE5d2ozVUpleWdoY3poM3ExX3I0ektnLmVuYxIKaW1hZ2UvanBlZyIgKTuVFyxDc6mTm4GXPlO3Z911Wd8RBeTrPLSWAEdqW8MomcUBQiB7wH5a4nXMKyLOT0A2nFgnnM/DUH8YjQf8QtkCIekaSkogTB+BXKCWDFrmNzozY0DCPn0L4VKd7yG1ZbZwbgRhzVc=', + 'base64' + ) + ), + plaintext: readFileSync('./Media/cat.jpeg') + }, + { + type: 'image', + message: proto.Message.ImageMessage.decode( + Buffer.from( + 'Ck1odHRwczovL21tZy53aGF0c2FwcC5uZXQvZC9mL0Ftb2tnWkphNWF6QWZxa3dVRzc0eUNUdTlGeWpjMmd5akpqcXNmMUFpZEU5LmVuYxIKaW1hZ2UvanBlZyIg8IS5TQzdzcuvcR7F8HMhWnXmlsV+GOo9JE1/t2k+o9Yoz6o6QiA7kDk8j5KOEQC0kDFE1qW7lBBDYhm5z06N3SirfUj3CUog/CjYF8e670D5wUJwWv2B2mKzDEo8IJLStDv76YmtPfs=', + 'base64' + ) + ), + plaintext: readFileSync('./Media/icon.png') + }, +] + +describe('Media Download Tests', () => { + + it('should download a full encrypted media correctly', async() => { + for(const { type, message, plaintext } of TEST_VECTORS) { + const readPipe = await downloadContentFromMessage(message, type) + + let buffer = Buffer.alloc(0) + for await (const read of readPipe) { + buffer = Buffer.concat([ buffer, read ]) + } + + expect(buffer).toEqual(plaintext) + } + }) + + it('should download an encrypted media correctly piece', async() => { + for(const { type, message, plaintext } of TEST_VECTORS) { + // check all edge cases + const ranges = [ + { startByte: 51, endByte: plaintext.length - 100 }, // random numbers + { startByte: 1024, endByte: 2038 }, // larger random multiples of 16 + { startByte: 1, endByte: plaintext.length - 1 } // borders + ] + for(const range of ranges) { + const readPipe = await downloadContentFromMessage(message, type, range) + + let buffer = Buffer.alloc(0) + for await (const read of readPipe) { + buffer = Buffer.concat([ buffer, read ]) + } + + const hex = buffer.toString('hex') + const expectedHex = plaintext.slice(range.startByte || 0, range.endByte || undefined).toString('hex') + expect(hex).toBe(expectedHex) + + console.log('success on ', range) + } + } + }) +}) \ No newline at end of file diff --git a/src/Tests/test.messages.ts b/src/Tests/test.messages.ts new file mode 100644 index 00000000000..7f51f39b823 --- /dev/null +++ b/src/Tests/test.messages.ts @@ -0,0 +1,37 @@ +import { WAMessageContent } from '../Types' +import { normalizeMessageContent } from '../Utils' + +describe('Messages Tests', () => { + + it('should correctly unwrap messages', () => { + const CONTENT = { imageMessage: { } } + expectRightContent(CONTENT) + expectRightContent({ + ephemeralMessage: { message: CONTENT } + }) + expectRightContent({ + viewOnceMessage: { + message: { + ephemeralMessage: { message: CONTENT } + } + } + }) + expectRightContent({ + viewOnceMessage: { + message: { + viewOnceMessageV2: { + message: { + ephemeralMessage: { message: CONTENT } + } + } + } + } + }) + + function expectRightContent(content: WAMessageContent) { + expect( + normalizeMessageContent(content) + ).toHaveProperty('imageMessage') + } + }) +}) \ No newline at end of file diff --git a/src/Tests/utils.ts b/src/Tests/utils.ts new file mode 100644 index 00000000000..bcd1469bed3 --- /dev/null +++ b/src/Tests/utils.ts @@ -0,0 +1,36 @@ +import { SignalDataTypeMap, SignalKeyStore } from '../Types' +import { jidEncode } from '../WABinary' + +export function randomJid() { + return jidEncode(Math.floor(Math.random() * 1000000), Math.random() < 0.5 ? 's.whatsapp.net' : 'g.us') +} + +export function makeMockSignalKeyStore(): SignalKeyStore { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const store: { [_: string]: any } = {} + + return { + get(type, ids) { + const data: { [_: string]: SignalDataTypeMap[typeof type] } = { } + for(const id of ids) { + const item = store[getUniqueId(type, id)] + if(typeof item !== 'undefined') { + data[id] = item + } + } + + return data + }, + set(data) { + for(const type in data) { + for(const id in data[type]) { + store[getUniqueId(type, id)] = data[type][id] + } + } + }, + } + + function getUniqueId(type: string, id: string) { + return `${type}.${id}` + } +} \ No newline at end of file diff --git a/src/Types/Auth.ts b/src/Types/Auth.ts new file mode 100644 index 00000000000..6c063331df2 --- /dev/null +++ b/src/Types/Auth.ts @@ -0,0 +1,101 @@ +import type { proto } from '../../WAProto' +import type { Contact } from './Contact' +import type { MinimalMessage } from './Message' + +export type KeyPair = { public: Uint8Array, private: Uint8Array } +export type SignedKeyPair = { + keyPair: KeyPair + signature: Uint8Array + keyId: number + timestampS?: number +} + +export type ProtocolAddress = { + name: string // jid + deviceId: number +} +export type SignalIdentity = { + identifier: ProtocolAddress + identifierKey: Uint8Array +} + +export type LTHashState = { + version: number + hash: Buffer + indexValueMap: { + [indexMacBase64: string]: { valueMac: Uint8Array | Buffer } + } +} + +export type SignalCreds = { + readonly signedIdentityKey: KeyPair + readonly signedPreKey: SignedKeyPair + readonly registrationId: number +} + +export type AccountSettings = { + /** unarchive chats when a new message is received */ + unarchiveChats: boolean + /** the default mode to start new conversations with */ + defaultDisappearingMode?: Pick +} + +export type AuthenticationCreds = SignalCreds & { + readonly noiseKey: KeyPair + readonly advSecretKey: string + + me?: Contact + account?: proto.IADVSignedDeviceIdentity + signalIdentities?: SignalIdentity[] + myAppStateKeyId?: string + firstUnuploadedPreKeyId: number + nextPreKeyId: number + + lastAccountSyncTimestamp?: number + platform?: string + + processedHistoryMessages: MinimalMessage[] + /** number of times history & app state has been synced */ + accountSyncCounter: number + accountSettings: AccountSettings +} + +export type SignalDataTypeMap = { + 'pre-key': KeyPair + 'session': Uint8Array + 'sender-key': Uint8Array + 'sender-key-memory': { [jid: string]: boolean } + 'app-state-sync-key': proto.Message.IAppStateSyncKeyData + 'app-state-sync-version': LTHashState +} + +export type SignalDataSet = { [T in keyof SignalDataTypeMap]?: { [id: string]: SignalDataTypeMap[T] | null } } + +type Awaitable = T | Promise + +export type SignalKeyStore = { + get(type: T, ids: string[]): Awaitable<{ [id: string]: SignalDataTypeMap[T] }> + set(data: SignalDataSet): Awaitable + /** clear all the data in the store */ + clear?(): Awaitable +} + +export type SignalKeyStoreWithTransaction = SignalKeyStore & { + isInTransaction: () => boolean + transaction(exec: () => Promise): Promise +} + +export type TransactionCapabilityOptions = { + maxCommitRetries: number + delayBetweenTriesMs: number +} + +export type SignalAuthState = { + creds: SignalCreds + keys: SignalKeyStore | SignalKeyStoreWithTransaction +} + +export type AuthenticationState = { + creds: AuthenticationCreds + keys: SignalKeyStore +} \ No newline at end of file diff --git a/src/Types/Call.ts b/src/Types/Call.ts new file mode 100644 index 00000000000..cea184a29aa --- /dev/null +++ b/src/Types/Call.ts @@ -0,0 +1,14 @@ + +export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' + +export type WACallEvent = { + chatId: string + from: string + isGroup?: boolean + id: string + date: Date + isVideo?: boolean + status: WACallUpdateType + offline: boolean + latencyMs?: number +} \ No newline at end of file diff --git a/src/Types/Chat.ts b/src/Types/Chat.ts new file mode 100644 index 00000000000..ae218133ea1 --- /dev/null +++ b/src/Types/Chat.ts @@ -0,0 +1,98 @@ +import type { proto } from '../../WAProto' +import type { AccountSettings } from './Auth' +import type { BufferedEventData } from './Events' +import type { MinimalMessage } from './Message' + +/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */ +export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused' + +export const ALL_WA_PATCH_NAMES = [ + 'critical_block', + 'critical_unblock_low', + 'regular_high', + 'regular_low', + 'regular' +] as const + +export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number] + +export interface PresenceData { + lastKnownPresence: WAPresence + lastSeen?: number +} + +export type ChatMutation = { + syncAction: proto.ISyncActionData + index: string[] +} + +export type WAPatchCreate = { + syncAction: proto.ISyncActionValue + index: string[] + type: WAPatchName + apiVersion: number + operation: proto.SyncdMutation.SyncdOperation +} + +export type Chat = proto.IConversation & { + /** unix timestamp of when the last message was received in the chat */ + lastMessageRecvTimestamp?: number +} + +export type ChatUpdate = Partial boolean | undefined +}> + +/** + * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat + * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat + * */ +export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange + +export type ChatModification = + { + archive: boolean + lastMessages: LastMessageList + } + | { pushNameSetting: string } + | { pin: boolean } + | { + /** mute for duration, or provide timestamp of mute to remove*/ + mute: number | null + } + | { + clear: 'all' | { messages: {id: string, fromMe?: boolean, timestamp: number}[] } + } + | { + star: { + messages: { id: string, fromMe?: boolean }[] + star: boolean + } + } + | { + markRead: boolean + lastMessages: LastMessageList + } + | { delete: true, lastMessages: LastMessageList } + +export type InitialReceivedChatsState = { + [jid: string]: { + /** the last message received from the other party */ + lastMsgRecvTimestamp?: number + /** the absolute last message in the chat */ + lastMsgTimestamp: number + } +} + +export type InitialAppStateSyncOptions = { + accountSettings: AccountSettings +} \ No newline at end of file diff --git a/src/Types/Contact.ts b/src/Types/Contact.ts new file mode 100644 index 00000000000..5da78e8bd2b --- /dev/null +++ b/src/Types/Contact.ts @@ -0,0 +1,19 @@ +export interface Contact { + id: string + /** name of the contact, you have saved on your WA */ + name?: string + /** name of the contact, the contact has set on their own on WA */ + notify?: string + /** I have no idea */ + verifiedName?: string + // Baileys Added + /** + * Url of the profile picture of the contact + * + * 'changed' => if the profile picture has changed + * null => if the profile picture has not been set (default profile picture) + * any other string => url of the profile picture + */ + imgUrl?: string | null | 'changed' + status?: string +} \ No newline at end of file diff --git a/src/Types/Events.ts b/src/Types/Events.ts new file mode 100644 index 00000000000..e4fc942aeb6 --- /dev/null +++ b/src/Types/Events.ts @@ -0,0 +1,87 @@ +import type { Boom } from '@hapi/boom' +import { proto } from '../../WAProto' +import { AuthenticationCreds } from './Auth' +import { WACallEvent } from './Call' +import { Chat, ChatUpdate, PresenceData } from './Chat' +import { Contact } from './Contact' +import { GroupMetadata, ParticipantAction } from './GroupMetadata' +import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message' +import { ConnectionState } from './State' + +export type BaileysEventMap = { + /** connection state has been updated -- WS closed, opened, connecting etc. */ + 'connection.update': Partial + /** credentials updated -- some metadata, keys or something */ + 'creds.update': Partial + /** set chats (history sync), everything is reverse chronologically sorted */ + 'messaging-history.set': { + chats: Chat[] + contacts: Contact[] + messages: WAMessage[] + isLatest: boolean + } + /** upsert chats */ + 'chats.upsert': Chat[] + /** update the given chats */ + 'chats.update': ChatUpdate[] + /** delete chats with given ID */ + 'chats.delete': string[] + /** presence of contact in a chat updated */ + 'presence.update': { id: string, presences: { [participant: string]: PresenceData } } + + 'contacts.upsert': Contact[] + 'contacts.update': Partial[] + + 'messages.delete': { keys: WAMessageKey[] } | { jid: string, all: true } + 'messages.update': WAMessageUpdate[] + 'messages.media-update': { key: WAMessageKey, media?: { ciphertext: Uint8Array, iv: Uint8Array }, error?: Boom }[] + /** + * add/update the given messages. If they were received while the connection was online, + * the update will have type: "notify" + * */ + 'messages.upsert': { messages: WAMessage[], type: MessageUpsertType } + /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */ + 'messages.reaction': { key: WAMessageKey, reaction: proto.IReaction }[] + + 'message-receipt.update': MessageUserReceiptUpdate[] + + 'groups.upsert': GroupMetadata[] + 'groups.update': Partial[] + /** apply an action to participants in a group */ + 'group-participants.update': { id: string, participants: string[], action: ParticipantAction } + + 'blocklist.set': { blocklist: string[] } + 'blocklist.update': { blocklist: string[], type: 'add' | 'remove' } + /** Receive an update on a call, including when the call was received, rejected, accepted */ + 'call': WACallEvent[] +} + +export type BufferedEventData = { + historySets: { + chats: { [jid: string]: Chat } + contacts: { [jid: string]: Contact } + messages: { [uqId: string]: WAMessage } + empty: boolean + isLatest: boolean + } + chatUpserts: { [jid: string]: Chat } + chatUpdates: { [jid: string]: ChatUpdate } + chatDeletes: Set + contactUpserts: { [jid: string]: Contact } + contactUpdates: { [jid: string]: Partial } + messageUpserts: { [key: string]: { type: MessageUpsertType, message: WAMessage } } + messageUpdates: { [key: string]: WAMessageUpdate } + messageDeletes: { [key: string]: WAMessageKey } + messageReactions: { [key: string]: { key: WAMessageKey, reactions: proto.IReaction[] } } + messageReceipts: { [key: string]: { key: WAMessageKey, userReceipt: proto.IUserReceipt[] } } + groupUpdates: { [jid: string]: Partial } +} + +export type BaileysEvent = keyof BaileysEventMap + +export interface BaileysEventEmitter { + on(event: T, listener: (arg: BaileysEventMap[T]) => void): void + off(event: T, listener: (arg: BaileysEventMap[T]) => void): void + removeAllListeners(event: T): void + emit(event: T, arg: BaileysEventMap[T]): boolean +} \ No newline at end of file diff --git a/src/Types/GroupMetadata.ts b/src/Types/GroupMetadata.ts new file mode 100644 index 00000000000..853a49fd3a6 --- /dev/null +++ b/src/Types/GroupMetadata.ts @@ -0,0 +1,41 @@ +import { Contact } from './Contact' + +export type GroupParticipant = (Contact & { isAdmin?: boolean, isSuperAdmin?: boolean, admin?: 'admin' | 'superadmin' | null }) + +export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' + +export interface GroupMetadata { + id: string + owner: string | undefined + subject: string + /** group subject owner */ + subjectOwner?: string + /** group subject modification date */ + subjectTime?: number + creation?: number + desc?: string + descOwner?: string + descId?: string + /** is set when the group only allows admins to change group settings */ + restrict?: boolean + /** is set when the group only allows admins to write messages */ + announce?: boolean + /** number of group participants */ + size?: number + // Baileys modified array + participants: GroupParticipant[] + ephemeralDuration?: number + inviteCode?: string +} + + +export interface WAGroupCreateResponse { + status: number + gid?: string + participants?: [{ [key: string]: {} }] +} + +export interface GroupModificationResponse { + status: number + participants?: { [key: string]: {} } +} \ No newline at end of file diff --git a/src/Types/Message.ts b/src/Types/Message.ts new file mode 100644 index 00000000000..19acff3baaf --- /dev/null +++ b/src/Types/Message.ts @@ -0,0 +1,252 @@ +import { AxiosRequestConfig } from 'axios' +import type { Logger } from 'pino' +import type { Readable } from 'stream' +import type { URL } from 'url' +import { proto } from '../../WAProto' +import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults' +import type { GroupMetadata } from './GroupMetadata' +import { CacheStore } from './Socket' + +// export the WAMessage Prototypes +export { proto as WAProto } +export type WAMessage = proto.IWebMessageInfo +export type WAMessageContent = proto.IMessage +export type WAContactMessage = proto.Message.IContactMessage +export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage +export type WAMessageKey = proto.IMessageKey +export type WATextMessage = proto.Message.IExtendedTextMessage +export type WAContextInfo = proto.IContextInfo +export type WALocationMessage = proto.Message.ILocationMessage +export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage +// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars +export import WAMessageStubType = proto.WebMessageInfo.StubType +// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars +export import WAMessageStatus = proto.WebMessageInfo.Status +export type WAMediaUpload = Buffer | { url: URL | string } | { stream: Readable } +/** Set of message types that are supported by the library */ +export type MessageType = keyof proto.Message + +export type DownloadableMessage = { mediaKey?: Uint8Array | null, directPath?: string | null, url?: string | null } + +export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined + +export type MediaConnInfo = { + auth: string + ttl: number + hosts: { hostname: string, maxContentLengthBytes: number }[] + fetchDate: Date +} + +export interface WAUrlInfo { + 'canonical-url': string + 'matched-text': string + title: string + description?: string + jpegThumbnail?: Buffer + highQualityThumbnail?: proto.Message.IImageMessage + originalThumbnailUrl?: string +} + +// types to generate WA messages +type Mentionable = { + /** list of jids that are mentioned in the accompanying text */ + mentions?: string[] +} +type Contextable = { + /** add contextInfo to the message */ + contextInfo?: proto.IContextInfo +} +type ViewOnce = { + viewOnce?: boolean +} +type Buttonable = { + /** add buttons to the message */ + buttons?: proto.Message.ButtonsMessage.IButton[] +} +type Templatable = { + /** add buttons to the message (conflicts with normal buttons)*/ + templateButtons?: proto.IHydratedTemplateButton[] + + footer?: string +} +type Listable = { + /** Sections of the List */ + sections?: proto.Message.ListMessage.ISection[] + + /** Title of a List Message only */ + title?: string + + /** Text of the bnutton on the list (required) */ + buttonText?: string +} +type WithDimensions = { + width?: number + height?: number +} + +export type PollMessageOptions = { + name: string + selectableCount?: number + values: string[] + /** 32 byte message secret to encrypt poll selections */ + messageSecret?: Uint8Array +} + +export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING +export type AnyMediaMessageContent = ( + ({ + image: WAMediaUpload + caption?: string + jpegThumbnail?: string + } & Contextable & Mentionable & Buttonable & Templatable & WithDimensions) + | ({ + video: WAMediaUpload + caption?: string + gifPlayback?: boolean + jpegThumbnail?: string + } & Contextable & Mentionable & Buttonable & Templatable & WithDimensions) + | { + audio: WAMediaUpload + /** if set to true, will send as a `voice note` */ + ptt?: boolean + /** optionally tell the duration of the audio */ + seconds?: number + } + | ({ + sticker: WAMediaUpload + isAnimated?: boolean + } & WithDimensions) | ({ + document: WAMediaUpload + mimetype: string + fileName?: string + caption?: string + } & Buttonable & Templatable)) + & { mimetype?: string } + +export type ButtonReplyInfo = { + displayText: string + id: string + index: number +} + +export type WASendableProduct = Omit & { + productImage: WAMediaUpload +} + +export type AnyRegularMessageContent = ( + ({ + text: string + linkPreview?: WAUrlInfo | null + } + & Contextable & Mentionable & Buttonable & Templatable & Listable) + | AnyMediaMessageContent + | ({ + poll: PollMessageOptions + } & Contextable & Mentionable & Buttonable & Templatable) + | { + contacts: { + displayName?: string + contacts: proto.Message.IContactMessage[] + } + } + | { + location: WALocationMessage + } + | { react: proto.Message.IReactionMessage } + | { + buttonReply: ButtonReplyInfo + type: 'template' | 'plain' + } + | { + listReply: Omit + } + | { + product: WASendableProduct + businessOwnerJid?: string + body?: string + footer?: string + } +) & ViewOnce + +export type AnyMessageContent = AnyRegularMessageContent | { + forward: WAMessage + force?: boolean +} | { + /** Delete your message or anyone's message in a group (admin required) */ + delete: WAMessageKey +} | { + disappearingMessagesInChat: boolean | number +} + +export type GroupMetadataParticipants = Pick + +type MinimalRelayOptions = { + /** override the message ID with a custom provided string */ + messageId?: string + /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */ + cachedGroupMetadata?: (jid: string) => Promise +} + +export type MessageRelayOptions = MinimalRelayOptions & { + /** only send to a specific participant; used when a message decryption fails for a single user */ + participant?: { jid: string, count: number } + /** additional attributes to add to the WA binary node */ + additionalAttributes?: { [_: string]: string } + /** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */ + useUserDevicesCache?: boolean +} + +export type MiscMessageGenerationOptions = MinimalRelayOptions & { + /** optional, if you want to manually set the timestamp of the message */ + timestamp?: Date + /** the message you want to quote */ + quoted?: WAMessage + /** disappearing messages settings */ + ephemeralExpiration?: number | string + /** timeout for media upload to WA server */ + mediaUploadTimeoutMs?: number +} +export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & { + userJid: string +} + +export type WAMediaUploadFunction = (readStream: Readable, opts: { fileEncSha256B64: string, mediaType: MediaType, timeoutMs?: number }) => Promise<{ mediaUrl: string, directPath: string }> + +export type MediaGenerationOptions = { + logger?: Logger + mediaTypeOverride?: MediaType + upload: WAMediaUploadFunction + /** cache media so it does not have to be uploaded again */ + mediaCache?: CacheStore + + mediaUploadTimeoutMs?: number + + options?: AxiosRequestConfig +} +export type MessageContentGenerationOptions = MediaGenerationOptions & { + getUrlInfo?: (text: string) => Promise +} +export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent + +/** + * Type of message upsert + * 1. notify => notify the user, this message was just received + * 2. append => append the message to the chat history, no notification required + */ +export type MessageUpsertType = 'append' | 'notify' + +export type MessageUserReceipt = proto.IUserReceipt + +export type WAMessageUpdate = { update: Partial, key: proto.IMessageKey } + +export type WAMessageCursor = { before: WAMessageKey | undefined } | { after: WAMessageKey | undefined } + +export type MessageUserReceiptUpdate = { key: proto.IMessageKey, receipt: MessageUserReceipt } + +export type MediaDecryptionKeyInfo = { + iv: Buffer + cipherKey: Buffer + macKey?: Buffer +} + +export type MinimalMessage = Pick diff --git a/src/Types/Product.ts b/src/Types/Product.ts new file mode 100644 index 00000000000..2f51b1ca963 --- /dev/null +++ b/src/Types/Product.ts @@ -0,0 +1,85 @@ +import { WAMediaUpload } from './Message' + +export type CatalogResult = { + data: { + paging: { cursors: { before: string, after: string } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + data: any[] + } +} + +export type ProductCreateResult = { + data: { product: {} } +} + +export type CatalogStatus = { + status: string + canAppeal: boolean +} + +export type CatalogCollection = { + id: string + name: string + products: Product[] + + status: CatalogStatus +} + +export type ProductAvailability = 'in stock' + +export type ProductBase = { + name: string + retailerId?: string + url?: string + description: string + price: number + currency: string + isHidden?: boolean +} + +export type ProductCreate = ProductBase & { + /** ISO country code for product origin. Set to undefined for no country */ + originCountryCode: string | undefined + /** images of the product */ + images: WAMediaUpload[] +} + +export type ProductUpdate = Omit + +export type Product = ProductBase & { + id: string + imageUrls: { [_: string]: string } + reviewStatus: { [_: string]: string } + availability: ProductAvailability +} + +export type OrderPrice = { + currency: string + total: number +} + +export type OrderProduct = { + id: string + imageUrl: string + name: string + quantity: number + + currency: string + price: number +} + +export type OrderDetails = { + price: OrderPrice + products: OrderProduct[] +} + +export type CatalogCursor = string + +export type GetCatalogOptions = { + /** cursor to start from */ + cursor?: CatalogCursor + /** number of products to fetch */ + limit?: number + + jid?: string +} \ No newline at end of file diff --git a/src/Types/Signal.ts b/src/Types/Signal.ts new file mode 100644 index 00000000000..12b8e5ccce1 --- /dev/null +++ b/src/Types/Signal.ts @@ -0,0 +1,68 @@ +import { proto } from '../../WAProto' + +type DecryptGroupSignalOpts = { + group: string + authorJid: string + msg: Uint8Array +} + +type ProcessSenderKeyDistributionMessageOpts = { + item: proto.Message.ISenderKeyDistributionMessage + authorJid: string +} + +type DecryptSignalProtoOpts = { + jid: string + type: 'pkmsg' | 'msg' + ciphertext: Uint8Array +} + +type EncryptMessageOpts = { + jid: string + data: Uint8Array +} + +type EncryptGroupMessageOpts = { + group: string + data: Uint8Array + meId: string +} + +type PreKey = { + keyId: number + publicKey: Uint8Array +} + +type SignedPreKey = PreKey & { + signature: Uint8Array +} + +type E2ESession = { + registrationId: number + identityKey: Uint8Array + signedPreKey: SignedPreKey + preKey: PreKey +} + +type E2ESessionOpts = { + jid: string + session: E2ESession +} + +export type SignalRepository = { + decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise + processSenderKeyDistributionMessage( + opts: ProcessSenderKeyDistributionMessageOpts + ): Promise + decryptMessage(opts: DecryptSignalProtoOpts): Promise + encryptMessage(opts: EncryptMessageOpts): Promise<{ + type: 'pkmsg' | 'msg' + ciphertext: Uint8Array + }> + encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{ + senderKeyDistributionMessage: Uint8Array + ciphertext: Uint8Array + }> + injectE2ESession(opts: E2ESessionOpts): Promise + jidToSignalProtocolAddress(jid: string): string +} \ No newline at end of file diff --git a/src/Types/Socket.ts b/src/Types/Socket.ts new file mode 100644 index 00000000000..42edaa7b063 --- /dev/null +++ b/src/Types/Socket.ts @@ -0,0 +1,116 @@ + +import { AxiosRequestConfig } from 'axios' +import type { Agent } from 'https' +import type { Logger } from 'pino' +import type { URL } from 'url' +import { proto } from '../../WAProto' +import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth' +import { MediaConnInfo } from './Message' +import { SignalRepository } from './Signal' + +export type WAVersion = [number, number, number] +export type WABrowserDescription = [string, string, string] + +export type CacheStore = { + /** get a cached key and change the stats */ + get(key: string): T | undefined + /** set a key in the cache */ + set(key: string, value: T): void + /** delete a key from the cache */ + del(key: string): void + /** flush all data */ + flushAll(): void +} + +export type SocketConfig = { + /** the WS url to connect to WA */ + waWebSocketUrl: string | URL + /** Fails the connection if the socket times out in this interval */ + connectTimeoutMs: number + /** Default timeout for queries, undefined for no timeout */ + defaultQueryTimeoutMs: number | undefined + /** ping-pong interval for WS connection */ + keepAliveIntervalMs: number + /** proxy agent */ + agent?: Agent + /** pino logger */ + logger: Logger + /** version to connect with */ + version: WAVersion + /** override browser config */ + browser: WABrowserDescription + /** agent used for fetch requests -- uploading/downloading media */ + fetchAgent?: Agent + /** should the QR be printed in the terminal */ + printQRInTerminal: boolean + /** should events be emitted for actions done by this socket connection */ + emitOwnEvents: boolean + /** custom upload hosts to upload media to */ + customUploadHosts: MediaConnInfo['hosts'] + /** time to wait between sending new retry requests */ + retryRequestDelayMs: number + /** time to wait for the generation of the next QR in ms */ + qrTimeout?: number + /** provide an auth state object to maintain the auth state */ + auth: AuthenticationState + /** manage history processing with this control; by default will sync up everything */ + shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => boolean + /** transaction capability options for SignalKeyStore */ + transactionOpts: TransactionCapabilityOptions + /** marks the client as online whenever the socket successfully connects */ + markOnlineOnConnect: boolean + + /** provide a cache to store media, so does not have to be re-uploaded */ + mediaCache?: CacheStore + /** + * map to store the retry counts for failed messages; + * used to determine whether to retry a message or not */ + msgRetryCounterCache?: CacheStore + /** provide a cache to store a user's device list */ + userDevicesCache?: CacheStore + /** cache to store call offers */ + callOfferCache?: CacheStore + /** width for link preview images */ + linkPreviewImageThumbnailWidth: number + /** Should Baileys ask the phone for full history, will be received async */ + syncFullHistory: boolean + /** Should baileys fire init queries automatically, default true */ + fireInitQueries: boolean + /** + * generate a high quality link preview, + * entails uploading the jpegThumbnail to WA + * */ + generateHighQualityLinkPreview: boolean + + /** + * Returns if a jid should be ignored, + * no event for that jid will be triggered. + * Messages from that jid will also not be decrypted + * */ + shouldIgnoreJid: (jid: string) => boolean | undefined + + /** + * Optionally patch the message before sending out + * */ + patchMessageBeforeSending: ( + msg: proto.IMessage, + recipientJids: string[], + ) => Promise | proto.IMessage + + /** verify app state MACs */ + appStateMacVerification: { + patch: boolean + snapshot: boolean + } + + /** options for axios */ + options: AxiosRequestConfig<{}> + /** + * fetch a message from your store + * implement this so that messages failed to send + * (solves the "this message can take a while" issue) can be retried + * */ + getMessage: (key: proto.IMessageKey) => Promise + + makeSignalRepository: (auth: SignalAuthState) => SignalRepository +} diff --git a/src/Types/State.ts b/src/Types/State.ts new file mode 100644 index 00000000000..53c39b649b0 --- /dev/null +++ b/src/Types/State.ts @@ -0,0 +1,29 @@ +import { Contact } from './Contact' + +export type WAConnectionState = 'open' | 'connecting' | 'close' + +export type ConnectionState = { + /** connection is now open, connecting or closed */ + connection: WAConnectionState + /** the error that caused the connection to close */ + lastDisconnect?: { + error: Error | undefined + date: Date + } + /** is this a new login */ + isNewLogin?: boolean + /** the current QR code */ + qr?: string + /** has the device received all pending notifications while it was offline */ + receivedPendingNotifications?: boolean + /** legacy connection options */ + legacy?: { + phoneConnected: boolean + user?: Contact + } + /** + * if the client is shown as an active, online client. + * If this is false, the primary phone and other devices will receive notifs + * */ + isOnline?: boolean +} \ No newline at end of file diff --git a/src/Types/index.ts b/src/Types/index.ts new file mode 100644 index 00000000000..213fdf93822 --- /dev/null +++ b/src/Types/index.ts @@ -0,0 +1,56 @@ +export * from './Auth' +export * from './GroupMetadata' +export * from './Chat' +export * from './Contact' +export * from './State' +export * from './Message' +export * from './Socket' +export * from './Events' +export * from './Product' +export * from './Call' +export * from './Signal' + +import { AuthenticationState } from './Auth' +import { SocketConfig } from './Socket' + +export type UserFacingSocketConfig = Partial & { auth: AuthenticationState } + +export enum DisconnectReason { + connectionClosed = 428, + connectionLost = 408, + connectionReplaced = 440, + timedOut = 408, + loggedOut = 401, + badSession = 500, + restartRequired = 515, + multideviceMismatch = 411 +} + +export type WAInitResponse = { + ref: string + ttl: number + status: 200 +} + +export type WABusinessHoursConfig = { + day_of_week: string + mode: string + open_time?: number + close_time?: number +} + +export type WABusinessProfile = { + description: string + email: string | undefined + business_hours: { + timezone?: string + config?: WABusinessHoursConfig[] + business_config?: WABusinessHoursConfig[] + } + website: string[] + category?: string + wid?: string + address?: string +} + +export type CurveKeyPair = { private: Uint8Array, public: Uint8Array } \ No newline at end of file diff --git a/src/Utils/auth-utils.ts b/src/Utils/auth-utils.ts new file mode 100644 index 00000000000..4f41e1273ae --- /dev/null +++ b/src/Utils/auth-utils.ts @@ -0,0 +1,210 @@ +import { randomBytes } from 'crypto' +import NodeCache from 'node-cache' +import type { Logger } from 'pino' +import { DEFAULT_CACHE_TTLS } from '../Defaults' +import type { AuthenticationCreds, CacheStore, SignalDataSet, SignalDataTypeMap, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types' +import { Curve, signedKeyPair } from './crypto' +import { delay, generateRegistrationId } from './generics' + +/** + * Adds caching capability to a SignalKeyStore + * @param store the store to add caching to + * @param logger to log trace events + * @param _cache cache store to use + */ +export function makeCacheableSignalKeyStore( + store: SignalKeyStore, + logger: Logger, + _cache?: CacheStore +): SignalKeyStore { + const cache = _cache || new NodeCache({ + stdTTL: DEFAULT_CACHE_TTLS.SIGNAL_STORE, // 5 minutes + useClones: false, + deleteOnExpire: true, + }) + + function getUniqueId(type: string, id: string) { + return `${type}.${id}` + } + + return { + async get(type, ids) { + const data: { [_: string]: SignalDataTypeMap[typeof type] } = { } + const idsToFetch: string[] = [] + for(const id of ids) { + const item = cache.get(getUniqueId(type, id)) + if(typeof item !== 'undefined') { + data[id] = item + } else { + idsToFetch.push(id) + } + } + + if(idsToFetch.length) { + logger.trace({ items: idsToFetch.length }, 'loading from store') + const fetched = await store.get(type, idsToFetch) + for(const id of idsToFetch) { + const item = fetched[id] + if(item) { + data[id] = item + cache.set(getUniqueId(type, id), item) + } + } + } + + return data + }, + async set(data) { + let keys = 0 + for(const type in data) { + for(const id in data[type]) { + cache.set(getUniqueId(type, id), data[type][id]) + keys += 1 + } + } + + logger.trace({ keys }, 'updated cache') + + await store.set(data) + }, + async clear() { + cache.flushAll() + await store.clear?.() + } + } +} + +/** + * Adds DB like transaction capability (https://en.wikipedia.org/wiki/Database_transaction) to the SignalKeyStore, + * this allows batch read & write operations & improves the performance of the lib + * @param state the key store to apply this capability to + * @param logger logger to log events + * @returns SignalKeyStore with transaction capability + */ +export const addTransactionCapability = ( + state: SignalKeyStore, + logger: Logger, + { maxCommitRetries, delayBetweenTriesMs }: TransactionCapabilityOptions +): SignalKeyStoreWithTransaction => { + // number of queries made to the DB during the transaction + // only there for logging purposes + let dbQueriesInTransaction = 0 + let transactionCache: SignalDataSet = { } + let mutations: SignalDataSet = { } + + let transactionsInProgress = 0 + + return { + get: async(type, ids) => { + if(isInTransaction()) { + const dict = transactionCache[type] + const idsRequiringFetch = dict + ? ids.filter(item => typeof dict[item] === 'undefined') + : ids + // only fetch if there are any items to fetch + if(idsRequiringFetch.length) { + dbQueriesInTransaction += 1 + const result = await state.get(type, idsRequiringFetch) + + transactionCache[type] ||= {} + Object.assign( + transactionCache[type]!, + result + ) + } + + return ids.reduce( + (dict, id) => { + const value = transactionCache[type]?.[id] + if(value) { + dict[id] = value + } + + return dict + }, { } + ) + } else { + return state.get(type, ids) + } + }, + set: data => { + if(isInTransaction()) { + logger.trace({ types: Object.keys(data) }, 'caching in transaction') + for(const key in data) { + transactionCache[key] = transactionCache[key] || { } + Object.assign(transactionCache[key], data[key]) + + mutations[key] = mutations[key] || { } + Object.assign(mutations[key], data[key]) + } + } else { + return state.set(data) + } + }, + isInTransaction, + async transaction(work) { + let result: Awaited> + transactionsInProgress += 1 + if(transactionsInProgress === 1) { + logger.trace('entering transaction') + } + + try { + result = await work() + // commit if this is the outermost transaction + if(transactionsInProgress === 1) { + if(Object.keys(mutations).length) { + logger.trace('committing transaction') + // retry mechanism to ensure we've some recovery + // in case a transaction fails in the first attempt + let tries = maxCommitRetries + while(tries) { + tries -= 1 + try { + await state.set(mutations) + logger.trace({ dbQueriesInTransaction }, 'committed transaction') + break + } catch(error) { + logger.warn(`failed to commit ${Object.keys(mutations).length} mutations, tries left=${tries}`) + await delay(delayBetweenTriesMs) + } + } + } else { + logger.trace('no mutations in transaction') + } + } + } finally { + transactionsInProgress -= 1 + if(transactionsInProgress === 0) { + transactionCache = { } + mutations = { } + dbQueriesInTransaction = 0 + } + } + + return result + } + } + + function isInTransaction() { + return transactionsInProgress > 0 + } +} + +export const initAuthCreds = (): AuthenticationCreds => { + const identityKey = Curve.generateKeyPair() + return { + noiseKey: Curve.generateKeyPair(), + signedIdentityKey: identityKey, + signedPreKey: signedKeyPair(identityKey, 1), + registrationId: generateRegistrationId(), + advSecretKey: randomBytes(32).toString('base64'), + processedHistoryMessages: [], + nextPreKeyId: 1, + firstUnuploadedPreKeyId: 1, + accountSyncCounter: 0, + accountSettings: { + unarchiveChats: false + } + } +} \ No newline at end of file diff --git a/src/Utils/baileys-event-stream.ts b/src/Utils/baileys-event-stream.ts new file mode 100644 index 00000000000..26fa610b02f --- /dev/null +++ b/src/Utils/baileys-event-stream.ts @@ -0,0 +1,66 @@ +import EventEmitter from 'events' +import { createReadStream } from 'fs' +import { writeFile } from 'fs/promises' +import { createInterface } from 'readline' +import type { BaileysEventEmitter } from '../Types' +import { delay } from './generics' +import { makeMutex } from './make-mutex' + +/** + * Captures events from a baileys event emitter & stores them in a file + * @param ev The event emitter to read events from + * @param filename File to save to + */ +export const captureEventStream = (ev: BaileysEventEmitter, filename: string) => { + const oldEmit = ev.emit + // write mutex so data is appended in order + const writeMutex = makeMutex() + // monkey patch eventemitter to capture all events + ev.emit = function(...args: any[]) { + const content = JSON.stringify({ timestamp: Date.now(), event: args[0], data: args[1] }) + '\n' + const result = oldEmit.apply(ev, args) + + writeMutex.mutex( + async() => { + await writeFile(filename, content, { flag: 'a' }) + } + ) + + return result + } +} + +/** + * Read event file and emit events from there + * @param filename filename containing event data + * @param delayIntervalMs delay between each event emit + */ +export const readAndEmitEventStream = (filename: string, delayIntervalMs: number = 0) => { + const ev = new EventEmitter() as BaileysEventEmitter + + const fireEvents = async() => { + // from: https://stackoverflow.com/questions/6156501/read-a-file-one-line-at-a-time-in-node-js + const fileStream = createReadStream(filename) + + const rl = createInterface({ + input: fileStream, + crlfDelay: Infinity + }) + // Note: we use the crlfDelay option to recognize all instances of CR LF + // ('\r\n') in input.txt as a single line break. + for await (const line of rl) { + if(line) { + const { event, data } = JSON.parse(line) + ev.emit(event, data) + delayIntervalMs && await delay(delayIntervalMs) + } + } + + fileStream.close() + } + + return { + ev, + task: fireEvents() + } +} \ No newline at end of file diff --git a/src/Utils/business.ts b/src/Utils/business.ts new file mode 100644 index 00000000000..57459a55f1e --- /dev/null +++ b/src/Utils/business.ts @@ -0,0 +1,275 @@ +import { Boom } from '@hapi/boom' +import { createHash } from 'crypto' +import { CatalogCollection, CatalogStatus, OrderDetails, OrderProduct, Product, ProductCreate, ProductUpdate, WAMediaUpload, WAMediaUploadFunction } from '../Types' +import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString } from '../WABinary' +import { getStream, getUrlFromDirectPath, toReadable } from './messages-media' + +export const parseCatalogNode = (node: BinaryNode) => { + const catalogNode = getBinaryNodeChild(node, 'product_catalog') + const products = getBinaryNodeChildren(catalogNode, 'product').map(parseProductNode) + const paging = getBinaryNodeChild(catalogNode, 'paging') + + return { + products, + nextPageCursor: paging + ? getBinaryNodeChildString(paging, 'after') + : undefined + } +} + +export const parseCollectionsNode = (node: BinaryNode) => { + const collectionsNode = getBinaryNodeChild(node, 'collections') + const collections = getBinaryNodeChildren(collectionsNode, 'collection').map( + collectionNode => { + const id = getBinaryNodeChildString(collectionNode, 'id')! + const name = getBinaryNodeChildString(collectionNode, 'name')! + + const products = getBinaryNodeChildren(collectionNode, 'product').map(parseProductNode) + return { + id, + name, + products, + status: parseStatusInfo(collectionNode) + } + } + ) + + return { + collections + } +} + +export const parseOrderDetailsNode = (node: BinaryNode) => { + const orderNode = getBinaryNodeChild(node, 'order') + const products = getBinaryNodeChildren(orderNode, 'product').map( + productNode => { + const imageNode = getBinaryNodeChild(productNode, 'image')! + return { + id: getBinaryNodeChildString(productNode, 'id')!, + name: getBinaryNodeChildString(productNode, 'name')!, + imageUrl: getBinaryNodeChildString(imageNode, 'url')!, + price: +getBinaryNodeChildString(productNode, 'price')!, + currency: getBinaryNodeChildString(productNode, 'currency')!, + quantity: +getBinaryNodeChildString(productNode, 'quantity')! + } + } + ) + + const priceNode = getBinaryNodeChild(orderNode, 'price') + + const orderDetails: OrderDetails = { + price: { + total: +getBinaryNodeChildString(priceNode, 'total')!, + currency: getBinaryNodeChildString(priceNode, 'currency')!, + }, + products + } + + return orderDetails +} + +export const toProductNode = (productId: string | undefined, product: ProductCreate | ProductUpdate) => { + const attrs: BinaryNode['attrs'] = { } + const content: BinaryNode[] = [ ] + + if(typeof productId !== 'undefined') { + content.push({ + tag: 'id', + attrs: { }, + content: Buffer.from(productId) + }) + } + + if(typeof product.name !== 'undefined') { + content.push({ + tag: 'name', + attrs: { }, + content: Buffer.from(product.name) + }) + } + + if(typeof product.description !== 'undefined') { + content.push({ + tag: 'description', + attrs: { }, + content: Buffer.from(product.description) + }) + } + + if(typeof product.retailerId !== 'undefined') { + content.push({ + tag: 'retailer_id', + attrs: { }, + content: Buffer.from(product.retailerId) + }) + } + + if(product.images.length) { + content.push({ + tag: 'media', + attrs: { }, + content: product.images.map( + img => { + if(!('url' in img)) { + throw new Boom('Expected img for product to already be uploaded', { statusCode: 400 }) + } + + return { + tag: 'image', + attrs: { }, + content: [ + { + tag: 'url', + attrs: { }, + content: Buffer.from(img.url.toString()) + } + ] + } + } + ) + }) + } + + if(typeof product.price !== 'undefined') { + content.push({ + tag: 'price', + attrs: { }, + content: Buffer.from(product.price.toString()) + }) + } + + if(typeof product.currency !== 'undefined') { + content.push({ + tag: 'currency', + attrs: { }, + content: Buffer.from(product.currency) + }) + } + + if('originCountryCode' in product) { + if(typeof product.originCountryCode === 'undefined') { + attrs['compliance_category'] = 'COUNTRY_ORIGIN_EXEMPT' + } else { + content.push({ + tag: 'compliance_info', + attrs: { }, + content: [ + { + tag: 'country_code_origin', + attrs: { }, + content: Buffer.from(product.originCountryCode) + } + ] + }) + } + } + + + if(typeof product.isHidden !== 'undefined') { + attrs['is_hidden'] = product.isHidden.toString() + } + + const node: BinaryNode = { + tag: 'product', + attrs, + content + } + return node +} + +export const parseProductNode = (productNode: BinaryNode) => { + const isHidden = productNode.attrs.is_hidden === 'true' + const id = getBinaryNodeChildString(productNode, 'id')! + + const mediaNode = getBinaryNodeChild(productNode, 'media')! + const statusInfoNode = getBinaryNodeChild(productNode, 'status_info')! + + const product: Product = { + id, + imageUrls: parseImageUrls(mediaNode), + reviewStatus: { + whatsapp: getBinaryNodeChildString(statusInfoNode, 'status')!, + }, + availability: 'in stock', + name: getBinaryNodeChildString(productNode, 'name')!, + retailerId: getBinaryNodeChildString(productNode, 'retailer_id'), + url: getBinaryNodeChildString(productNode, 'url'), + description: getBinaryNodeChildString(productNode, 'description')!, + price: +getBinaryNodeChildString(productNode, 'price')!, + currency: getBinaryNodeChildString(productNode, 'currency')!, + isHidden, + } + + return product +} + +/** + * Uploads images not already uploaded to WA's servers + */ +export async function uploadingNecessaryImagesOfProduct(product: T, waUploadToServer: WAMediaUploadFunction, timeoutMs = 30_000) { + product = { + ...product, + images: product.images ? await uploadingNecessaryImages(product.images, waUploadToServer, timeoutMs) : product.images + } + return product +} + +/** + * Uploads images not already uploaded to WA's servers + */ +export const uploadingNecessaryImages = async( + images: WAMediaUpload[], + waUploadToServer: WAMediaUploadFunction, + timeoutMs = 30_000 +) => { + const results = await Promise.all( + images.map>( + async img => { + + if('url' in img) { + const url = img.url.toString() + if(url.includes('.whatsapp.net')) { + return { url } + } + } + + const { stream } = await getStream(img) + const hasher = createHash('sha256') + const contentBlocks: Buffer[] = [] + for await (const block of stream) { + hasher.update(block) + contentBlocks.push(block) + } + + const sha = hasher.digest('base64') + + const { directPath } = await waUploadToServer( + toReadable(Buffer.concat(contentBlocks)), + { + mediaType: 'product-catalog-image', + fileEncSha256B64: sha, + timeoutMs + } + ) + return { url: getUrlFromDirectPath(directPath) } + } + ) + ) + return results +} + +const parseImageUrls = (mediaNode: BinaryNode) => { + const imgNode = getBinaryNodeChild(mediaNode, 'image') + return { + requested: getBinaryNodeChildString(imgNode, 'request_image_url')!, + original: getBinaryNodeChildString(imgNode, 'original_image_url')! + } +} + +const parseStatusInfo = (mediaNode: BinaryNode): CatalogStatus => { + const node = getBinaryNodeChild(mediaNode, 'status_info') + return { + status: getBinaryNodeChildString(node, 'status')!, + canAppeal: getBinaryNodeChildString(node, 'can_appeal') === 'true', + } +} \ No newline at end of file diff --git a/src/Utils/chat-utils.ts b/src/Utils/chat-utils.ts new file mode 100644 index 00000000000..2ce6695327a --- /dev/null +++ b/src/Utils/chat-utils.ts @@ -0,0 +1,754 @@ +import { Boom } from '@hapi/boom' +import { AxiosRequestConfig } from 'axios' +import type { Logger } from 'pino' +import { proto } from '../../WAProto' +import { BaileysEventEmitter, Chat, ChatModification, ChatMutation, ChatUpdate, Contact, InitialAppStateSyncOptions, LastMessageList, LTHashState, WAPatchCreate, WAPatchName } from '../Types' +import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, isJidGroup, jidNormalizedUser } from '../WABinary' +import { aesDecrypt, aesEncrypt, hkdf, hmacSign } from './crypto' +import { toNumber } from './generics' +import { LT_HASH_ANTI_TAMPERING } from './lt-hash' +import { downloadContentFromMessage, } from './messages-media' + +type FetchAppStateSyncKey = (keyId: string) => Promise + +export type ChatMutationMap = { [index: string]: ChatMutation } + +const mutationKeys = (keydata: Uint8Array) => { + const expanded = hkdf(keydata, 160, { info: 'WhatsApp Mutation Keys' }) + return { + indexKey: expanded.slice(0, 32), + valueEncryptionKey: expanded.slice(32, 64), + valueMacKey: expanded.slice(64, 96), + snapshotMacKey: expanded.slice(96, 128), + patchMacKey: expanded.slice(128, 160) + } +} + +const generateMac = (operation: proto.SyncdMutation.SyncdOperation, data: Buffer, keyId: Uint8Array | string, key: Buffer) => { + const getKeyData = () => { + let r: number + switch (operation) { + case proto.SyncdMutation.SyncdOperation.SET: + r = 0x01 + break + case proto.SyncdMutation.SyncdOperation.REMOVE: + r = 0x02 + break + } + + const buff = Buffer.from([r]) + return Buffer.concat([ buff, Buffer.from(keyId as any, 'base64') ]) + } + + const keyData = getKeyData() + + const last = Buffer.alloc(8) // 8 bytes + last.set([ keyData.length ], last.length - 1) + + const total = Buffer.concat([ keyData, data, last ]) + const hmac = hmacSign(total, key, 'sha512') + + return hmac.slice(0, 32) +} + +const to64BitNetworkOrder = (e: number) => { + const buff = Buffer.alloc(8) + buff.writeUint32BE(e, 4) + return buff +} + +type Mac = { indexMac: Uint8Array, valueMac: Uint8Array, operation: proto.SyncdMutation.SyncdOperation } + +const makeLtHashGenerator = ({ indexValueMap, hash }: Pick) => { + indexValueMap = { ...indexValueMap } + const addBuffs: ArrayBuffer[] = [] + const subBuffs: ArrayBuffer[] = [] + + return { + mix: ({ indexMac, valueMac, operation }: Mac) => { + const indexMacBase64 = Buffer.from(indexMac).toString('base64') + const prevOp = indexValueMap[indexMacBase64] + if(operation === proto.SyncdMutation.SyncdOperation.REMOVE) { + if(!prevOp) { + throw new Boom('tried remove, but no previous op', { data: { indexMac, valueMac } }) + } + + // remove from index value mac, since this mutation is erased + delete indexValueMap[indexMacBase64] + } else { + addBuffs.push(new Uint8Array(valueMac).buffer) + // add this index into the history map + indexValueMap[indexMacBase64] = { valueMac } + } + + if(prevOp) { + subBuffs.push(new Uint8Array(prevOp.valueMac).buffer) + } + }, + finish: () => { + const hashArrayBuffer = new Uint8Array(hash).buffer + const result = LT_HASH_ANTI_TAMPERING.subtractThenAdd(hashArrayBuffer, addBuffs, subBuffs) + const buffer = Buffer.from(result) + + return { + hash: buffer, + indexValueMap + } + } + } +} + +const generateSnapshotMac = (lthash: Uint8Array, version: number, name: WAPatchName, key: Buffer) => { + const total = Buffer.concat([ + lthash, + to64BitNetworkOrder(version), + Buffer.from(name, 'utf-8') + ]) + return hmacSign(total, key, 'sha256') +} + +const generatePatchMac = (snapshotMac: Uint8Array, valueMacs: Uint8Array[], version: number, type: WAPatchName, key: Buffer) => { + const total = Buffer.concat([ + snapshotMac, + ...valueMacs, + to64BitNetworkOrder(version), + Buffer.from(type, 'utf-8') + ]) + return hmacSign(total, key) +} + +export const newLTHashState = (): LTHashState => ({ version: 0, hash: Buffer.alloc(128), indexValueMap: {} }) + +export const encodeSyncdPatch = async( + { type, index, syncAction, apiVersion, operation }: WAPatchCreate, + myAppStateKeyId: string, + state: LTHashState, + getAppStateSyncKey: FetchAppStateSyncKey +) => { + const key = !!myAppStateKeyId ? await getAppStateSyncKey(myAppStateKeyId) : undefined + if(!key) { + throw new Boom(`myAppStateKey ("${myAppStateKeyId}") not present`, { statusCode: 404 }) + } + + const encKeyId = Buffer.from(myAppStateKeyId, 'base64') + + state = { ...state, indexValueMap: { ...state.indexValueMap } } + + const indexBuffer = Buffer.from(JSON.stringify(index)) + const dataProto = proto.SyncActionData.fromObject({ + index: indexBuffer, + value: syncAction, + padding: new Uint8Array(0), + version: apiVersion + }) + const encoded = proto.SyncActionData.encode(dataProto).finish() + + const keyValue = mutationKeys(key!.keyData!) + + const encValue = aesEncrypt(encoded, keyValue.valueEncryptionKey) + const valueMac = generateMac(operation, encValue, encKeyId, keyValue.valueMacKey) + const indexMac = hmacSign(indexBuffer, keyValue.indexKey) + + // update LT hash + const generator = makeLtHashGenerator(state) + generator.mix({ indexMac, valueMac, operation }) + Object.assign(state, generator.finish()) + + state.version += 1 + + const snapshotMac = generateSnapshotMac(state.hash, state.version, type, keyValue.snapshotMacKey) + + const patch: proto.ISyncdPatch = { + patchMac: generatePatchMac(snapshotMac, [valueMac], state.version, type, keyValue.patchMacKey), + snapshotMac: snapshotMac, + keyId: { id: encKeyId }, + mutations: [ + { + operation: operation, + record: { + index: { + blob: indexMac + }, + value: { + blob: Buffer.concat([ encValue, valueMac ]) + }, + keyId: { id: encKeyId } + } + } + ] + } + + const base64Index = indexMac.toString('base64') + state.indexValueMap[base64Index] = { valueMac } + + return { patch, state } +} + +export const decodeSyncdMutations = async( + msgMutations: (proto.ISyncdMutation | proto.ISyncdRecord)[], + initialState: LTHashState, + getAppStateSyncKey: FetchAppStateSyncKey, + onMutation: (mutation: ChatMutation) => void, + validateMacs: boolean +) => { + const ltGenerator = makeLtHashGenerator(initialState) + // indexKey used to HMAC sign record.index.blob + // valueEncryptionKey used to AES-256-CBC encrypt record.value.blob[0:-32] + // the remaining record.value.blob[0:-32] is the mac, it the HMAC sign of key.keyId + decoded proto data + length of bytes in keyId + for(const msgMutation of msgMutations!) { + // if it's a syncdmutation, get the operation property + // otherwise, if it's only a record -- it'll be a SET mutation + const operation = 'operation' in msgMutation ? msgMutation.operation : proto.SyncdMutation.SyncdOperation.SET + const record = ('record' in msgMutation && !!msgMutation.record) ? msgMutation.record : msgMutation as proto.ISyncdRecord + + const key = await getKey(record.keyId!.id!) + const content = Buffer.from(record.value!.blob!) + const encContent = content.slice(0, -32) + const ogValueMac = content.slice(-32) + if(validateMacs) { + const contentHmac = generateMac(operation!, encContent, record.keyId!.id!, key.valueMacKey) + if(Buffer.compare(contentHmac, ogValueMac) !== 0) { + throw new Boom('HMAC content verification failed') + } + } + + const result = aesDecrypt(encContent, key.valueEncryptionKey) + const syncAction = proto.SyncActionData.decode(result) + + if(validateMacs) { + const hmac = hmacSign(syncAction.index, key.indexKey) + if(Buffer.compare(hmac, record.index!.blob!) !== 0) { + throw new Boom('HMAC index verification failed') + } + } + + const indexStr = Buffer.from(syncAction.index).toString() + onMutation({ syncAction, index: JSON.parse(indexStr) }) + + ltGenerator.mix({ + indexMac: record.index!.blob!, + valueMac: ogValueMac, + operation: operation! + }) + } + + return ltGenerator.finish() + + async function getKey(keyId: Uint8Array) { + const base64Key = Buffer.from(keyId!).toString('base64') + const keyEnc = await getAppStateSyncKey(base64Key) + if(!keyEnc) { + throw new Boom(`failed to find key "${base64Key}" to decode mutation`, { statusCode: 404, data: { msgMutations } }) + } + + return mutationKeys(keyEnc.keyData!) + } +} + +export const decodeSyncdPatch = async( + msg: proto.ISyncdPatch, + name: WAPatchName, + initialState: LTHashState, + getAppStateSyncKey: FetchAppStateSyncKey, + onMutation: (mutation: ChatMutation) => void, + validateMacs: boolean +) => { + if(validateMacs) { + const base64Key = Buffer.from(msg.keyId!.id!).toString('base64') + const mainKeyObj = await getAppStateSyncKey(base64Key) + if(!mainKeyObj) { + throw new Boom(`failed to find key "${base64Key}" to decode patch`, { statusCode: 404, data: { msg } }) + } + + const mainKey = mutationKeys(mainKeyObj.keyData!) + const mutationmacs = msg.mutations!.map(mutation => mutation.record!.value!.blob!.slice(-32)) + + const patchMac = generatePatchMac(msg.snapshotMac!, mutationmacs, toNumber(msg.version!.version!), name, mainKey.patchMacKey) + if(Buffer.compare(patchMac, msg.patchMac!) !== 0) { + throw new Boom('Invalid patch mac') + } + } + + const result = await decodeSyncdMutations(msg!.mutations!, initialState, getAppStateSyncKey, onMutation, validateMacs) + return result +} + +export const extractSyncdPatches = async( + result: BinaryNode, + options: AxiosRequestConfig +) => { + const syncNode = getBinaryNodeChild(result, 'sync') + const collectionNodes = getBinaryNodeChildren(syncNode, 'collection') + + const final = { } as { [T in WAPatchName]: { patches: proto.ISyncdPatch[], hasMorePatches: boolean, snapshot?: proto.ISyncdSnapshot } } + await Promise.all( + collectionNodes.map( + async collectionNode => { + const patchesNode = getBinaryNodeChild(collectionNode, 'patches') + + const patches = getBinaryNodeChildren(patchesNode || collectionNode, 'patch') + const snapshotNode = getBinaryNodeChild(collectionNode, 'snapshot') + + const syncds: proto.ISyncdPatch[] = [] + const name = collectionNode.attrs.name as WAPatchName + + const hasMorePatches = collectionNode.attrs.has_more_patches === 'true' + + let snapshot: proto.ISyncdSnapshot | undefined = undefined + if(snapshotNode && !!snapshotNode.content) { + if(!Buffer.isBuffer(snapshotNode)) { + snapshotNode.content = Buffer.from(Object.values(snapshotNode.content)) + } + + const blobRef = proto.ExternalBlobReference.decode( + snapshotNode.content! as Buffer + ) + const data = await downloadExternalBlob(blobRef, options) + snapshot = proto.SyncdSnapshot.decode(data) + } + + for(let { content } of patches) { + if(content) { + if(!Buffer.isBuffer(content)) { + content = Buffer.from(Object.values(content)) + } + + const syncd = proto.SyncdPatch.decode(content! as Uint8Array) + if(!syncd.version) { + syncd.version = { version: +collectionNode.attrs.version + 1 } + } + + syncds.push(syncd) + } + } + + final[name] = { patches: syncds, hasMorePatches, snapshot } + } + ) + ) + + return final +} + + +export const downloadExternalBlob = async( + blob: proto.IExternalBlobReference, + options: AxiosRequestConfig +) => { + const stream = await downloadContentFromMessage(blob, 'md-app-state', { options }) + const bufferArray: Buffer[] = [] + for await (const chunk of stream) { + bufferArray.push(chunk) + } + + return Buffer.concat(bufferArray) +} + +export const downloadExternalPatch = async( + blob: proto.IExternalBlobReference, + options: AxiosRequestConfig +) => { + const buffer = await downloadExternalBlob(blob, options) + const syncData = proto.SyncdMutations.decode(buffer) + return syncData +} + +export const decodeSyncdSnapshot = async( + name: WAPatchName, + snapshot: proto.ISyncdSnapshot, + getAppStateSyncKey: FetchAppStateSyncKey, + minimumVersionNumber: number | undefined, + validateMacs: boolean = true +) => { + const newState = newLTHashState() + newState.version = toNumber(snapshot.version!.version!) + + const mutationMap: ChatMutationMap = {} + const areMutationsRequired = typeof minimumVersionNumber === 'undefined' + || newState.version > minimumVersionNumber + + const { hash, indexValueMap } = await decodeSyncdMutations( + snapshot.records!, + newState, + getAppStateSyncKey, + areMutationsRequired + ? (mutation) => { + const index = mutation.syncAction.index?.toString() + mutationMap[index!] = mutation + } + : () => { }, + validateMacs + ) + newState.hash = hash + newState.indexValueMap = indexValueMap + + if(validateMacs) { + const base64Key = Buffer.from(snapshot.keyId!.id!).toString('base64') + const keyEnc = await getAppStateSyncKey(base64Key) + if(!keyEnc) { + throw new Boom(`failed to find key "${base64Key}" to decode mutation`) + } + + const result = mutationKeys(keyEnc.keyData!) + const computedSnapshotMac = generateSnapshotMac(newState.hash, newState.version, name, result.snapshotMacKey) + if(Buffer.compare(snapshot.mac!, computedSnapshotMac) !== 0) { + throw new Boom(`failed to verify LTHash at ${newState.version} of ${name} from snapshot`) + } + } + + return { + state: newState, + mutationMap + } +} + +export const decodePatches = async( + name: WAPatchName, + syncds: proto.ISyncdPatch[], + initial: LTHashState, + getAppStateSyncKey: FetchAppStateSyncKey, + options: AxiosRequestConfig, + minimumVersionNumber?: number, + logger?: Logger, + validateMacs: boolean = true +) => { + const newState: LTHashState = { + ...initial, + indexValueMap: { ...initial.indexValueMap } + } + + const mutationMap: ChatMutationMap = { } + + for(let i = 0;i < syncds.length;i++) { + const syncd = syncds[i] + const { version, keyId, snapshotMac } = syncd + if(syncd.externalMutations) { + logger?.trace({ name, version }, 'downloading external patch') + const ref = await downloadExternalPatch(syncd.externalMutations, options) + logger?.debug({ name, version, mutations: ref.mutations.length }, 'downloaded external patch') + syncd.mutations?.push(...ref.mutations) + } + + const patchVersion = toNumber(version!.version!) + + newState.version = patchVersion + const shouldMutate = typeof minimumVersionNumber === 'undefined' || patchVersion > minimumVersionNumber + + const decodeResult = await decodeSyncdPatch( + syncd, + name, + newState, + getAppStateSyncKey, + shouldMutate + ? mutation => { + const index = mutation.syncAction.index?.toString() + mutationMap[index!] = mutation + } + : (() => { }), + true + ) + + newState.hash = decodeResult.hash + newState.indexValueMap = decodeResult.indexValueMap + + if(validateMacs) { + const base64Key = Buffer.from(keyId!.id!).toString('base64') + const keyEnc = await getAppStateSyncKey(base64Key) + if(!keyEnc) { + throw new Boom(`failed to find key "${base64Key}" to decode mutation`) + } + + const result = mutationKeys(keyEnc.keyData!) + const computedSnapshotMac = generateSnapshotMac(newState.hash, newState.version, name, result.snapshotMacKey) + if(Buffer.compare(snapshotMac!, computedSnapshotMac) !== 0) { + throw new Boom(`failed to verify LTHash at ${newState.version} of ${name}`) + } + } + + // clear memory used up by the mutations + syncd.mutations = [] + } + + return { state: newState, mutationMap } +} + +export const chatModificationToAppPatch = ( + mod: ChatModification, + jid: string +) => { + const OP = proto.SyncdMutation.SyncdOperation + const getMessageRange = (lastMessages: LastMessageList) => { + let messageRange: proto.SyncActionValue.ISyncActionMessageRange + if(Array.isArray(lastMessages)) { + const lastMsg = lastMessages[lastMessages.length - 1] + messageRange = { + lastMessageTimestamp: lastMsg?.messageTimestamp, + messages: lastMessages?.length ? lastMessages.map( + m => { + if(!m.key?.id || !m.key?.remoteJid) { + throw new Boom('Incomplete key', { statusCode: 400, data: m }) + } + + if(isJidGroup(m.key.remoteJid) && !m.key.fromMe && !m.key.participant) { + throw new Boom('Expected not from me message to have participant', { statusCode: 400, data: m }) + } + + if(!m.messageTimestamp || !toNumber(m.messageTimestamp)) { + throw new Boom('Missing timestamp in last message list', { statusCode: 400, data: m }) + } + + if(m.key.participant) { + m.key.participant = jidNormalizedUser(m.key.participant) + } + + return m + } + ) : undefined + } + } else { + messageRange = lastMessages + } + + return messageRange + } + + let patch: WAPatchCreate + if('mute' in mod) { + patch = { + syncAction: { + muteAction: { + muted: !!mod.mute, + muteEndTimestamp: mod.mute || undefined + } + }, + index: ['mute', jid], + type: 'regular_high', + apiVersion: 2, + operation: OP.SET + } + } else if('archive' in mod) { + patch = { + syncAction: { + archiveChatAction: { + archived: !!mod.archive, + messageRange: getMessageRange(mod.lastMessages) + } + }, + index: ['archive', jid], + type: 'regular_low', + apiVersion: 3, + operation: OP.SET + } + } else if('markRead' in mod) { + patch = { + syncAction: { + markChatAsReadAction: { + read: mod.markRead, + messageRange: getMessageRange(mod.lastMessages) + } + }, + index: ['markChatAsRead', jid], + type: 'regular_low', + apiVersion: 3, + operation: OP.SET + } + } else if('clear' in mod) { + if(mod.clear === 'all') { + throw new Boom('not supported') + } else { + const key = mod.clear.messages[0] + patch = { + syncAction: { + deleteMessageForMeAction: { + deleteMedia: false, + messageTimestamp: key.timestamp + } + }, + index: ['deleteMessageForMe', jid, key.id, key.fromMe ? '1' : '0', '0'], + type: 'regular_high', + apiVersion: 3, + operation: OP.SET + } + } + } else if('pin' in mod) { + patch = { + syncAction: { + pinAction: { + pinned: !!mod.pin + } + }, + index: ['pin_v1', jid], + type: 'regular_low', + apiVersion: 5, + operation: OP.SET + } + } else if('delete' in mod) { + patch = { + syncAction: { + deleteChatAction: { + messageRange: getMessageRange(mod.lastMessages), + } + }, + index: ['deleteChat', jid, '1'], + type: 'regular_high', + apiVersion: 6, + operation: OP.SET + } + } else if('pushNameSetting' in mod) { + patch = { + syncAction: { + pushNameSetting: { + name: mod.pushNameSetting + } + }, + index: ['setting_pushName'], + type: 'critical_block', + apiVersion: 1, + operation: OP.SET, + } + } else { + throw new Boom('not supported') + } + + patch.syncAction.timestamp = Date.now() + + return patch +} + +export const processSyncAction = ( + syncAction: ChatMutation, + ev: BaileysEventEmitter, + me: Contact, + initialSyncOpts?: InitialAppStateSyncOptions, + logger?: Logger, +) => { + const isInitialSync = !!initialSyncOpts + const accountSettings = initialSyncOpts?.accountSettings + + logger?.trace({ syncAction, initialSync: !!initialSyncOpts }, 'processing sync action') + + const { + syncAction: { value: action }, + index: [type, id, msgId, fromMe] + } = syncAction + + if(action?.muteAction) { + ev.emit( + 'chats.update', + [ + { + id, + muteEndTime: action.muteAction?.muted + ? toNumber(action.muteAction!.muteEndTimestamp!) + : null, + conditional: getChatUpdateConditional(id, undefined) + } + ] + ) + } else if(action?.archiveChatAction || type === 'archive' || type === 'unarchive') { + // okay so we've to do some annoying computation here + // when we're initially syncing the app state + // there are a few cases we need to handle + // 1. if the account unarchiveChats setting is true + // a. if the chat is archived, and no further messages have been received -- simple, keep archived + // b. if the chat was archived, and the user received messages from the other person afterwards + // then the chat should be marked unarchved -- + // we compare the timestamp of latest message from the other person to determine this + // 2. if the account unarchiveChats setting is false -- then it doesn't matter, + // it'll always take an app state action to mark in unarchived -- which we'll get anyway + const archiveAction = action?.archiveChatAction + const isArchived = archiveAction + ? archiveAction.archived + : type === 'archive' + // // basically we don't need to fire an "archive" update if the chat is being marked unarchvied + // // this only applies for the initial sync + // if(isInitialSync && !isArchived) { + // isArchived = false + // } + + const msgRange = !accountSettings?.unarchiveChats ? undefined : archiveAction?.messageRange + // logger?.debug({ chat: id, syncAction }, 'message range archive') + + ev.emit('chats.update', [{ + id, + archived: isArchived, + conditional: getChatUpdateConditional(id, msgRange) + }]) + } else if(action?.markChatAsReadAction) { + const markReadAction = action.markChatAsReadAction + // basically we don't need to fire an "read" update if the chat is being marked as read + // because the chat is read by default + // this only applies for the initial sync + const isNullUpdate = isInitialSync && markReadAction.read + + ev.emit('chats.update', [{ + id, + unreadCount: isNullUpdate ? null : !!markReadAction?.read ? 0 : -1, + conditional: getChatUpdateConditional(id, markReadAction?.messageRange) + }]) + } else if(action?.deleteMessageForMeAction || type === 'deleteMessageForMe') { + ev.emit('messages.delete', { keys: [ + { + remoteJid: id, + id: msgId, + fromMe: fromMe === '1' + } + ] }) + } else if(action?.contactAction) { + ev.emit('contacts.upsert', [{ id, name: action.contactAction!.fullName! }]) + } else if(action?.pushNameSetting) { + const name = action?.pushNameSetting?.name + if(name && me?.name !== name) { + ev.emit('creds.update', { me: { ...me, name } }) + } + } else if(action?.pinAction) { + ev.emit('chats.update', [{ + id, + pinned: action.pinAction?.pinned ? toNumber(action.timestamp!) : null, + conditional: getChatUpdateConditional(id, undefined) + }]) + } else if(action?.unarchiveChatsSetting) { + const unarchiveChats = !!action.unarchiveChatsSetting.unarchiveChats + ev.emit('creds.update', { accountSettings: { unarchiveChats } }) + + logger?.info(`archive setting updated => '${action.unarchiveChatsSetting.unarchiveChats}'`) + if(accountSettings) { + accountSettings.unarchiveChats = unarchiveChats + } + } else if(action?.starAction || type === 'star') { + let starred = action?.starAction?.starred + if(typeof starred !== 'boolean') { + starred = syncAction.index[syncAction.index.length - 1] === '1' + } + + ev.emit('messages.update', [ + { + key: { remoteJid: id, id: msgId, fromMe: fromMe === '1' }, + update: { starred } + } + ]) + } else if(action?.deleteChatAction || type === 'deleteChat') { + if(!isInitialSync) { + ev.emit('chats.delete', [id]) + } + } else { + logger?.debug({ syncAction, id }, 'unprocessable update') + } + + function getChatUpdateConditional(id: string, msgRange: proto.SyncActionValue.ISyncActionMessageRange | null | undefined): ChatUpdate['conditional'] { + return isInitialSync + ? (data) => { + const chat = data.historySets.chats[id] || data.chatUpserts[id] + if(chat) { + return msgRange ? isValidPatchBasedOnMessageRange(chat, msgRange) : true + } + } + : undefined + } + + function isValidPatchBasedOnMessageRange(chat: Chat, msgRange: proto.SyncActionValue.ISyncActionMessageRange | null | undefined) { + const lastMsgTimestamp = msgRange?.lastMessageTimestamp || msgRange?.lastSystemMessageTimestamp || 0 + const chatLastMsgTimestamp = chat?.lastMessageRecvTimestamp || 0 + return lastMsgTimestamp >= chatLastMsgTimestamp + } +} \ No newline at end of file diff --git a/src/Utils/crypto.ts b/src/Utils/crypto.ts new file mode 100644 index 00000000000..7855eb595b1 --- /dev/null +++ b/src/Utils/crypto.ts @@ -0,0 +1,113 @@ +import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'crypto' +import HKDF from 'futoin-hkdf' +import * as libsignal from 'libsignal' +import { KEY_BUNDLE_TYPE } from '../Defaults' +import { KeyPair } from '../Types' + +/** prefix version byte to the pub keys, required for some curve crypto functions */ +export const generateSignalPubKey = (pubKey: Uint8Array | Buffer) => ( + pubKey.length === 33 + ? pubKey + : Buffer.concat([ KEY_BUNDLE_TYPE, pubKey ]) +) + +export const Curve = { + generateKeyPair: (): KeyPair => { + const { pubKey, privKey } = libsignal.curve.generateKeyPair() + return { + private: Buffer.from(privKey), + // remove version byte + public: Buffer.from((pubKey as Uint8Array).slice(1)) + } + }, + sharedKey: (privateKey: Uint8Array, publicKey: Uint8Array) => { + const shared = libsignal.curve.calculateAgreement(generateSignalPubKey(publicKey), privateKey) + return Buffer.from(shared) + }, + sign: (privateKey: Uint8Array, buf: Uint8Array) => ( + libsignal.curve.calculateSignature(privateKey, buf) + ), + verify: (pubKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => { + try { + libsignal.curve.verifySignature(generateSignalPubKey(pubKey), message, signature) + return true + } catch(error) { + return false + } + } +} + +export const signedKeyPair = (identityKeyPair: KeyPair, keyId: number) => { + const preKey = Curve.generateKeyPair() + const pubKey = generateSignalPubKey(preKey.public) + + const signature = Curve.sign(identityKeyPair.private, pubKey) + + return { keyPair: preKey, signature, keyId } +} + +const GCM_TAG_LENGTH = 128 >> 3 + +/** + * encrypt AES 256 GCM; + * where the tag tag is suffixed to the ciphertext + * */ +export function aesEncryptGCM(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array) { + const cipher = createCipheriv('aes-256-gcm', key, iv) + cipher.setAAD(additionalData) + return Buffer.concat([cipher.update(plaintext), cipher.final(), cipher.getAuthTag()]) +} + +/** + * decrypt AES 256 GCM; + * where the auth tag is suffixed to the ciphertext + * */ +export function aesDecryptGCM(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array) { + const decipher = createDecipheriv('aes-256-gcm', key, iv) + // decrypt additional adata + const enc = ciphertext.slice(0, ciphertext.length - GCM_TAG_LENGTH) + const tag = ciphertext.slice(ciphertext.length - GCM_TAG_LENGTH) + // set additional data + decipher.setAAD(additionalData) + decipher.setAuthTag(tag) + + return Buffer.concat([ decipher.update(enc), decipher.final() ]) +} + +/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */ +export function aesDecrypt(buffer: Buffer, key: Buffer) { + return aesDecryptWithIV(buffer.slice(16, buffer.length), key, buffer.slice(0, 16)) +} + +/** decrypt AES 256 CBC */ +export function aesDecryptWithIV(buffer: Buffer, key: Buffer, IV: Buffer) { + const aes = createDecipheriv('aes-256-cbc', key, IV) + return Buffer.concat([aes.update(buffer), aes.final()]) +} + +// encrypt AES 256 CBC; where a random IV is prefixed to the buffer +export function aesEncrypt(buffer: Buffer | Uint8Array, key: Buffer) { + const IV = randomBytes(16) + const aes = createCipheriv('aes-256-cbc', key, IV) + return Buffer.concat([IV, aes.update(buffer), aes.final()]) // prefix IV to the buffer +} + +// encrypt AES 256 CBC with a given IV +export function aesEncrypWithIV(buffer: Buffer, key: Buffer, IV: Buffer) { + const aes = createCipheriv('aes-256-cbc', key, IV) + return Buffer.concat([aes.update(buffer), aes.final()]) // prefix IV to the buffer +} + +// sign HMAC using SHA 256 +export function hmacSign(buffer: Buffer | Uint8Array, key: Buffer | Uint8Array, variant: 'sha256' | 'sha512' = 'sha256') { + return createHmac(variant, key).update(buffer).digest() +} + +export function sha256(buffer: Buffer) { + return createHash('sha256').update(buffer).digest() +} + +// HKDF key expansion +export function hkdf(buffer: Uint8Array | Buffer, expandedLength: number, info: { salt?: Buffer, info?: string }) { + return HKDF(!Buffer.isBuffer(buffer) ? Buffer.from(buffer) : buffer, expandedLength, info) +} \ No newline at end of file diff --git a/src/Utils/decode-wa-message.ts b/src/Utils/decode-wa-message.ts new file mode 100644 index 00000000000..ebec0de43ab --- /dev/null +++ b/src/Utils/decode-wa-message.ts @@ -0,0 +1,186 @@ +import { Boom } from '@hapi/boom' +import { Logger } from 'pino' +import { proto } from '../../WAProto' +import { SignalRepository, WAMessageKey } from '../Types' +import { areJidsSameUser, BinaryNode, isJidBroadcast, isJidGroup, isJidStatusBroadcast, isJidUser } from '../WABinary' +import { unpadRandomMax16 } from './generics' + +const NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node' + +type MessageType = 'chat' | 'peer_broadcast' | 'other_broadcast' | 'group' | 'direct_peer_status' | 'other_status' + +/** + * Decode the received node as a message. + * @note this will only parse the message, not decrypt it + */ +export function decodeMessageNode( + stanza: BinaryNode, + meId: string +) { + let msgType: MessageType + let chatId: string + let author: string + + const msgId = stanza.attrs.id + const from = stanza.attrs.from + const participant: string | undefined = stanza.attrs.participant + const recipient: string | undefined = stanza.attrs.recipient + + const isMe = (jid: string) => areJidsSameUser(jid, meId) + + if(isJidUser(from)) { + if(recipient) { + if(!isMe(from)) { + throw new Boom('receipient present, but msg not from me', { data: stanza }) + } + + chatId = recipient + } else { + chatId = from + } + + msgType = 'chat' + author = from + } else if(isJidGroup(from)) { + if(!participant) { + throw new Boom('No participant in group message') + } + + msgType = 'group' + author = participant + chatId = from + } else if(isJidBroadcast(from)) { + if(!participant) { + throw new Boom('No participant in group message') + } + + const isParticipantMe = isMe(participant) + if(isJidStatusBroadcast(from)) { + msgType = isParticipantMe ? 'direct_peer_status' : 'other_status' + } else { + msgType = isParticipantMe ? 'peer_broadcast' : 'other_broadcast' + } + + chatId = from + author = participant + } else { + throw new Boom('Unknown message type', { data: stanza }) + } + + const fromMe = isMe(stanza.attrs.participant || stanza.attrs.from) + const pushname = stanza.attrs.notify + + const key: WAMessageKey = { + remoteJid: chatId, + fromMe, + id: msgId, + participant + } + + const fullMessage: proto.IWebMessageInfo = { + key, + messageTimestamp: +stanza.attrs.t, + pushName: pushname, + broadcast: isJidBroadcast(from) + } + + if(key.fromMe) { + fullMessage.status = proto.WebMessageInfo.Status.SERVER_ACK + } + + return { + fullMessage, + author, + sender: msgType === 'chat' ? author : chatId + } +} + +export const decryptMessageNode = ( + stanza: BinaryNode, + meId: string, + repository: SignalRepository, + logger: Logger +) => { + const { fullMessage, author, sender } = decodeMessageNode(stanza, meId) + return { + fullMessage, + category: stanza.attrs.category, + author, + async decrypt() { + let decryptables = 0 + if(Array.isArray(stanza.content)) { + for(const { tag, attrs, content } of stanza.content) { + if(tag === 'verified_name' && content instanceof Uint8Array) { + const cert = proto.VerifiedNameCertificate.decode(content) + const details = proto.VerifiedNameCertificate.Details.decode(cert.details) + fullMessage.verifiedBizName = details.verifiedName + } + + if(tag !== 'enc') { + continue + } + + if(!(content instanceof Uint8Array)) { + continue + } + + decryptables += 1 + + let msgBuffer: Uint8Array + + try { + const e2eType = attrs.type + switch (e2eType) { + case 'skmsg': + msgBuffer = await repository.decryptGroupMessage({ + group: sender, + authorJid: author, + msg: content + }) + break + case 'pkmsg': + case 'msg': + const user = isJidUser(sender) ? sender : author + msgBuffer = await repository.decryptMessage({ + jid: user, + type: e2eType, + ciphertext: content + }) + break + default: + throw new Error(`Unknown e2e type: ${e2eType}`) + } + + let msg: proto.IMessage = proto.Message.decode(unpadRandomMax16(msgBuffer)) + msg = msg.deviceSentMessage?.message || msg + if(msg.senderKeyDistributionMessage) { + await repository.processSenderKeyDistributionMessage({ + authorJid: author, + item: msg.senderKeyDistributionMessage + }) + } + + if(fullMessage.message) { + Object.assign(fullMessage.message, msg) + } else { + fullMessage.message = msg + } + } catch(err) { + logger.error( + { key: fullMessage.key, err }, + 'failed to decrypt message' + ) + fullMessage.messageStubType = proto.WebMessageInfo.StubType.CIPHERTEXT + fullMessage.messageStubParameters = [err.message] + } + } + } + + // if nothing was found to decrypt + if(!decryptables) { + fullMessage.messageStubType = proto.WebMessageInfo.StubType.CIPHERTEXT + fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT] + } + } + } +} \ No newline at end of file diff --git a/src/Utils/event-buffer.ts b/src/Utils/event-buffer.ts new file mode 100644 index 00000000000..63b349d89b5 --- /dev/null +++ b/src/Utils/event-buffer.ts @@ -0,0 +1,613 @@ +import EventEmitter from 'events' +import { Logger } from 'pino' +import { proto } from '../../WAProto' +import { BaileysEvent, BaileysEventEmitter, BaileysEventMap, BufferedEventData, Chat, ChatUpdate, Contact, WAMessage, WAMessageStatus } from '../Types' +import { trimUndefineds } from './generics' +import { updateMessageWithReaction, updateMessageWithReceipt } from './messages' +import { isRealMessage, shouldIncrementChatUnread } from './process-message' + +const BUFFERABLE_EVENT = [ + 'messaging-history.set', + 'chats.upsert', + 'chats.update', + 'chats.delete', + 'contacts.upsert', + 'contacts.update', + 'messages.upsert', + 'messages.update', + 'messages.delete', + 'messages.reaction', + 'message-receipt.update', + 'groups.update', +] as const + +type BufferableEvent = typeof BUFFERABLE_EVENT[number] + +/** + * A map that contains a list of all events that have been triggered + * + * Note, this can contain different type of events + * this can make processing events extremely efficient -- since everything + * can be done in a single transaction + */ +type BaileysEventData = Partial + +const BUFFERABLE_EVENT_SET = new Set(BUFFERABLE_EVENT) + +type BaileysBufferableEventEmitter = BaileysEventEmitter & { + /** Use to process events in a batch */ + process(handler: (events: BaileysEventData) => void | Promise): (() => void) + /** + * starts buffering events, call flush() to release them + * */ + buffer(): void + /** buffers all events till the promise completes */ + createBufferedFunction(work: (...args: A) => Promise): ((...args: A) => Promise) + /** + * flushes all buffered events + * @param force if true, will flush all data regardless of any pending buffers + * @returns returns true if the flush actually happened, otherwise false + */ + flush(force?: boolean): boolean + /** is there an ongoing buffer */ + isBuffering(): boolean +} + +/** + * The event buffer logically consolidates different events into a single event + * making the data processing more efficient. + * @param ev the baileys event emitter + */ +export const makeEventBuffer = (logger: Logger): BaileysBufferableEventEmitter => { + const ev = new EventEmitter() + const historyCache = new Set() + + let data = makeBufferData() + let buffersInProgress = 0 + + // take the generic event and fire it as a baileys event + ev.on('event', (map: BaileysEventData) => { + for(const event in map) { + ev.emit(event, map[event]) + } + }) + + function buffer() { + buffersInProgress += 1 + } + + function flush(force = false) { + // no buffer going on + if(!buffersInProgress) { + return false + } + + if(!force) { + // reduce the number of buffers in progress + buffersInProgress -= 1 + // if there are still some buffers going on + // then we don't flush now + if(buffersInProgress) { + return false + } + } + + const newData = makeBufferData() + const chatUpdates = Object.values(data.chatUpdates) + // gather the remaining conditional events so we re-queue them + let conditionalChatUpdatesLeft = 0 + for(const update of chatUpdates) { + if(update.conditional) { + conditionalChatUpdatesLeft += 1 + newData.chatUpdates[update.id!] = update + delete data.chatUpdates[update.id!] + } + } + + const consolidatedData = consolidateEvents(data) + if(Object.keys(consolidatedData).length) { + ev.emit('event', consolidatedData) + } + + data = newData + + logger.trace( + { conditionalChatUpdatesLeft }, + 'released buffered events' + ) + + return true + } + + return { + process(handler) { + const listener = (map: BaileysEventData) => { + handler(map) + } + + ev.on('event', listener) + return () => { + ev.off('event', listener) + } + }, + emit(event: BaileysEvent, evData: BaileysEventMap[T]) { + if(buffersInProgress && BUFFERABLE_EVENT_SET.has(event)) { + append(data, historyCache, event as any, evData, logger) + return true + } + + return ev.emit('event', { [event]: evData }) + }, + isBuffering() { + return buffersInProgress > 0 + }, + buffer, + flush, + createBufferedFunction(work) { + return async(...args) => { + buffer() + try { + const result = await work(...args) + return result + } finally { + flush() + } + } + }, + on: (...args) => ev.on(...args), + off: (...args) => ev.off(...args), + removeAllListeners: (...args) => ev.removeAllListeners(...args), + } +} + +const makeBufferData = (): BufferedEventData => { + return { + historySets: { + chats: { }, + messages: { }, + contacts: { }, + isLatest: false, + empty: true + }, + chatUpserts: { }, + chatUpdates: { }, + chatDeletes: new Set(), + contactUpserts: { }, + contactUpdates: { }, + messageUpserts: { }, + messageUpdates: { }, + messageReactions: { }, + messageDeletes: { }, + messageReceipts: { }, + groupUpdates: { } + } +} + +function append( + data: BufferedEventData, + historyCache: Set, + event: E, + eventData: any, + logger: Logger +) { + switch (event) { + case 'messaging-history.set': + for(const chat of eventData.chats as Chat[]) { + const existingChat = data.historySets.chats[chat.id] + if(existingChat) { + existingChat.endOfHistoryTransferType = chat.endOfHistoryTransferType + } + + if(!existingChat && !historyCache.has(chat.id)) { + data.historySets.chats[chat.id] = chat + historyCache.add(chat.id) + + absorbingChatUpdate(chat) + } + } + + for(const contact of eventData.contacts as Contact[]) { + const existingContact = data.historySets.contacts[contact.id] + if(existingContact) { + Object.assign(existingContact, trimUndefineds(contact)) + } else { + const historyContactId = `c:${contact.id}` + const hasAnyName = contact.notify || contact.name || contact.verifiedName + if(!historyCache.has(historyContactId) || hasAnyName) { + data.historySets.contacts[contact.id] = contact + historyCache.add(historyContactId) + } + } + } + + for(const message of eventData.messages as WAMessage[]) { + const key = stringifyMessageKey(message.key) + const existingMsg = data.historySets.messages[key] + if(!existingMsg && !historyCache.has(key)) { + data.historySets.messages[key] = message + historyCache.add(key) + } + } + + data.historySets.empty = false + data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest + + break + case 'chats.upsert': + for(const chat of eventData as Chat[]) { + let upsert = data.chatUpserts[chat.id] + if(!upsert) { + upsert = data.historySets[chat.id] + if(upsert) { + logger.debug({ chatId: chat.id }, 'absorbed chat upsert in chat set') + } + } + + if(upsert) { + upsert = concatChats(upsert, chat) + } else { + upsert = chat + data.chatUpserts[chat.id] = upsert + } + + absorbingChatUpdate(upsert) + + if(data.chatDeletes.has(chat.id)) { + data.chatDeletes.delete(chat.id) + } + } + + break + case 'chats.update': + for(const update of eventData as ChatUpdate[]) { + const chatId = update.id! + const conditionMatches = update.conditional ? update.conditional(data) : true + if(conditionMatches) { + delete update.conditional + + // if there is an existing upsert, merge the update into it + const upsert = data.historySets.chats[chatId] || data.chatUpserts[chatId] + if(upsert) { + concatChats(upsert, update) + } else { + // merge the update into the existing update + const chatUpdate = data.chatUpdates[chatId] || { } + data.chatUpdates[chatId] = concatChats(chatUpdate, update) + } + } else if(conditionMatches === undefined) { + // condition yet to be fulfilled + data.chatUpdates[chatId] = update + } + // otherwise -- condition not met, update is invalid + + // if the chat has been updated + // ignore any existing chat delete + if(data.chatDeletes.has(chatId)) { + data.chatDeletes.delete(chatId) + } + } + + break + case 'chats.delete': + for(const chatId of eventData as string[]) { + if(!data.chatDeletes.has(chatId)) { + data.chatDeletes.add(chatId) + } + + // remove any prior updates & upserts + if(data.chatUpdates[chatId]) { + delete data.chatUpdates[chatId] + } + + if(data.chatUpserts[chatId]) { + delete data.chatUpserts[chatId] + + } + + if(data.historySets.chats[chatId]) { + delete data.historySets.chats[chatId] + } + } + + break + case 'contacts.upsert': + for(const contact of eventData as Contact[]) { + let upsert = data.contactUpserts[contact.id] + if(!upsert) { + upsert = data.historySets.contacts[contact.id] + if(upsert) { + logger.debug({ contactId: contact.id }, 'absorbed contact upsert in contact set') + } + } + + if(upsert) { + upsert = Object.assign(upsert, trimUndefineds(contact)) + } else { + upsert = contact + data.contactUpserts[contact.id] = upsert + } + + if(data.contactUpdates[contact.id]) { + upsert = Object.assign(data.contactUpdates[contact.id], trimUndefineds(contact)) + delete data.contactUpdates[contact.id] + } + } + + break + case 'contacts.update': + const contactUpdates = eventData as BaileysEventMap['contacts.update'] + for(const update of contactUpdates) { + const id = update.id! + // merge into prior upsert + const upsert = data.historySets.contacts[id] || data.contactUpserts[id] + if(upsert) { + Object.assign(upsert, update) + } else { + // merge into prior update + const contactUpdate = data.contactUpdates[id] || { } + data.contactUpdates[id] = Object.assign(contactUpdate, update) + } + } + + break + case 'messages.upsert': + const { messages, type } = eventData as BaileysEventMap['messages.upsert'] + for(const message of messages) { + const key = stringifyMessageKey(message.key) + let existing = data.messageUpserts[key]?.message + if(!existing) { + existing = data.historySets.messages[key] + if(existing) { + logger.debug({ messageId: key }, 'absorbed message upsert in message set') + } + } + + if(existing) { + message.messageTimestamp = existing.messageTimestamp + } + + if(data.messageUpdates[key]) { + logger.debug('absorbed prior message update in message upsert') + Object.assign(message, data.messageUpdates[key].update) + delete data.messageUpdates[key] + } + + if(data.historySets.messages[key]) { + data.historySets.messages[key] = message + } else { + data.messageUpserts[key] = { + message, + type: type === 'notify' || data.messageUpserts[key]?.type === 'notify' + ? 'notify' + : type + } + } + } + + break + case 'messages.update': + const msgUpdates = eventData as BaileysEventMap['messages.update'] + for(const { key, update } of msgUpdates) { + const keyStr = stringifyMessageKey(key) + const existing = data.historySets.messages[keyStr] || data.messageUpserts[keyStr]?.message + if(existing) { + Object.assign(existing, update) + // if the message was received & read by us + // the chat counter must have been incremented + // so we need to decrement it + if(update.status === WAMessageStatus.READ && !key.fromMe) { + decrementChatReadCounterIfMsgDidUnread(existing) + } + } else { + const msgUpdate = data.messageUpdates[keyStr] || { key, update: { } } + Object.assign(msgUpdate.update, update) + data.messageUpdates[keyStr] = msgUpdate + } + } + + break + case 'messages.delete': + const deleteData = eventData as BaileysEventMap['messages.delete'] + if('keys' in deleteData) { + const { keys } = deleteData + for(const key of keys) { + const keyStr = stringifyMessageKey(key) + if(!data.messageDeletes[keyStr]) { + data.messageDeletes[keyStr] = key + + } + + if(data.messageUpserts[keyStr]) { + delete data.messageUpserts[keyStr] + } + + if(data.messageUpdates[keyStr]) { + delete data.messageUpdates[keyStr] + } + } + } else { + // TODO: add support + } + + break + case 'messages.reaction': + const reactions = eventData as BaileysEventMap['messages.reaction'] + for(const { key, reaction } of reactions) { + const keyStr = stringifyMessageKey(key) + const existing = data.messageUpserts[keyStr] + if(existing) { + updateMessageWithReaction(existing.message, reaction) + } else { + data.messageReactions[keyStr] = data.messageReactions[keyStr] + || { key, reactions: [] } + updateMessageWithReaction(data.messageReactions[keyStr], reaction) + } + } + + break + case 'message-receipt.update': + const receipts = eventData as BaileysEventMap['message-receipt.update'] + for(const { key, receipt } of receipts) { + const keyStr = stringifyMessageKey(key) + const existing = data.messageUpserts[keyStr] + if(existing) { + updateMessageWithReceipt(existing.message, receipt) + } else { + data.messageReceipts[keyStr] = data.messageReceipts[keyStr] + || { key, userReceipt: [] } + updateMessageWithReceipt(data.messageReceipts[keyStr], receipt) + } + } + + break + case 'groups.update': + const groupUpdates = eventData as BaileysEventMap['groups.update'] + for(const update of groupUpdates) { + const id = update.id! + const groupUpdate = data.groupUpdates[id] || { } + if(!data.groupUpdates[id]) { + data.groupUpdates[id] = Object.assign(groupUpdate, update) + + } + } + + break + default: + throw new Error(`"${event}" cannot be buffered`) + } + + function absorbingChatUpdate(existing: Chat) { + const chatId = existing.id + const update = data.chatUpdates[chatId] + if(update) { + const conditionMatches = update.conditional ? update.conditional(data) : true + if(conditionMatches) { + delete update.conditional + logger.debug({ chatId }, 'absorbed chat update in existing chat') + Object.assign(existing, concatChats(update as Chat, existing)) + delete data.chatUpdates[chatId] + } else if(conditionMatches === false) { + logger.debug({ chatId }, 'chat update condition fail, removing') + delete data.chatUpdates[chatId] + } + } + } + + function decrementChatReadCounterIfMsgDidUnread(message: WAMessage) { + // decrement chat unread counter + // if the message has already been marked read by us + const chatId = message.key.remoteJid! + const chat = data.chatUpdates[chatId] || data.chatUpserts[chatId] + if( + isRealMessage(message, '') + && shouldIncrementChatUnread(message) + && typeof chat?.unreadCount === 'number' + && chat.unreadCount > 0 + ) { + logger.debug({ chatId: chat.id }, 'decrementing chat counter') + chat.unreadCount -= 1 + if(chat.unreadCount === 0) { + delete chat.unreadCount + } + } + } +} + +function consolidateEvents(data: BufferedEventData) { + const map: BaileysEventData = { } + + if(!data.historySets.empty) { + map['messaging-history.set'] = { + chats: Object.values(data.historySets.chats), + messages: Object.values(data.historySets.messages), + contacts: Object.values(data.historySets.contacts), + isLatest: data.historySets.isLatest + } + } + + const chatUpsertList = Object.values(data.chatUpserts) + if(chatUpsertList.length) { + map['chats.upsert'] = chatUpsertList + } + + const chatUpdateList = Object.values(data.chatUpdates) + if(chatUpdateList.length) { + map['chats.update'] = chatUpdateList + } + + const chatDeleteList = Array.from(data.chatDeletes) + if(chatDeleteList.length) { + map['chats.delete'] = chatDeleteList + } + + const messageUpsertList = Object.values(data.messageUpserts) + if(messageUpsertList.length) { + const type = messageUpsertList[0].type + map['messages.upsert'] = { + messages: messageUpsertList.map(m => m.message), + type + } + } + + const messageUpdateList = Object.values(data.messageUpdates) + if(messageUpdateList.length) { + map['messages.update'] = messageUpdateList + } + + const messageDeleteList = Object.values(data.messageDeletes) + if(messageDeleteList.length) { + map['messages.delete'] = { keys: messageDeleteList } + } + + const messageReactionList = Object.values(data.messageReactions).flatMap( + ({ key, reactions }) => reactions.flatMap(reaction => ({ key, reaction })) + ) + if(messageReactionList.length) { + map['messages.reaction'] = messageReactionList + } + + const messageReceiptList = Object.values(data.messageReceipts).flatMap( + ({ key, userReceipt }) => userReceipt.flatMap(receipt => ({ key, receipt })) + ) + if(messageReceiptList.length) { + map['message-receipt.update'] = messageReceiptList + } + + const contactUpsertList = Object.values(data.contactUpserts) + if(contactUpsertList.length) { + map['contacts.upsert'] = contactUpsertList + } + + const contactUpdateList = Object.values(data.contactUpdates) + if(contactUpdateList.length) { + map['contacts.update'] = contactUpdateList + } + + const groupUpdateList = Object.values(data.groupUpdates) + if(groupUpdateList.length) { + map['groups.update'] = groupUpdateList + } + + return map +} + +function concatChats>(a: C, b: Partial) { + if(b.unreadCount === null) { + // neutralize unread counter + if(a.unreadCount! < 0) { + a.unreadCount = undefined + b.unreadCount = undefined + } + } + + if(typeof a.unreadCount === 'number' && typeof b.unreadCount === 'number') { + b = { ...b } + if(b.unreadCount! >= 0) { + b.unreadCount = Math.max(b.unreadCount!, 0) + Math.max(a.unreadCount, 0) + } + } + + return Object.assign(a, b) +} + +const stringifyMessageKey = (key: proto.IMessageKey) => `${key.remoteJid},${key.id},${key.fromMe ? '1' : '0'}` \ No newline at end of file diff --git a/src/Utils/generics.ts b/src/Utils/generics.ts new file mode 100644 index 00000000000..ab392e2236d --- /dev/null +++ b/src/Utils/generics.ts @@ -0,0 +1,389 @@ +import { Boom } from '@hapi/boom' +import axios, { AxiosRequestConfig } from 'axios' +import { randomBytes } from 'crypto' +import { platform, release } from 'os' +import { Logger } from 'pino' +import { proto } from '../../WAProto' +import { version as baileysVersion } from '../Defaults/baileys-version.json' +import { BaileysEventEmitter, BaileysEventMap, DisconnectReason, WACallUpdateType, WAVersion } from '../Types' +import { BinaryNode, getAllBinaryNodeChildren } from '../WABinary' + +const PLATFORM_MAP = { + 'aix': 'AIX', + 'darwin': 'Mac OS', + 'win32': 'Windows', + 'android': 'Android' +} + +export const Browsers = { + ubuntu: browser => ['Ubuntu', browser, '20.0.04'] as [string, string, string], + macOS: browser => ['Mac OS', browser, '10.15.7'] as [string, string, string], + baileys: browser => ['Baileys', browser, '4.0.0'] as [string, string, string], + /** The appropriate browser based on your OS & release */ + appropriate: browser => [ PLATFORM_MAP[platform()] || 'Ubuntu', browser, release() ] as [string, string, string] +} + +export const BufferJSON = { + replacer: (k, value: any) => { + if(Buffer.isBuffer(value) || value instanceof Uint8Array || value?.type === 'Buffer') { + return { type: 'Buffer', data: Buffer.from(value?.data || value).toString('base64') } + } + + return value + }, + reviver: (_, value: any) => { + if(typeof value === 'object' && !!value && (value.buffer === true || value.type === 'Buffer')) { + const val = value.data || value.value + return typeof val === 'string' ? Buffer.from(val, 'base64') : Buffer.from(val || []) + } + + return value + } +} + +export const getKeyAuthor = ( + key: proto.IMessageKey | undefined | null, + meId: string = 'me' +) => ( + (key?.fromMe ? meId : key?.participant || key?.remoteJid) || '' +) + +export const writeRandomPadMax16 = (msg: Uint8Array) => { + const pad = randomBytes(1) + pad[0] &= 0xf + if(!pad[0]) { + pad[0] = 0xf + } + + return Buffer.concat([msg, Buffer.alloc(pad[0], pad[0])]) +} + +export const unpadRandomMax16 = (e: Uint8Array | Buffer) => { + const t = new Uint8Array(e) + if(0 === t.length) { + throw new Error('unpadPkcs7 given empty bytes') + } + + var r = t[t.length - 1] + if(r > t.length) { + throw new Error(`unpad given ${t.length} bytes, but pad is ${r}`) + } + + return new Uint8Array(t.buffer, t.byteOffset, t.length - r) +} + +export const encodeWAMessage = (message: proto.IMessage) => ( + writeRandomPadMax16( + proto.Message.encode(message).finish() + ) +) + +export const generateRegistrationId = (): number => { + return Uint16Array.from(randomBytes(2))[0] & 16383 +} + +export const encodeBigEndian = (e: number, t = 4) => { + let r = e + const a = new Uint8Array(t) + for(let i = t - 1; i >= 0; i--) { + a[i] = 255 & r + r >>>= 8 + } + + return a +} + +export const toNumber = (t: Long | number | null | undefined): number => ((typeof t === 'object' && t) ? ('toNumber' in t ? t.toNumber() : (t as any).low) : t) + +/** unix timestamp of a date in seconds */ +export const unixTimestampSeconds = (date: Date = new Date()) => Math.floor(date.getTime() / 1000) + +export type DebouncedTimeout = ReturnType + +export const debouncedTimeout = (intervalMs: number = 1000, task?: () => void) => { + let timeout: NodeJS.Timeout | undefined + return { + start: (newIntervalMs?: number, newTask?: () => void) => { + task = newTask || task + intervalMs = newIntervalMs || intervalMs + timeout && clearTimeout(timeout) + timeout = setTimeout(() => task?.(), intervalMs) + }, + cancel: () => { + timeout && clearTimeout(timeout) + timeout = undefined + }, + setTask: (newTask: () => void) => task = newTask, + setInterval: (newInterval: number) => intervalMs = newInterval + } +} + +export const delay = (ms: number) => delayCancellable (ms).delay + +export const delayCancellable = (ms: number) => { + const stack = new Error().stack + let timeout: NodeJS.Timeout + let reject: (error) => void + const delay: Promise = new Promise((resolve, _reject) => { + timeout = setTimeout(resolve, ms) + reject = _reject + }) + const cancel = () => { + clearTimeout (timeout) + reject( + new Boom('Cancelled', { + statusCode: 500, + data: { + stack + } + }) + ) + } + + return { delay, cancel } +} + +export async function promiseTimeout(ms: number | undefined, promise: (resolve: (v: T) => void, reject: (error) => void) => void) { + if(!ms) { + return new Promise(promise) + } + + const stack = new Error().stack + // Create a promise that rejects in milliseconds + const { delay, cancel } = delayCancellable (ms) + const p = new Promise((resolve, reject) => { + delay + .then(() => reject( + new Boom('Timed Out', { + statusCode: DisconnectReason.timedOut, + data: { + stack + } + }) + )) + .catch (err => reject(err)) + + promise (resolve, reject) + }) + .finally (cancel) + return p as Promise +} + +// generate a random ID to attach to a message +export const generateMessageID = () => 'BAE5' + randomBytes(6).toString('hex').toUpperCase() + +export function bindWaitForEvent(ev: BaileysEventEmitter, event: T) { + return async(check: (u: BaileysEventMap[T]) => boolean | undefined, timeoutMs?: number) => { + let listener: (item: BaileysEventMap[T]) => void + let closeListener: any + await ( + promiseTimeout( + timeoutMs, + (resolve, reject) => { + closeListener = ({ connection, lastDisconnect }) => { + if(connection === 'close') { + reject( + lastDisconnect?.error + || new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed }) + ) + } + } + + ev.on('connection.update', closeListener) + listener = (update) => { + if(check(update)) { + resolve() + } + } + + ev.on(event, listener) + } + ) + .finally(() => { + ev.off(event, listener) + ev.off('connection.update', closeListener) + }) + ) + } +} + +export const bindWaitForConnectionUpdate = (ev: BaileysEventEmitter) => bindWaitForEvent(ev, 'connection.update') + +export const printQRIfNecessaryListener = (ev: BaileysEventEmitter, logger: Logger) => { + ev.on('connection.update', async({ qr }) => { + if(qr) { + const QR = await import('qrcode-terminal') + .catch(() => { + logger.error('QR code terminal not added as dependency') + }) + QR?.generate(qr, { small: true }) + } + }) +} + +/** + * utility that fetches latest baileys version from the master branch. + * Use to ensure your WA connection is always on the latest version + */ +export const fetchLatestBaileysVersion = async(options: AxiosRequestConfig = { }) => { + const URL = 'https://raw.githubusercontent.com/adiwajshing/Baileys/master/src/Defaults/baileys-version.json' + try { + const result = await axios.get<{ version: WAVersion }>( + URL, + { + ...options, + responseType: 'json' + } + ) + return { + version: result.data.version, + isLatest: true + } + } catch(error) { + return { + version: baileysVersion as WAVersion, + isLatest: false, + error + } + } +} + +/** + * A utility that fetches the latest web version of whatsapp. + * Use to ensure your WA connection is always on the latest version + */ +export const fetchLatestWaWebVersion = async(options: AxiosRequestConfig) => { + try { + const result = await axios.get( + 'https://web.whatsapp.com/check-update?version=1&platform=web', + { + ...options, + responseType: 'json' + } + ) + const version = result.data.currentVersion.split('.') + return { + version: [+version[0], +version[1], +version[2]] as WAVersion, + isLatest: true + } + } catch(error) { + return { + version: baileysVersion as WAVersion, + isLatest: false, + error + } + } +} + +/** unique message tag prefix for MD clients */ +export const generateMdTagPrefix = () => { + const bytes = randomBytes(4) + return `${bytes.readUInt16BE()}.${bytes.readUInt16BE(2)}-` +} + +const STATUS_MAP: { [_: string]: proto.WebMessageInfo.Status } = { + 'played': proto.WebMessageInfo.Status.PLAYED, + 'read': proto.WebMessageInfo.Status.READ, + 'read-self': proto.WebMessageInfo.Status.READ +} +/** + * Given a type of receipt, returns what the new status of the message should be + * @param type type from receipt + */ +export const getStatusFromReceiptType = (type: string | undefined) => { + const status = STATUS_MAP[type!] + if(typeof type === 'undefined') { + return proto.WebMessageInfo.Status.DELIVERY_ACK + } + + return status +} + +const CODE_MAP: { [_: string]: DisconnectReason } = { + conflict: DisconnectReason.connectionReplaced +} + +/** + * Stream errors generally provide a reason, map that to a baileys DisconnectReason + * @param reason the string reason given, eg. "conflict" + */ +export const getErrorCodeFromStreamError = (node: BinaryNode) => { + const [reasonNode] = getAllBinaryNodeChildren(node) + let reason = reasonNode?.tag || 'unknown' + const statusCode = +(node.attrs.code || CODE_MAP[reason] || DisconnectReason.badSession) + + if(statusCode === DisconnectReason.restartRequired) { + reason = 'restart required' + } + + return { + reason, + statusCode + } +} + +export const getCallStatusFromNode = ({ tag, attrs }: BinaryNode) => { + let status: WACallUpdateType + switch (tag) { + case 'offer': + case 'offer_notice': + status = 'offer' + break + case 'terminate': + if(attrs.reason === 'timeout') { + status = 'timeout' + } else { + status = 'reject' + } + + break + case 'reject': + status = 'reject' + break + case 'accept': + status = 'accept' + break + default: + status = 'ringing' + break + } + + return status +} + +const UNEXPECTED_SERVER_CODE_TEXT = 'Unexpected server response: ' + +export const getCodeFromWSError = (error: Error) => { + let statusCode = 500 + if(error.message.includes(UNEXPECTED_SERVER_CODE_TEXT)) { + const code = +error.message.slice(UNEXPECTED_SERVER_CODE_TEXT.length) + if(!Number.isNaN(code) && code >= 400) { + statusCode = code + } + } else if( + (error as any).code?.startsWith('E') + || error?.message?.includes('timed out') + ) { // handle ETIMEOUT, ENOTFOUND etc + statusCode = 408 + } + + return statusCode +} + +/** + * Is the given platform WA business + * @param platform AuthenticationCreds.platform + */ +export const isWABusinessPlatform = (platform: string) => { + return platform === 'smbi' || platform === 'smba' +} + +export function trimUndefineds(obj: any) { + for(const key in obj) { + if(typeof obj[key] === 'undefined') { + delete obj[key] + } + } + + return obj +} \ No newline at end of file diff --git a/src/Utils/history.ts b/src/Utils/history.ts new file mode 100644 index 00000000000..b56a395f6d7 --- /dev/null +++ b/src/Utils/history.ts @@ -0,0 +1,112 @@ +import { AxiosRequestConfig } from 'axios' +import { promisify } from 'util' +import { inflate } from 'zlib' +import { proto } from '../../WAProto' +import { Chat, Contact, WAMessageStubType } from '../Types' +import { isJidUser } from '../WABinary' +import { toNumber } from './generics' +import { normalizeMessageContent } from './messages' +import { downloadContentFromMessage } from './messages-media' + +const inflatePromise = promisify(inflate) + +export const downloadHistory = async( + msg: proto.Message.IHistorySyncNotification, + options: AxiosRequestConfig +) => { + const stream = await downloadContentFromMessage(msg, 'md-msg-hist', { options }) + const bufferArray: Buffer[] = [] + for await (const chunk of stream) { + bufferArray.push(chunk) + } + + let buffer = Buffer.concat(bufferArray) + + // decompress buffer + buffer = await inflatePromise(buffer) + + const syncData = proto.HistorySync.decode(buffer) + return syncData +} + +export const processHistoryMessage = (item: proto.IHistorySync) => { + const messages: proto.IWebMessageInfo[] = [] + const contacts: Contact[] = [] + const chats: Chat[] = [] + + switch (item.syncType) { + case proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP: + case proto.HistorySync.HistorySyncType.RECENT: + case proto.HistorySync.HistorySyncType.FULL: + for(const chat of item.conversations! as Chat[]) { + contacts.push({ id: chat.id, name: chat.name || undefined }) + + const msgs = chat.messages || [] + delete chat.messages + delete chat.archived + delete chat.muteEndTime + delete chat.pinned + + for(const item of msgs) { + const message = item.message! + messages.push(message) + + if(!chat.messages?.length) { + // keep only the most recent message in the chat array + chat.messages = [{ message }] + } + + if(!message.key.fromMe && !chat.lastMessageRecvTimestamp) { + chat.lastMessageRecvTimestamp = toNumber(message.messageTimestamp) + } + + if( + (message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_BSP + || message.messageStubType === WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB + ) + && message.messageStubParameters?.[0] + ) { + contacts.push({ + id: message.key.participant || message.key.remoteJid!, + verifiedName: message.messageStubParameters?.[0], + }) + } + } + + if(isJidUser(chat.id) && chat.readOnly && chat.archived) { + delete chat.readOnly + } + + chats.push({ ...chat }) + } + + break + case proto.HistorySync.HistorySyncType.PUSH_NAME: + for(const c of item.pushnames!) { + contacts.push({ id: c.id!, notify: c.pushname! }) + } + + break + } + + return { + chats, + contacts, + messages, + } +} + +export const downloadAndProcessHistorySyncNotification = async( + msg: proto.Message.IHistorySyncNotification, + options: AxiosRequestConfig +) => { + const historyMsg = await downloadHistory(msg, options) + return processHistoryMessage(historyMsg) +} + +export const getHistoryMsg = (message: proto.IMessage) => { + const normalizedContent = !!message ? normalizeMessageContent(message) : undefined + const anyHistoryMsg = normalizedContent?.protocolMessage?.historySyncNotification + + return anyHistoryMsg +} \ No newline at end of file diff --git a/src/Utils/index.ts b/src/Utils/index.ts new file mode 100644 index 00000000000..156abe090f6 --- /dev/null +++ b/src/Utils/index.ts @@ -0,0 +1,17 @@ +export * from './generics' +export * from './decode-wa-message' +export * from './messages' +export * from './messages-media' +export * from './validate-connection' +export * from './crypto' +export * from './signal' +export * from './noise-handler' +export * from './history' +export * from './chat-utils' +export * from './lt-hash' +export * from './auth-utils' +export * from './baileys-event-stream' +export * from './use-multi-file-auth-state' +export * from './link-preview' +export * from './event-buffer' +export * from './process-message' diff --git a/src/Utils/link-preview.ts b/src/Utils/link-preview.ts new file mode 100644 index 00000000000..84aa7e42e91 --- /dev/null +++ b/src/Utils/link-preview.ts @@ -0,0 +1,122 @@ +import { AxiosRequestConfig } from 'axios' +import { Logger } from 'pino' +import { WAMediaUploadFunction, WAUrlInfo } from '../Types' +import { prepareWAMessageMedia } from './messages' +import { extractImageThumb, getHttpStream } from './messages-media' + +const THUMBNAIL_WIDTH_PX = 192 + +/** Fetches an image and generates a thumbnail for it */ +const getCompressedJpegThumbnail = async( + url: string, + { thumbnailWidth, fetchOpts }: URLGenerationOptions +) => { + const stream = await getHttpStream(url, fetchOpts) + const result = await extractImageThumb(stream, thumbnailWidth) + return result +} + +export type URLGenerationOptions = { + thumbnailWidth: number + fetchOpts: { + /** Timeout in ms */ + timeout: number + proxyUrl?: string + headers?: AxiosRequestConfig<{}>['headers'] + } + uploadImage?: WAMediaUploadFunction + logger?: Logger +} + +/** + * Given a piece of text, checks for any URL present, generates link preview for the same and returns it + * Return undefined if the fetch failed or no URL was found + * @param text first matched URL in text + * @returns the URL info required to generate link preview + */ +export const getUrlInfo = async( + text: string, + opts: URLGenerationOptions = { + thumbnailWidth: THUMBNAIL_WIDTH_PX, + fetchOpts: { timeout: 3000 } + }, +): Promise => { + try { + // retries + const retries = 0 + const maxRetry = 5 + + const { getLinkPreview } = await import('link-preview-js') + let previewLink = text + if(!text.startsWith('https://') && !text.startsWith('http://')) { + previewLink = 'https://' + previewLink + } + + const info = await getLinkPreview(previewLink, { + ...opts.fetchOpts, + followRedirects: 'manual', + handleRedirects: (baseURL: string, forwardedURL: string) => { + const urlObj = new URL(baseURL) + const forwardedURLObj = new URL(forwardedURL) + if(retries >= maxRetry) { + return false + } + + if( + forwardedURLObj.hostname === urlObj.hostname + || forwardedURLObj.hostname === 'www.' + urlObj.hostname + || 'www.' + forwardedURLObj.hostname === urlObj.hostname + ) { + retries + 1 + return true + } else { + return false + } + }, + headers: opts.fetchOpts as {} + }) + if(info && 'title' in info && info.title) { + const [image] = info.images + + const urlInfo: WAUrlInfo = { + 'canonical-url': info.url, + 'matched-text': text, + title: info.title, + description: info.description, + originalThumbnailUrl: image + } + + if(opts.uploadImage) { + const { imageMessage } = await prepareWAMessageMedia( + { image: { url: image } }, + { + upload: opts.uploadImage, + mediaTypeOverride: 'thumbnail-link', + options: opts.fetchOpts + } + ) + urlInfo.jpegThumbnail = imageMessage?.jpegThumbnail + ? Buffer.from(imageMessage.jpegThumbnail) + : undefined + urlInfo.highQualityThumbnail = imageMessage || undefined + } else { + try { + urlInfo.jpegThumbnail = image + ? (await getCompressedJpegThumbnail(image, opts)).buffer + : undefined + } catch(error) { + opts.logger?.debug( + { err: error.stack, url: previewLink }, + 'error in generating thumbnail' + ) + } + } + + return urlInfo + } + } catch(error) { + if(!error.message.includes('receive a valid')) { + throw error + } + } +} \ No newline at end of file diff --git a/src/Utils/logger.ts b/src/Utils/logger.ts new file mode 100644 index 00000000000..bb651e3276a --- /dev/null +++ b/src/Utils/logger.ts @@ -0,0 +1,3 @@ +import P from 'pino' + +export default P({ timestamp: () => `,"time":"${new Date().toJSON()}"` }) \ No newline at end of file diff --git a/src/Utils/lt-hash.ts b/src/Utils/lt-hash.ts new file mode 100644 index 00000000000..fa384843b04 --- /dev/null +++ b/src/Utils/lt-hash.ts @@ -0,0 +1,61 @@ +import { hkdf } from './crypto' + +/** + * LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data + * over a series of mutations. You can add/remove mutations and it'll return a hash equal to + * if the same series of mutations was made sequentially. + */ + +const o = 128 + +class d { + + salt: string + + constructor(e: string) { + this.salt = e + } + add(e, t) { + var r = this + for(const item of t) { + e = r._addSingle(e, item) + } + + return e + } + subtract(e, t) { + var r = this + for(const item of t) { + e = r._subtractSingle(e, item) + } + + return e + } + subtractThenAdd(e, t, r) { + var n = this + return n.add(n.subtract(e, r), t) + } + _addSingle(e, t) { + var r = this + const n = new Uint8Array(hkdf(Buffer.from(t), o, { info: r.salt })).buffer + return r.performPointwiseWithOverflow(e, n, ((e, t) => e + t)) + } + _subtractSingle(e, t) { + var r = this + + const n = new Uint8Array(hkdf(Buffer.from(t), o, { info: r.salt })).buffer + return r.performPointwiseWithOverflow(e, n, ((e, t) => e - t)) + } + performPointwiseWithOverflow(e, t, r) { + const n = new DataView(e) + , i = new DataView(t) + , a = new ArrayBuffer(n.byteLength) + , s = new DataView(a) + for(let e = 0; e < n.byteLength; e += 2) { + s.setUint16(e, r(n.getUint16(e, !0), i.getUint16(e, !0)), !0) + } + + return a + } +} +export const LT_HASH_ANTI_TAMPERING = new d('WhatsApp Patch Integrity') \ No newline at end of file diff --git a/src/Utils/make-mutex.ts b/src/Utils/make-mutex.ts new file mode 100644 index 00000000000..8bb9f540767 --- /dev/null +++ b/src/Utils/make-mutex.ts @@ -0,0 +1,44 @@ +export const makeMutex = () => { + let task = Promise.resolve() as Promise + + let taskTimeout: NodeJS.Timeout | undefined + + return { + mutex(code: () => Promise | T): Promise { + task = (async() => { + // wait for the previous task to complete + // if there is an error, we swallow so as to not block the queue + try { + await task + } catch{ } + + try { + // execute the current task + const result = await code() + return result + } finally { + clearTimeout(taskTimeout) + } + })() + // we replace the existing task, appending the new piece of execution to it + // so the next task will have to wait for this one to finish + return task + }, + } +} + +export type Mutex = ReturnType + +export const makeKeyedMutex = () => { + const map: { [id: string]: Mutex } = {} + + return { + mutex(key: string, task: () => Promise | T): Promise { + if(!map[key]) { + map[key] = makeMutex() + } + + return map[key].mutex(task) + } + } +} \ No newline at end of file diff --git a/src/Utils/messages-media.ts b/src/Utils/messages-media.ts new file mode 100644 index 00000000000..6676cf94325 --- /dev/null +++ b/src/Utils/messages-media.ts @@ -0,0 +1,736 @@ +import { Boom } from '@hapi/boom' +import { AxiosRequestConfig } from 'axios' +import { exec } from 'child_process' +import * as Crypto from 'crypto' +import { once } from 'events' +import { createReadStream, createWriteStream, promises as fs, WriteStream } from 'fs' +import type { IAudioMetadata } from 'music-metadata' +import { tmpdir } from 'os' +import { join } from 'path' +import type { Logger } from 'pino' +import { Readable, Transform } from 'stream' +import { URL } from 'url' +import { proto } from '../../WAProto' +import { DEFAULT_ORIGIN, MEDIA_HKDF_KEY_MAPPING, MEDIA_PATH_MAP } from '../Defaults' +import { BaileysEventMap, DownloadableMessage, MediaConnInfo, MediaDecryptionKeyInfo, MediaType, MessageType, SocketConfig, WAGenericMediaMessage, WAMediaUpload, WAMediaUploadFunction, WAMessageContent } from '../Types' +import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildBuffer, jidNormalizedUser } from '../WABinary' +import { aesDecryptGCM, aesEncryptGCM, hkdf } from './crypto' +import { generateMessageID } from './generics' + +const getTmpFilesDirectory = () => tmpdir() + +const getImageProcessingLibrary = async() => { + const [_jimp, sharp] = await Promise.all([ + (async() => { + const jimp = await ( + import('jimp') + .catch(() => { }) + ) + return jimp + })(), + (async() => { + const sharp = await ( + import('sharp') + .catch(() => { }) + ) + return sharp + })() + ]) + + if(sharp) { + return { sharp } + } + + const jimp = _jimp?.default || _jimp + if(jimp) { + return { jimp } + } + + throw new Boom('No image processing library available') +} + +export const hkdfInfoKey = (type: MediaType) => { + const hkdfInfo = MEDIA_HKDF_KEY_MAPPING[type] + return `WhatsApp ${hkdfInfo} Keys` +} + +/** generates all the keys required to encrypt/decrypt & sign a media message */ +export function getMediaKeys(buffer: Uint8Array | string | null | undefined, mediaType: MediaType): MediaDecryptionKeyInfo { + if(!buffer) { + throw new Boom('Cannot derive from empty media key') + } + + if(typeof buffer === 'string') { + buffer = Buffer.from(buffer.replace('data:;base64,', ''), 'base64') + } + + // expand using HKDF to 112 bytes, also pass in the relevant app info + const expandedMediaKey = hkdf(buffer, 112, { info: hkdfInfoKey(mediaType) }) + return { + iv: expandedMediaKey.slice(0, 16), + cipherKey: expandedMediaKey.slice(16, 48), + macKey: expandedMediaKey.slice(48, 80), + } +} + +/** Extracts video thumb using FFMPEG */ +const extractVideoThumb = async( + path: string, + destPath: string, + time: string, + size: { width: number, height: number }, +) => new Promise((resolve, reject) => { + const cmd = `ffmpeg -ss ${time} -i ${path} -y -vf scale=${size.width}:-1 -vframes 1 -f image2 ${destPath}` + exec(cmd, (err) => { + if(err) { + reject(err) + } else { + resolve() + } + }) +}) as Promise + +export const extractImageThumb = async(bufferOrFilePath: Readable | Buffer | string, width = 32) => { + if(bufferOrFilePath instanceof Readable) { + bufferOrFilePath = await toBuffer(bufferOrFilePath) + } + + const lib = await getImageProcessingLibrary() + if('sharp' in lib && typeof lib.sharp?.default === 'function') { + const img = lib.sharp!.default(bufferOrFilePath) + const dimensions = await img.metadata() + + const buffer = await img + .resize(width) + .jpeg({ quality: 50 }) + .toBuffer() + return { + buffer, + original: { + width: dimensions.width, + height: dimensions.height, + }, + } + } else if('jimp' in lib && typeof lib.jimp?.read === 'function') { + const { read, MIME_JPEG, RESIZE_BILINEAR, AUTO } = lib.jimp + + const jimp = await read(bufferOrFilePath as any) + const dimensions = { + width: jimp.getWidth(), + height: jimp.getHeight() + } + const buffer = await jimp + .quality(50) + .resize(width, AUTO, RESIZE_BILINEAR) + .getBufferAsync(MIME_JPEG) + return { + buffer, + original: dimensions + } + } else { + throw new Boom('No image processing library available') + } +} + +export const encodeBase64EncodedStringForUpload = (b64: string) => ( + encodeURIComponent( + b64 + .replace(/\+/g, '-') + .replace(/\//g, '_') + .replace(/\=+$/, '') + ) +) + +export const generateProfilePicture = async(mediaUpload: WAMediaUpload) => { + let bufferOrFilePath: Buffer | string + if(Buffer.isBuffer(mediaUpload)) { + bufferOrFilePath = mediaUpload + } else if('url' in mediaUpload) { + bufferOrFilePath = mediaUpload.url.toString() + } else { + bufferOrFilePath = await toBuffer(mediaUpload.stream) + } + + const lib = await getImageProcessingLibrary() + let img: Promise + if('sharp' in lib && typeof lib.sharp?.default === 'function') { + img = lib.sharp!.default(bufferOrFilePath) + .resize(640, 640) + .jpeg({ + quality: 50, + }) + .toBuffer() + } else if('jimp' in lib && typeof lib.jimp?.read === 'function') { + const { read, MIME_JPEG, RESIZE_BILINEAR } = lib.jimp + const jimp = await read(bufferOrFilePath as any) + const min = Math.min(jimp.getWidth(), jimp.getHeight()) + const cropped = jimp.crop(0, 0, min, min) + + img = cropped + .quality(50) + .resize(640, 640, RESIZE_BILINEAR) + .getBufferAsync(MIME_JPEG) + } else { + throw new Boom('No image processing library available') + } + + return { + img: await img, + } +} + +/** gets the SHA256 of the given media message */ +export const mediaMessageSHA256B64 = (message: WAMessageContent) => { + const media = Object.values(message)[0] as WAGenericMediaMessage + return media?.fileSha256 && Buffer.from(media.fileSha256).toString ('base64') +} + +export async function getAudioDuration(buffer: Buffer | string | Readable) { + const musicMetadata = await import('music-metadata') + let metadata: IAudioMetadata + if(Buffer.isBuffer(buffer)) { + metadata = await musicMetadata.parseBuffer(buffer, undefined, { duration: true }) + } else if(typeof buffer === 'string') { + const rStream = createReadStream(buffer) + try { + metadata = await musicMetadata.parseStream(rStream, undefined, { duration: true }) + } finally { + rStream.destroy() + } + } else { + metadata = await musicMetadata.parseStream(buffer, undefined, { duration: true }) + } + + return metadata.format.duration +} + +export const toReadable = (buffer: Buffer) => { + const readable = new Readable({ read: () => {} }) + readable.push(buffer) + readable.push(null) + return readable +} + +export const toBuffer = async(stream: Readable) => { + const chunks: Buffer[] = [] + for await (const chunk of stream) { + chunks.push(chunk) + } + + stream.destroy() + return Buffer.concat(chunks) +} + +export const getStream = async(item: WAMediaUpload, opts?: AxiosRequestConfig) => { + if(Buffer.isBuffer(item)) { + return { stream: toReadable(item), type: 'buffer' } as const + } + + if('stream' in item) { + return { stream: item.stream, type: 'readable' } as const + } + + if(item.url.toString().startsWith('http://') || item.url.toString().startsWith('https://')) { + return { stream: await getHttpStream(item.url, opts), type: 'remote' } as const + } + + return { stream: createReadStream(item.url), type: 'file' } as const +} + +/** generates a thumbnail for a given media, if required */ +export async function generateThumbnail( + file: string, + mediaType: 'video' | 'image', + options: { + logger?: Logger + } +) { + let thumbnail: string | undefined + let originalImageDimensions: { width: number, height: number } | undefined + if(mediaType === 'image') { + const { buffer, original } = await extractImageThumb(file) + thumbnail = buffer.toString('base64') + if(original.width && original.height) { + originalImageDimensions = { + width: original.width, + height: original.height, + } + } + } else if(mediaType === 'video') { + const imgFilename = join(getTmpFilesDirectory(), generateMessageID() + '.jpg') + try { + await extractVideoThumb(file, imgFilename, '00:00:00', { width: 32, height: 32 }) + const buff = await fs.readFile(imgFilename) + thumbnail = buff.toString('base64') + + await fs.unlink(imgFilename) + } catch(err) { + options.logger?.debug('could not generate video thumb: ' + err) + } + } + + return { + thumbnail, + originalImageDimensions + } +} + +export const getHttpStream = async(url: string | URL, options: AxiosRequestConfig & { isStream?: true } = {}) => { + const { default: axios } = await import('axios') + const fetched = await axios.get(url.toString(), { ...options, responseType: 'stream' }) + return fetched.data as Readable +} + +type EncryptedStreamOptions = { + saveOriginalFileIfRequired?: boolean + logger?: Logger + opts?: AxiosRequestConfig +} + +export const encryptedStream = async( + media: WAMediaUpload, + mediaType: MediaType, + { logger, saveOriginalFileIfRequired, opts }: EncryptedStreamOptions = {} +) => { + const { stream, type } = await getStream(media, opts) + + logger?.debug('fetched media stream') + + const mediaKey = Crypto.randomBytes(32) + const { cipherKey, iv, macKey } = getMediaKeys(mediaKey, mediaType) + const encWriteStream = new Readable({ read: () => {} }) + + let bodyPath: string | undefined + let writeStream: WriteStream | undefined + let didSaveToTmpPath = false + if(type === 'file') { + bodyPath = (media as any).url + } else if(saveOriginalFileIfRequired) { + bodyPath = join(getTmpFilesDirectory(), mediaType + generateMessageID()) + writeStream = createWriteStream(bodyPath) + didSaveToTmpPath = true + } + + let fileLength = 0 + const aes = Crypto.createCipheriv('aes-256-cbc', cipherKey, iv) + let hmac = Crypto.createHmac('sha256', macKey!).update(iv) + let sha256Plain = Crypto.createHash('sha256') + let sha256Enc = Crypto.createHash('sha256') + + try { + for await (const data of stream) { + fileLength += data.length + + if( + type === 'remote' + && opts?.maxContentLength + && fileLength + data.length > opts.maxContentLength + ) { + throw new Boom( + `content length exceeded when encrypting "${type}"`, + { + data: { media, type } + } + ) + } + + sha256Plain = sha256Plain.update(data) + if(writeStream) { + if(!writeStream.write(data)) { + await once(writeStream, 'drain') + } + } + + onChunk(aes.update(data)) + } + + onChunk(aes.final()) + + const mac = hmac.digest().slice(0, 10) + sha256Enc = sha256Enc.update(mac) + + const fileSha256 = sha256Plain.digest() + const fileEncSha256 = sha256Enc.digest() + + encWriteStream.push(mac) + encWriteStream.push(null) + + writeStream?.end() + stream.destroy() + + logger?.debug('encrypted data successfully') + + return { + mediaKey, + encWriteStream, + bodyPath, + mac, + fileEncSha256, + fileSha256, + fileLength, + didSaveToTmpPath + } + } catch(error) { + // destroy all streams with error + encWriteStream.destroy() + writeStream?.destroy() + aes.destroy() + hmac.destroy() + sha256Plain.destroy() + sha256Enc.destroy() + stream.destroy() + + if(didSaveToTmpPath) { + try { + await fs.unlink(bodyPath!) + } catch(err) { + logger?.error({ err }, 'failed to save to tmp path') + } + } + + throw error + } + + function onChunk(buff: Buffer) { + sha256Enc = sha256Enc.update(buff) + hmac = hmac.update(buff) + encWriteStream.push(buff) + } +} + +const DEF_HOST = 'mmg.whatsapp.net' +const AES_CHUNK_SIZE = 16 + +const toSmallestChunkSize = (num: number) => { + return Math.floor(num / AES_CHUNK_SIZE) * AES_CHUNK_SIZE +} + +export type MediaDownloadOptions = { + startByte?: number + endByte?: number + options?: AxiosRequestConfig +} + +export const getUrlFromDirectPath = (directPath: string) => `https://${DEF_HOST}${directPath}` + +export const downloadContentFromMessage = ( + { mediaKey, directPath, url }: DownloadableMessage, + type: MediaType, + opts: MediaDownloadOptions = { } +) => { + const downloadUrl = url || getUrlFromDirectPath(directPath!) + const keys = getMediaKeys(mediaKey, type) + + return downloadEncryptedContent(downloadUrl, keys, opts) +} + +/** + * Decrypts and downloads an AES256-CBC encrypted file given the keys. + * Assumes the SHA256 of the plaintext is appended to the end of the ciphertext + * */ +export const downloadEncryptedContent = async( + downloadUrl: string, + { cipherKey, iv }: MediaDecryptionKeyInfo, + { startByte, endByte, options }: MediaDownloadOptions = { } +) => { + let bytesFetched = 0 + let startChunk = 0 + let firstBlockIsIV = false + // if a start byte is specified -- then we need to fetch the previous chunk as that will form the IV + if(startByte) { + const chunk = toSmallestChunkSize(startByte || 0) + if(chunk) { + startChunk = chunk - AES_CHUNK_SIZE + bytesFetched = chunk + + firstBlockIsIV = true + } + } + + const endChunk = endByte ? toSmallestChunkSize(endByte || 0) + AES_CHUNK_SIZE : undefined + + const headers: AxiosRequestConfig['headers'] = { + ...options?.headers || { }, + Origin: DEFAULT_ORIGIN, + } + if(startChunk || endChunk) { + headers!.Range = `bytes=${startChunk}-` + if(endChunk) { + headers!.Range += endChunk + } + } + + // download the message + const fetched = await getHttpStream( + downloadUrl, + { + ...options || { }, + headers, + maxBodyLength: Infinity, + maxContentLength: Infinity, + } + ) + + let remainingBytes = Buffer.from([]) + + let aes: Crypto.Decipher + + const pushBytes = (bytes: Buffer, push: (bytes: Buffer) => void) => { + if(startByte || endByte) { + const start = bytesFetched >= startByte! ? undefined : Math.max(startByte! - bytesFetched, 0) + const end = bytesFetched + bytes.length < endByte! ? undefined : Math.max(endByte! - bytesFetched, 0) + + push(bytes.slice(start, end)) + + bytesFetched += bytes.length + } else { + push(bytes) + } + } + + const output = new Transform({ + transform(chunk, _, callback) { + let data = Buffer.concat([remainingBytes, chunk]) + + const decryptLength = toSmallestChunkSize(data.length) + remainingBytes = data.slice(decryptLength) + data = data.slice(0, decryptLength) + + if(!aes) { + let ivValue = iv + if(firstBlockIsIV) { + ivValue = data.slice(0, AES_CHUNK_SIZE) + data = data.slice(AES_CHUNK_SIZE) + } + + aes = Crypto.createDecipheriv('aes-256-cbc', cipherKey, ivValue) + // if an end byte that is not EOF is specified + // stop auto padding (PKCS7) -- otherwise throws an error for decryption + if(endByte) { + aes.setAutoPadding(false) + } + + } + + try { + pushBytes(aes.update(data), b => this.push(b)) + callback() + } catch(error) { + callback(error) + } + }, + final(callback) { + try { + pushBytes(aes.final(), b => this.push(b)) + callback() + } catch(error) { + callback(error) + } + }, + }) + return fetched.pipe(output, { end: true }) +} + +export function extensionForMediaMessage(message: WAMessageContent) { + const getExtension = (mimetype: string) => mimetype.split(';')[0].split('/')[1] + const type = Object.keys(message)[0] as MessageType + let extension: string + if( + type === 'locationMessage' || + type === 'liveLocationMessage' || + type === 'productMessage' + ) { + extension = '.jpeg' + } else { + const messageContent = message[type] as WAGenericMediaMessage + extension = getExtension(messageContent.mimetype!) + } + + return extension +} + +export const getWAUploadToServer = ( + { customUploadHosts, fetchAgent, logger, options }: SocketConfig, + refreshMediaConn: (force: boolean) => Promise, +): WAMediaUploadFunction => { + return async(stream, { mediaType, fileEncSha256B64, timeoutMs }) => { + const { default: axios } = await import('axios') + // send a query JSON to obtain the url & auth token to upload our media + let uploadInfo = await refreshMediaConn(false) + + let urls: { mediaUrl: string, directPath: string } | undefined + const hosts = [ ...customUploadHosts, ...uploadInfo.hosts ] + + const chunks: Buffer[] = [] + for await (const chunk of stream) { + chunks.push(chunk) + } + + const reqBody = Buffer.concat(chunks) + fileEncSha256B64 = encodeBase64EncodedStringForUpload(fileEncSha256B64) + + for(const { hostname, maxContentLengthBytes } of hosts) { + logger.debug(`uploading to "${hostname}"`) + + const auth = encodeURIComponent(uploadInfo.auth) // the auth token + const url = `https://${hostname}${MEDIA_PATH_MAP[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}` + let result: any + try { + if(maxContentLengthBytes && reqBody.length > maxContentLengthBytes) { + throw new Boom(`Body too large for "${hostname}"`, { statusCode: 413 }) + } + + const body = await axios.post( + url, + reqBody, + { + ...options, + headers: { + ...options.headers || { }, + 'Content-Type': 'application/octet-stream', + 'Origin': DEFAULT_ORIGIN + }, + httpsAgent: fetchAgent, + timeout: timeoutMs, + responseType: 'json', + maxBodyLength: Infinity, + maxContentLength: Infinity, + } + ) + result = body.data + + if(result?.url || result?.directPath) { + urls = { + mediaUrl: result.url, + directPath: result.direct_path + } + break + } else { + uploadInfo = await refreshMediaConn(true) + throw new Error(`upload failed, reason: ${JSON.stringify(result)}`) + } + } catch(error) { + if(axios.isAxiosError(error)) { + result = error.response?.data + } + + const isLast = hostname === hosts[uploadInfo.hosts.length - 1]?.hostname + logger.warn({ trace: error.stack, uploadResult: result }, `Error in uploading to ${hostname} ${isLast ? '' : ', retrying...'}`) + } + } + + if(!urls) { + throw new Boom( + 'Media upload failed on all hosts', + { statusCode: 500 } + ) + } + + return urls + } +} + +const getMediaRetryKey = (mediaKey: Buffer | Uint8Array) => { + return hkdf(mediaKey, 32, { info: 'WhatsApp Media Retry Notification' }) +} + +/** + * Generate a binary node that will request the phone to re-upload the media & return the newly uploaded URL + */ +export const encryptMediaRetryRequest = ( + key: proto.IMessageKey, + mediaKey: Buffer | Uint8Array, + meId: string +) => { + const recp: proto.IServerErrorReceipt = { stanzaId: key.id } + const recpBuffer = proto.ServerErrorReceipt.encode(recp).finish() + + const iv = Crypto.randomBytes(12) + const retryKey = getMediaRetryKey(mediaKey) + const ciphertext = aesEncryptGCM(recpBuffer, retryKey, iv, Buffer.from(key.id!)) + + const req: BinaryNode = { + tag: 'receipt', + attrs: { + id: key.id!, + to: jidNormalizedUser(meId), + type: 'server-error' + }, + content: [ + // this encrypt node is actually pretty useless + // the media is returned even without this node + // keeping it here to maintain parity with WA Web + { + tag: 'encrypt', + attrs: { }, + content: [ + { tag: 'enc_p', attrs: { }, content: ciphertext }, + { tag: 'enc_iv', attrs: { }, content: iv } + ] + }, + { + tag: 'rmr', + attrs: { + jid: key.remoteJid!, + 'from_me': (!!key.fromMe).toString(), + // @ts-ignore + participant: key.participant || undefined + } + } + ] + } + + return req +} + +export const decodeMediaRetryNode = (node: BinaryNode) => { + const rmrNode = getBinaryNodeChild(node, 'rmr')! + + const event: BaileysEventMap['messages.media-update'][number] = { + key: { + id: node.attrs.id, + remoteJid: rmrNode.attrs.jid, + fromMe: rmrNode.attrs.from_me === 'true', + participant: rmrNode.attrs.participant + } + } + + const errorNode = getBinaryNodeChild(node, 'error') + if(errorNode) { + const errorCode = +errorNode.attrs.code + event.error = new Boom( + `Failed to re-upload media (${errorCode})`, + { data: errorNode.attrs, statusCode: getStatusCodeForMediaRetry(errorCode) } + ) + } else { + const encryptedInfoNode = getBinaryNodeChild(node, 'encrypt') + const ciphertext = getBinaryNodeChildBuffer(encryptedInfoNode, 'enc_p') + const iv = getBinaryNodeChildBuffer(encryptedInfoNode, 'enc_iv') + if(ciphertext && iv) { + event.media = { ciphertext, iv } + } else { + event.error = new Boom('Failed to re-upload media (missing ciphertext)', { statusCode: 404 }) + } + } + + return event +} + +export const decryptMediaRetryData = ( + { ciphertext, iv }: { ciphertext: Uint8Array, iv: Uint8Array }, + mediaKey: Uint8Array, + msgId: string +) => { + const retryKey = getMediaRetryKey(mediaKey) + const plaintext = aesDecryptGCM(ciphertext, retryKey, iv, Buffer.from(msgId)) + return proto.MediaRetryNotification.decode(plaintext) +} + +export const getStatusCodeForMediaRetry = (code: number) => MEDIA_RETRY_STATUS_MAP[code] + +const MEDIA_RETRY_STATUS_MAP = { + [proto.MediaRetryNotification.ResultType.SUCCESS]: 200, + [proto.MediaRetryNotification.ResultType.DECRYPTION_ERROR]: 412, + [proto.MediaRetryNotification.ResultType.NOT_FOUND]: 404, + [proto.MediaRetryNotification.ResultType.GENERAL_ERROR]: 418, +} as const diff --git a/src/Utils/messages.ts b/src/Utils/messages.ts new file mode 100644 index 00000000000..8e28698359d --- /dev/null +++ b/src/Utils/messages.ts @@ -0,0 +1,895 @@ +import { Boom } from '@hapi/boom' +import axios from 'axios' +import { randomBytes } from 'crypto' +import { promises as fs } from 'fs' +import { Logger } from 'pino' +import { proto } from '../../WAProto' +import { MEDIA_KEYS, URL_EXCLUDE_REGEX, URL_REGEX, WA_DEFAULT_EPHEMERAL } from '../Defaults' +import { + AnyMediaMessageContent, + AnyMessageContent, + DownloadableMessage, + MediaGenerationOptions, + MediaType, + MessageContentGenerationOptions, + MessageGenerationOptions, + MessageGenerationOptionsFromContent, + MessageType, + MessageUserReceipt, + WAMediaUpload, + WAMessage, + WAMessageContent, + WAMessageStatus, + WAProto, + WATextMessage, +} from '../Types' +import { isJidGroup, jidNormalizedUser } from '../WABinary' +import { sha256 } from './crypto' +import { generateMessageID, getKeyAuthor, unixTimestampSeconds } from './generics' +import { downloadContentFromMessage, encryptedStream, generateThumbnail, getAudioDuration, MediaDownloadOptions } from './messages-media' + +type MediaUploadData = { + media: WAMediaUpload + caption?: string + ptt?: boolean + seconds?: number + gifPlayback?: boolean + fileName?: string + jpegThumbnail?: string + mimetype?: string + width?: number + height?: number +} + +const MIMETYPE_MAP: { [T in MediaType]?: string } = { + image: 'image/jpeg', + video: 'video/mp4', + document: 'application/pdf', + audio: 'audio/ogg; codecs=opus', + sticker: 'image/webp', + 'product-catalog-image': 'image/jpeg', +} + +const MessageTypeProto = { + 'image': WAProto.Message.ImageMessage, + 'video': WAProto.Message.VideoMessage, + 'audio': WAProto.Message.AudioMessage, + 'sticker': WAProto.Message.StickerMessage, + 'document': WAProto.Message.DocumentMessage, +} as const + +const ButtonType = proto.Message.ButtonsMessage.HeaderType + +/** + * Uses a regex to test whether the string contains a URL, and returns the URL if it does. + * @param text eg. hello https://google.com + * @returns the URL, eg. https://google.com + */ +export const extractUrlFromText = (text: string) => ( + !URL_EXCLUDE_REGEX.test(text) ? text.match(URL_REGEX)?.[0] : undefined +) + +export const generateLinkPreviewIfRequired = async(text: string, getUrlInfo: MessageGenerationOptions['getUrlInfo'], logger: MessageGenerationOptions['logger']) => { + const url = extractUrlFromText(text) + if(!!getUrlInfo && url) { + try { + const urlInfo = await getUrlInfo(url) + return urlInfo + } catch(error) { // ignore if fails + logger?.warn({ trace: error.stack }, 'url generation failed') + } + } +} + +export const prepareWAMessageMedia = async( + message: AnyMediaMessageContent, + options: MediaGenerationOptions +) => { + const logger = options.logger + + let mediaType: typeof MEDIA_KEYS[number] | undefined + for(const key of MEDIA_KEYS) { + if(key in message) { + mediaType = key + } + } + + if(!mediaType) { + throw new Boom('Invalid media type', { statusCode: 400 }) + } + + const uploadData: MediaUploadData = { + ...message, + media: message[mediaType] + } + delete uploadData[mediaType] + // check if cacheable + generate cache key + const cacheableKey = typeof uploadData.media === 'object' && + ('url' in uploadData.media) && + !!uploadData.media.url && + !!options.mediaCache && ( + // generate the key + mediaType + ':' + uploadData.media.url!.toString() + ) + + if(mediaType === 'document' && !uploadData.fileName) { + uploadData.fileName = 'file' + } + + if(!uploadData.mimetype) { + uploadData.mimetype = MIMETYPE_MAP[mediaType] + } + + // check for cache hit + if(cacheableKey) { + const mediaBuff = options.mediaCache!.get(cacheableKey) + if(mediaBuff) { + logger?.debug({ cacheableKey }, 'got media cache hit') + + const obj = WAProto.Message.decode(mediaBuff) + const key = `${mediaType}Message` + + Object.assign(obj[key], { ...uploadData, media: undefined }) + + return obj + } + } + + const requiresDurationComputation = mediaType === 'audio' && typeof uploadData.seconds === 'undefined' + const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') && + (typeof uploadData['jpegThumbnail'] === 'undefined') + const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation + const { + mediaKey, + encWriteStream, + bodyPath, + fileEncSha256, + fileSha256, + fileLength, + didSaveToTmpPath + } = await encryptedStream( + uploadData.media, + options.mediaTypeOverride || mediaType, + { + logger, + saveOriginalFileIfRequired: requiresOriginalForSomeProcessing, + opts: options.options + } + ) + // url safe Base64 encode the SHA256 hash of the body + const fileEncSha256B64 = fileEncSha256.toString('base64') + const [{ mediaUrl, directPath }] = await Promise.all([ + (async() => { + const result = await options.upload( + encWriteStream, + { fileEncSha256B64, mediaType, timeoutMs: options.mediaUploadTimeoutMs } + ) + logger?.debug({ mediaType, cacheableKey }, 'uploaded media') + return result + })(), + (async() => { + try { + if(requiresThumbnailComputation) { + const { + thumbnail, + originalImageDimensions + } = await generateThumbnail(bodyPath!, mediaType as 'image' | 'video', options) + uploadData.jpegThumbnail = thumbnail + if(!uploadData.width && originalImageDimensions) { + uploadData.width = originalImageDimensions.width + uploadData.height = originalImageDimensions.height + logger?.debug('set dimensions') + } + + logger?.debug('generated thumbnail') + } + + if(requiresDurationComputation) { + uploadData.seconds = await getAudioDuration(bodyPath!) + logger?.debug('computed audio duration') + } + } catch(error) { + logger?.warn({ trace: error.stack }, 'failed to obtain extra info') + } + })(), + ]) + .finally( + async() => { + encWriteStream.destroy() + // remove tmp files + if(didSaveToTmpPath && bodyPath) { + await fs.unlink(bodyPath) + logger?.debug('removed tmp files') + } + } + ) + + const obj = WAProto.Message.fromObject({ + [`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject( + { + url: mediaUrl, + directPath, + mediaKey, + fileEncSha256, + fileSha256, + fileLength, + mediaKeyTimestamp: unixTimestampSeconds(), + ...uploadData, + media: undefined + } + ) + }) + + if(cacheableKey) { + logger?.debug({ cacheableKey }, 'set cache') + options.mediaCache!.set(cacheableKey, WAProto.Message.encode(obj).finish()) + } + + return obj +} + +export const prepareDisappearingMessageSettingContent = (ephemeralExpiration?: number) => { + ephemeralExpiration = ephemeralExpiration || 0 + const content: WAMessageContent = { + ephemeralMessage: { + message: { + protocolMessage: { + type: WAProto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING, + ephemeralExpiration + } + } + } + } + return WAProto.Message.fromObject(content) +} + +/** + * Generate forwarded message content like WA does + * @param message the message to forward + * @param options.forceForward will show the message as forwarded even if it is from you + */ +export const generateForwardMessageContent = ( + message: WAMessage, + forceForward?: boolean +) => { + let content = message.message + if(!content) { + throw new Boom('no content in message', { statusCode: 400 }) + } + + // hacky copy + content = normalizeMessageContent(content) + content = proto.Message.decode(proto.Message.encode(content!).finish()) + + let key = Object.keys(content)[0] as MessageType + + let score = content[key].contextInfo?.forwardingScore || 0 + score += message.key.fromMe && !forceForward ? 0 : 1 + if(key === 'conversation') { + content.extendedTextMessage = { text: content[key] } + delete content.conversation + + key = 'extendedTextMessage' + } + + if(score > 0) { + content[key].contextInfo = { forwardingScore: score, isForwarded: true } + } else { + content[key].contextInfo = {} + } + + return content +} + +export const generateWAMessageContent = async( + message: AnyMessageContent, + options: MessageContentGenerationOptions +) => { + let m: WAMessageContent = {} + if('text' in message) { + const extContent = { text: message.text } as WATextMessage + + let urlInfo = message.linkPreview + if(typeof urlInfo === 'undefined') { + urlInfo = await generateLinkPreviewIfRequired(message.text, options.getUrlInfo, options.logger) + } + + if(urlInfo) { + extContent.canonicalUrl = urlInfo['canonical-url'] + extContent.matchedText = urlInfo['canonical-url'] + extContent.jpegThumbnail = urlInfo.jpegThumbnail + extContent.description = urlInfo.description + extContent.title = urlInfo.title + extContent.previewType = 0 + + const img = urlInfo.highQualityThumbnail + if(img) { + extContent.thumbnailDirectPath = img.directPath + extContent.mediaKey = img.mediaKey + extContent.mediaKeyTimestamp = img.mediaKeyTimestamp + extContent.thumbnailWidth = img.width + extContent.thumbnailHeight = img.height + extContent.thumbnailSha256 = img.fileSha256 + extContent.thumbnailEncSha256 = img.fileEncSha256 + } + } + + m.extendedTextMessage = extContent + } else if('contacts' in message) { + const contactLen = message.contacts.contacts.length + if(!contactLen) { + throw new Boom('require atleast 1 contact', { statusCode: 400 }) + } + + if(contactLen === 1) { + m.contactMessage = WAProto.Message.ContactMessage.fromObject(message.contacts.contacts[0]) + } else { + m.contactsArrayMessage = WAProto.Message.ContactsArrayMessage.fromObject(message.contacts) + } + } else if('location' in message) { + m.locationMessage = WAProto.Message.LocationMessage.fromObject(message.location) + } else if('react' in message) { + if(!message.react.senderTimestampMs) { + message.react.senderTimestampMs = Date.now() + } + + m.reactionMessage = WAProto.Message.ReactionMessage.fromObject(message.react) + } else if('delete' in message) { + m.protocolMessage = { + key: message.delete, + type: WAProto.Message.ProtocolMessage.Type.REVOKE + } + } else if('forward' in message) { + m = generateForwardMessageContent( + message.forward, + message.force + ) + } else if('disappearingMessagesInChat' in message) { + const exp = typeof message.disappearingMessagesInChat === 'boolean' ? + (message.disappearingMessagesInChat ? WA_DEFAULT_EPHEMERAL : 0) : + message.disappearingMessagesInChat + m = prepareDisappearingMessageSettingContent(exp) + } else if('buttonReply' in message) { + switch (message.type) { + case 'template': + m.templateButtonReplyMessage = { + selectedDisplayText: message.buttonReply.displayText, + selectedId: message.buttonReply.id, + selectedIndex: message.buttonReply.index, + } + break + case 'plain': + m.buttonsResponseMessage = { + selectedButtonId: message.buttonReply.id, + selectedDisplayText: message.buttonReply.displayText, + type: proto.Message.ButtonsResponseMessage.Type.DISPLAY_TEXT, + } + break + } + } else if('product' in message) { + const { imageMessage } = await prepareWAMessageMedia( + { image: message.product.productImage }, + options + ) + m.productMessage = WAProto.Message.ProductMessage.fromObject({ + ...message, + product: { + ...message.product, + productImage: imageMessage, + } + }) + } else if('listReply' in message) { + m.listResponseMessage = { ...message.listReply } + } else if('poll' in message) { + message.poll.selectableCount ||= 0 + + if(!Array.isArray(message.poll.values)) { + throw new Boom('Invalid poll values', { statusCode: 400 }) + } + + if( + message.poll.selectableCount < 0 + || message.poll.selectableCount > message.poll.values.length + ) { + throw new Boom( + `poll.selectableCount in poll should be >= 0 and <= ${message.poll.values.length}`, + { statusCode: 400 } + ) + } + + m.messageContextInfo = { + // encKey + messageSecret: message.poll.messageSecret || randomBytes(32), + } + + m.pollCreationMessage = { + name: message.poll.name, + selectableOptionsCount: message.poll.selectableCount, + options: message.poll.values.map(optionName => ({ optionName })), + } + } else { + m = await prepareWAMessageMedia( + message, + options + ) + } + + if('buttons' in message && !!message.buttons) { + const buttonsMessage: proto.Message.IButtonsMessage = { + buttons: message.buttons!.map(b => ({ ...b, type: proto.Message.ButtonsMessage.Button.Type.RESPONSE })) + } + if('text' in message) { + buttonsMessage.contentText = message.text + buttonsMessage.headerType = ButtonType.EMPTY + } else { + if('caption' in message) { + buttonsMessage.contentText = message.caption + } + + const type = Object.keys(m)[0].replace('Message', '').toUpperCase() + buttonsMessage.headerType = ButtonType[type] + + Object.assign(buttonsMessage, m) + } + + if('footer' in message && !!message.footer) { + buttonsMessage.footerText = message.footer + } + + m = { buttonsMessage } + } else if('templateButtons' in message && !!message.templateButtons) { + const msg: proto.Message.TemplateMessage.IHydratedFourRowTemplate = { + hydratedButtons: message.templateButtons + } + + if('text' in message) { + msg.hydratedContentText = message.text + } else { + + if('caption' in message) { + msg.hydratedContentText = message.caption + } + + Object.assign(msg, m) + } + + if('footer' in message && !!message.footer) { + msg.hydratedFooterText = message.footer + } + + m = { + templateMessage: { + fourRowTemplate: msg, + hydratedTemplate: msg + } + } + } + + if('sections' in message && !!message.sections) { + const listMessage: proto.Message.IListMessage = { + sections: message.sections, + buttonText: message.buttonText, + title: message.title, + footerText: message.footer, + description: message.text, + listType: proto.Message.ListMessage.ListType.SINGLE_SELECT + } + + m = { listMessage } + } + + if('viewOnce' in message && !!message.viewOnce) { + m = { viewOnceMessage: { message: m } } + } + + if ('contextInfo' in message && !!message.contextInfo) { + const [messageType] = Object.keys(m) + m[messageType].contextInfo = m[messageType] || { } + m[messageType].contextInfo = message.contextInfo + } + + if('mentions' in message && message.mentions?.length) { + const [messageType] = Object.keys(m) + m[messageType].contextInfo = m[messageType] || { } + m[messageType].contextInfo.mentionedJid = message.mentions + } + + return WAProto.Message.fromObject(m) +} + +export const generateWAMessageFromContent = ( + jid: string, + message: WAMessageContent, + options: MessageGenerationOptionsFromContent +) => { + // set timestamp to now + // if not specified + if(!options.timestamp) { + options.timestamp = new Date() + } + + const key = Object.keys(message)[0] + const timestamp = unixTimestampSeconds(options.timestamp) + const { quoted, userJid } = options + + if(quoted) { + const participant = quoted.key.fromMe ? userJid : (quoted.participant || quoted.key.participant || quoted.key.remoteJid) + + let quotedMsg = normalizeMessageContent(quoted.message)! + const msgType = getContentType(quotedMsg)! + // strip any redundant properties + quotedMsg = proto.Message.fromObject({ [msgType]: quotedMsg[msgType] }) + + const quotedContent = quotedMsg[msgType] + if(typeof quotedContent === 'object' && quotedContent && 'contextInfo' in quotedContent) { + delete quotedContent.contextInfo + } + + const contextInfo: proto.IContextInfo = message[key].contextInfo || { } + contextInfo.participant = jidNormalizedUser(participant!) + contextInfo.stanzaId = quoted.key.id + contextInfo.quotedMessage = quotedMsg + + // if a participant is quoted, then it must be a group + // hence, remoteJid of group must also be entered + if(quoted.key.participant || quoted.participant) { + contextInfo.remoteJid = quoted.key.remoteJid + } + + message[key].contextInfo = contextInfo + } + + if( + // if we want to send a disappearing message + !!options?.ephemeralExpiration && + // and it's not a protocol message -- delete, toggle disappear message + key !== 'protocolMessage' && + // already not converted to disappearing message + key !== 'ephemeralMessage' + ) { + message[key].contextInfo = { + ...(message[key].contextInfo || {}), + expiration: options.ephemeralExpiration || WA_DEFAULT_EPHEMERAL, + //ephemeralSettingTimestamp: options.ephemeralOptions.eph_setting_ts?.toString() + } + message = { + ephemeralMessage: { + message + } + } + } + + message = WAProto.Message.fromObject(message) + + const messageJSON = { + key: { + remoteJid: jid, + fromMe: true, + id: options?.messageId || generateMessageID(), + }, + message: message, + messageTimestamp: timestamp, + messageStubParameters: [], + participant: isJidGroup(jid) ? userJid : undefined, + status: WAMessageStatus.PENDING + } + return WAProto.WebMessageInfo.fromObject(messageJSON) +} + +export const generateWAMessage = async( + jid: string, + content: AnyMessageContent, + options: MessageGenerationOptions, +) => { + // ensure msg ID is with every log + options.logger = options?.logger?.child({ msgId: options.messageId }) + return generateWAMessageFromContent( + jid, + await generateWAMessageContent( + content, + options + ), + options + ) +} + +/** Get the key to access the true type of content */ +export const getContentType = (content: WAProto.IMessage | undefined) => { + if(content) { + const keys = Object.keys(content) + const key = keys.find(k => (k === 'conversation' || k.endsWith('Message')) && k !== 'senderKeyDistributionMessage') + return key as keyof typeof content + } +} + +/** + * Normalizes ephemeral, view once messages to regular message content + * Eg. image messages in ephemeral messages, in view once messages etc. + * @param content + * @returns + */ +export const normalizeMessageContent = (content: WAMessageContent | null | undefined): WAMessageContent | undefined => { + if(!content) { + return undefined + } + + // set max iterations to prevent an infinite loop + for(let i = 0;i < 5;i++) { + const inner = getFutureProofMessage(content) + if(!inner) { + break + } + + content = inner.message + } + + return content! + + function getFutureProofMessage(message: typeof content) { + return ( + message?.ephemeralMessage + || message?.viewOnceMessage + || message?.documentWithCaptionMessage + || message?.viewOnceMessageV2 + || message?.editedMessage + ) + } +} + +/** + * Extract the true message content from a message + * Eg. extracts the inner message from a disappearing message/view once message + */ +export const extractMessageContent = (content: WAMessageContent | undefined | null): WAMessageContent | undefined => { + const extractFromTemplateMessage = (msg: proto.Message.TemplateMessage.IHydratedFourRowTemplate | proto.Message.IButtonsMessage) => { + if(msg.imageMessage) { + return { imageMessage: msg.imageMessage } + } else if(msg.documentMessage) { + return { documentMessage: msg.documentMessage } + } else if(msg.videoMessage) { + return { videoMessage: msg.videoMessage } + } else if(msg.locationMessage) { + return { locationMessage: msg.locationMessage } + } else { + return { + conversation: + 'contentText' in msg + ? msg.contentText + : ('hydratedContentText' in msg ? msg.hydratedContentText : '') + } + } + } + + content = normalizeMessageContent(content) + + if(content?.buttonsMessage) { + return extractFromTemplateMessage(content.buttonsMessage!) + } + + if(content?.templateMessage?.hydratedFourRowTemplate) { + return extractFromTemplateMessage(content?.templateMessage?.hydratedFourRowTemplate) + } + + if(content?.templateMessage?.hydratedTemplate) { + return extractFromTemplateMessage(content?.templateMessage?.hydratedTemplate) + } + + if(content?.templateMessage?.fourRowTemplate) { + return extractFromTemplateMessage(content?.templateMessage?.fourRowTemplate) + } + + return content +} + +/** + * Returns the device predicted by message ID + */ +export const getDevice = (id: string) => { + const deviceType = id.length > 21 ? 'android' : id.substring(0, 2) === '3A' ? 'ios' : 'web' + return deviceType +} + +/** Upserts a receipt in the message */ +export const updateMessageWithReceipt = (msg: Pick, receipt: MessageUserReceipt) => { + msg.userReceipt = msg.userReceipt || [] + const recp = msg.userReceipt.find(m => m.userJid === receipt.userJid) + if(recp) { + Object.assign(recp, receipt) + } else { + msg.userReceipt.push(receipt) + } +} + +/** Update the message with a new reaction */ +export const updateMessageWithReaction = (msg: Pick, reaction: proto.IReaction) => { + const authorID = getKeyAuthor(reaction.key) + + const reactions = (msg.reactions || []) + .filter(r => getKeyAuthor(r.key) !== authorID) + if(reaction.text) { + reactions.push(reaction) + } + + msg.reactions = reactions +} + +/** Update the message with a new poll update */ +export const updateMessageWithPollUpdate = ( + msg: Pick, + update: proto.IPollUpdate +) => { + const authorID = getKeyAuthor(update.pollUpdateMessageKey) + + const reactions = (msg.pollUpdates || []) + .filter(r => getKeyAuthor(r.pollUpdateMessageKey) !== authorID) + if(update.vote?.selectedOptions?.length) { + reactions.push(update) + } + + msg.pollUpdates = reactions +} + +type VoteAggregation = { + name: string + voters: string[] +} + +/** + * Aggregates all poll updates in a poll. + * @param msg the poll creation message + * @param meId your jid + * @returns A list of options & their voters + */ +export function getAggregateVotesInPollMessage( + { message, pollUpdates }: Pick, + meId?: string +) { + const opts = message?.pollCreationMessage?.options || [] + const voteHashMap = opts.reduce((acc, opt) => { + const hash = sha256(Buffer.from(opt.optionName || '')).toString() + acc[hash] = { + name: opt.optionName || '', + voters: [] + } + return acc + }, {} as { [_: string]: VoteAggregation }) + + for(const update of pollUpdates || []) { + const { vote } = update + if(!vote) { + continue + } + + for(const option of vote.selectedOptions || []) { + const hash = option.toString() + let data = voteHashMap[hash] + if(!data) { + voteHashMap[hash] = { + name: 'Unknown', + voters: [] + } + data = voteHashMap[hash] + } + + voteHashMap[hash].voters.push( + getKeyAuthor(update.pollUpdateMessageKey, meId) + ) + } + } + + return Object.values(voteHashMap) +} + +/** Given a list of message keys, aggregates them by chat & sender. Useful for sending read receipts in bulk */ +export const aggregateMessageKeysNotFromMe = (keys: proto.IMessageKey[]) => { + const keyMap: { [id: string]: { jid: string, participant: string | undefined, messageIds: string[] } } = { } + for(const { remoteJid, id, participant, fromMe } of keys) { + if(!fromMe) { + const uqKey = `${remoteJid}:${participant || ''}` + if(!keyMap[uqKey]) { + keyMap[uqKey] = { + jid: remoteJid!, + participant: participant!, + messageIds: [] + } + } + + keyMap[uqKey].messageIds.push(id!) + } + } + + return Object.values(keyMap) +} + +type DownloadMediaMessageContext = { + reuploadRequest: (msg: WAMessage) => Promise + logger: Logger +} + +const REUPLOAD_REQUIRED_STATUS = [410, 404] + +/** + * Downloads the given message. Throws an error if it's not a media message + */ +export const downloadMediaMessage = async( + message: WAMessage, + type: 'buffer' | 'stream', + options: MediaDownloadOptions, + ctx?: DownloadMediaMessageContext +) => { + try { + const result = await downloadMsg() + return result + } catch(error) { + if(ctx) { + if(axios.isAxiosError(error)) { + // check if the message requires a reupload + if(REUPLOAD_REQUIRED_STATUS.includes(error.response?.status!)) { + ctx.logger.info({ key: message.key }, 'sending reupload media request...') + // request reupload + message = await ctx.reuploadRequest(message) + const result = await downloadMsg() + return result + } + } + } + + throw error + } + + async function downloadMsg() { + const mContent = extractMessageContent(message.message) + if(!mContent) { + throw new Boom('No message present', { statusCode: 400, data: message }) + } + + const contentType = getContentType(mContent) + let mediaType = contentType?.replace('Message', '') as MediaType + const media = mContent[contentType!] + + if(!media || typeof media !== 'object' || (!('url' in media) && !('thumbnailDirectPath' in media))) { + throw new Boom(`"${contentType}" message is not a media message`) + } + + let download: DownloadableMessage + if('thumbnailDirectPath' in media && !('url' in media)) { + download = { + directPath: media.thumbnailDirectPath, + mediaKey: media.mediaKey + } + mediaType = 'thumbnail-link' + } else { + download = media + } + + const stream = await downloadContentFromMessage(download, mediaType, options) + if(type === 'buffer') { + const bufferArray: Buffer[] = [] + for await (const chunk of stream) { + bufferArray.push(chunk) + } + + return Buffer.concat(bufferArray) + } + + return stream + } +} + +/** Checks whether the given message is a media message; if it is returns the inner content */ +export const assertMediaContent = (content: proto.IMessage | null | undefined) => { + content = extractMessageContent(content) + const mediaContent = content?.documentMessage + || content?.imageMessage + || content?.videoMessage + || content?.audioMessage + || content?.stickerMessage + if(!mediaContent) { + throw new Boom( + 'given message is not a media message', + { statusCode: 400, data: content } + ) + } + + return mediaContent +} \ No newline at end of file diff --git a/src/Utils/noise-handler.ts b/src/Utils/noise-handler.ts new file mode 100644 index 00000000000..bd61ddfc521 --- /dev/null +++ b/src/Utils/noise-handler.ts @@ -0,0 +1,169 @@ +import { Boom } from '@hapi/boom' +import { Logger } from 'pino' +import { proto } from '../../WAProto' +import { NOISE_MODE, NOISE_WA_HEADER, WA_CERT_DETAILS } from '../Defaults' +import { KeyPair } from '../Types' +import { BinaryNode, decodeBinaryNode } from '../WABinary' +import { aesDecryptGCM, aesEncryptGCM, Curve, hkdf, sha256 } from './crypto' + +const generateIV = (counter: number) => { + const iv = new ArrayBuffer(12) + new DataView(iv).setUint32(8, counter) + + return new Uint8Array(iv) +} + +export const makeNoiseHandler = ( + { public: publicKey, private: privateKey }: KeyPair, + logger: Logger +) => { + logger = logger.child({ class: 'ns' }) + + const authenticate = (data: Uint8Array) => { + if(!isFinished) { + hash = sha256(Buffer.concat([hash, data])) + } + } + + const encrypt = (plaintext: Uint8Array) => { + const result = aesEncryptGCM(plaintext, encKey, generateIV(writeCounter), hash) + + writeCounter += 1 + + authenticate(result) + return result + } + + const decrypt = (ciphertext: Uint8Array) => { + // before the handshake is finished, we use the same counter + // after handshake, the counters are different + const iv = generateIV(isFinished ? readCounter : writeCounter) + const result = aesDecryptGCM(ciphertext, decKey, iv, hash) + + if(isFinished) { + readCounter += 1 + } else { + writeCounter += 1 + } + + authenticate(ciphertext) + return result + } + + const localHKDF = (data: Uint8Array) => { + const key = hkdf(Buffer.from(data), 64, { salt, info: '' }) + return [key.slice(0, 32), key.slice(32)] + } + + const mixIntoKey = (data: Uint8Array) => { + const [write, read] = localHKDF(data) + salt = write + encKey = read + decKey = read + readCounter = 0 + writeCounter = 0 + } + + const finishInit = () => { + const [write, read] = localHKDF(new Uint8Array(0)) + encKey = write + decKey = read + hash = Buffer.from([]) + readCounter = 0 + writeCounter = 0 + isFinished = true + } + + const data = Buffer.from(NOISE_MODE) + let hash = Buffer.from(data.byteLength === 32 ? data : sha256(data)) + let salt = hash + let encKey = hash + let decKey = hash + let readCounter = 0 + let writeCounter = 0 + let isFinished = false + let sentIntro = false + + let inBytes = Buffer.alloc(0) + + authenticate(NOISE_WA_HEADER) + authenticate(publicKey) + + return { + encrypt, + decrypt, + authenticate, + mixIntoKey, + finishInit, + processHandshake: ({ serverHello }: proto.HandshakeMessage, noiseKey: KeyPair) => { + authenticate(serverHello!.ephemeral!) + mixIntoKey(Curve.sharedKey(privateKey, serverHello!.ephemeral!)) + + const decStaticContent = decrypt(serverHello!.static!) + mixIntoKey(Curve.sharedKey(privateKey, decStaticContent)) + + const certDecoded = decrypt(serverHello!.payload!) + const { intermediate: certIntermediate } = proto.CertChain.decode(certDecoded) + + const { issuerSerial } = proto.CertChain.NoiseCertificate.Details.decode(certIntermediate!.details!) + + if(issuerSerial !== WA_CERT_DETAILS.SERIAL) { + throw new Boom('certification match failed', { statusCode: 400 }) + } + + const keyEnc = encrypt(noiseKey.public) + mixIntoKey(Curve.sharedKey(noiseKey.private, serverHello!.ephemeral!)) + + return keyEnc + }, + encodeFrame: (data: Buffer | Uint8Array) => { + if(isFinished) { + data = encrypt(data) + } + + const introSize = sentIntro ? 0 : NOISE_WA_HEADER.length + const frame = Buffer.alloc(introSize + 3 + data.byteLength) + + if(!sentIntro) { + frame.set(NOISE_WA_HEADER) + sentIntro = true + } + + frame.writeUInt8(data.byteLength >> 16, introSize) + frame.writeUInt16BE(65535 & data.byteLength, introSize + 1) + frame.set(data, introSize + 3) + + return frame + }, + decodeFrame: (newData: Buffer | Uint8Array, onFrame: (buff: Uint8Array | BinaryNode) => void) => { + // the binary protocol uses its own framing mechanism + // on top of the WS frames + // so we get this data and separate out the frames + const getBytesSize = () => { + if(inBytes.length >= 3) { + return (inBytes.readUInt8() << 16) | inBytes.readUInt16BE(1) + } + } + + inBytes = Buffer.concat([ inBytes, newData ]) + + logger.trace(`recv ${newData.length} bytes, total recv ${inBytes.length} bytes`) + + let size = getBytesSize() + while(size && inBytes.length >= size + 3) { + let frame: Uint8Array | BinaryNode = inBytes.slice(3, size + 3) + inBytes = inBytes.slice(size + 3) + + if(isFinished) { + const result = decrypt(frame as Uint8Array) + frame = decodeBinaryNode(result) + } + + logger.trace({ msg: (frame as any)?.attrs?.id }, 'recv frame') + + onFrame(frame) + size = getBytesSize() + } + } + } +} \ No newline at end of file diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts new file mode 100644 index 00000000000..294a63f45e9 --- /dev/null +++ b/src/Utils/process-message.ts @@ -0,0 +1,390 @@ +import { AxiosRequestConfig } from 'axios' +import type { Logger } from 'pino' +import { proto } from '../../WAProto' +import { AuthenticationCreds, BaileysEventEmitter, Chat, GroupMetadata, ParticipantAction, SignalKeyStoreWithTransaction, SocketConfig, WAMessageStubType } from '../Types' +import { getContentType, normalizeMessageContent } from '../Utils/messages' +import { areJidsSameUser, isJidBroadcast, isJidStatusBroadcast, jidNormalizedUser } from '../WABinary' +import { aesDecryptGCM, hmacSign } from './crypto' +import { getKeyAuthor, toNumber } from './generics' +import { downloadAndProcessHistorySyncNotification } from './history' + +type ProcessMessageContext = { + shouldProcessHistoryMsg: boolean + creds: AuthenticationCreds + keyStore: SignalKeyStoreWithTransaction + ev: BaileysEventEmitter + getMessage: SocketConfig['getMessage'] + logger?: Logger + options: AxiosRequestConfig<{}> +} + +const REAL_MSG_STUB_TYPES = new Set([ + WAMessageStubType.CALL_MISSED_GROUP_VIDEO, + WAMessageStubType.CALL_MISSED_GROUP_VOICE, + WAMessageStubType.CALL_MISSED_VIDEO, + WAMessageStubType.CALL_MISSED_VOICE +]) + +const REAL_MSG_REQ_ME_STUB_TYPES = new Set([ + WAMessageStubType.GROUP_PARTICIPANT_ADD +]) + +/** Cleans a received message to further processing */ +export const cleanMessage = (message: proto.IWebMessageInfo, meId: string) => { + // ensure remoteJid and participant doesn't have device or agent in it + message.key.remoteJid = jidNormalizedUser(message.key.remoteJid!) + message.key.participant = message.key.participant ? jidNormalizedUser(message.key.participant!) : undefined + const content = normalizeMessageContent(message.message) + // if the message has a reaction, ensure fromMe & remoteJid are from our perspective + if(content?.reactionMessage) { + normaliseKey(content.reactionMessage.key!) + } + + if(content?.pollUpdateMessage) { + normaliseKey(content.pollUpdateMessage.pollCreationMessageKey!) + } + + function normaliseKey(msgKey: proto.IMessageKey) { + // if the reaction is from another user + // we've to correctly map the key to this user's perspective + if(!message.key.fromMe) { + // if the sender believed the message being reacted to is not from them + // we've to correct the key to be from them, or some other participant + msgKey.fromMe = !msgKey.fromMe + ? areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meId) + // if the message being reacted to, was from them + // fromMe automatically becomes false + : false + // set the remoteJid to being the same as the chat the message came from + msgKey.remoteJid = message.key.remoteJid + // set participant of the message + msgKey.participant = msgKey.participant || message.key.participant + } + } +} + +export const isRealMessage = (message: proto.IWebMessageInfo, meId: string) => { + const normalizedContent = normalizeMessageContent(message.message) + const hasSomeContent = !!getContentType(normalizedContent) + return ( + !!normalizedContent + || REAL_MSG_STUB_TYPES.has(message.messageStubType!) + || ( + REAL_MSG_REQ_ME_STUB_TYPES.has(message.messageStubType!) + && message.messageStubParameters?.some(p => areJidsSameUser(meId, p)) + ) + ) + && hasSomeContent + && !normalizedContent?.protocolMessage + && !normalizedContent?.reactionMessage + && !normalizedContent?.pollUpdateMessage +} + +export const shouldIncrementChatUnread = (message: proto.IWebMessageInfo) => ( + !message.key.fromMe && !message.messageStubType +) + +/** + * Get the ID of the chat from the given key. + * Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant + */ +export const getChatId = ({ remoteJid, participant, fromMe }: proto.IMessageKey) => { + if( + isJidBroadcast(remoteJid!) + && !isJidStatusBroadcast(remoteJid!) + && !fromMe + ) { + return participant! + } + + return remoteJid! +} + +type PollContext = { + /** normalised jid of the person that created the poll */ + pollCreatorJid: string + /** ID of the poll creation message */ + pollMsgId: string + /** poll creation message enc key */ + pollEncKey: Uint8Array + /** jid of the person that voted */ + voterJid: string +} + +/** + * Decrypt a poll vote + * @param vote encrypted vote + * @param ctx additional info about the poll required for decryption + * @returns list of SHA256 options + */ +export function decryptPollVote( + { encPayload, encIv }: proto.Message.IPollEncValue, + { + pollCreatorJid, + pollMsgId, + pollEncKey, + voterJid, + }: PollContext +) { + const sign = Buffer.concat( + [ + toBinary(pollMsgId), + toBinary(pollCreatorJid), + toBinary(voterJid), + toBinary('Poll Vote'), + new Uint8Array([1]) + ] + ) + + const key0 = hmacSign(pollEncKey, new Uint8Array(32), 'sha256') + const decKey = hmacSign(sign, key0, 'sha256') + const aad = toBinary(`${pollMsgId}\u0000${voterJid}`) + + const decrypted = aesDecryptGCM(encPayload!, decKey, encIv!, aad) + return proto.Message.PollVoteMessage.decode(decrypted) + + function toBinary(txt: string) { + return Buffer.from(txt) + } +} + +const processMessage = async( + message: proto.IWebMessageInfo, + { + shouldProcessHistoryMsg, + ev, + creds, + keyStore, + logger, + options, + getMessage + }: ProcessMessageContext +) => { + const meId = creds.me!.id + const { accountSettings } = creds + + const chat: Partial = { id: jidNormalizedUser(getChatId(message.key)) } + const isRealMsg = isRealMessage(message, meId) + + if(isRealMsg) { + chat.conversationTimestamp = toNumber(message.messageTimestamp) + // only increment unread count if not CIPHERTEXT and from another person + if(shouldIncrementChatUnread(message)) { + chat.unreadCount = (chat.unreadCount || 0) + 1 + } + } + + const content = normalizeMessageContent(message.message) + + // unarchive chat if it's a real message, or someone reacted to our message + // and we've the unarchive chats setting on + if( + (isRealMsg || content?.reactionMessage?.key?.fromMe) + && accountSettings?.unarchiveChats + ) { + chat.archived = false + chat.readOnly = false + } + + const protocolMsg = content?.protocolMessage + if(protocolMsg) { + switch (protocolMsg.type) { + case proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION: + const histNotification = protocolMsg!.historySyncNotification! + const process = shouldProcessHistoryMsg + const isLatest = !creds.processedHistoryMessages?.length + + logger?.info({ + histNotification, + process, + id: message.key.id, + isLatest, + }, 'got history notification') + + if(process) { + ev.emit('creds.update', { + processedHistoryMessages: [ + ...(creds.processedHistoryMessages || []), + { key: message.key, messageTimestamp: message.messageTimestamp } + ] + }) + + const data = await downloadAndProcessHistorySyncNotification( + histNotification, + options + ) + + ev.emit('messaging-history.set', { ...data, isLatest }) + } + + break + case proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE: + const keys = protocolMsg.appStateSyncKeyShare!.keys + if(keys?.length) { + let newAppStateSyncKeyId = '' + await keyStore.transaction( + async() => { + const newKeys: string[] = [] + for(const { keyData, keyId } of keys) { + const strKeyId = Buffer.from(keyId!.keyId!).toString('base64') + newKeys.push(strKeyId) + + await keyStore.set({ 'app-state-sync-key': { [strKeyId]: keyData! } }) + + newAppStateSyncKeyId = strKeyId + } + + logger?.info( + { newAppStateSyncKeyId, newKeys }, + 'injecting new app state sync keys' + ) + } + ) + + ev.emit('creds.update', { myAppStateKeyId: newAppStateSyncKeyId }) + } else { + logger?.info({ protocolMsg }, 'recv app state sync with 0 keys') + } + + break + case proto.Message.ProtocolMessage.Type.REVOKE: + ev.emit('messages.update', [ + { + key: { + ...message.key, + id: protocolMsg.key!.id + }, + update: { message: null, messageStubType: WAMessageStubType.REVOKE, key: message.key } + } + ]) + break + case proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING: + Object.assign(chat, { + ephemeralSettingTimestamp: toNumber(message.messageTimestamp), + ephemeralExpiration: protocolMsg.ephemeralExpiration || null + }) + break + } + } else if(content?.reactionMessage) { + const reaction: proto.IReaction = { + ...content.reactionMessage, + key: message.key, + } + ev.emit('messages.reaction', [{ + reaction, + key: content.reactionMessage!.key!, + }]) + } else if(message.messageStubType) { + const jid = message.key!.remoteJid! + //let actor = whatsappID (message.participant) + let participants: string[] + const emitParticipantsUpdate = (action: ParticipantAction) => ( + ev.emit('group-participants.update', { id: jid, participants, action }) + ) + const emitGroupUpdate = (update: Partial) => { + ev.emit('groups.update', [{ id: jid, ...update }]) + } + + const participantsIncludesMe = () => participants.find(jid => areJidsSameUser(meId, jid)) + + switch (message.messageStubType) { + case WAMessageStubType.GROUP_PARTICIPANT_LEAVE: + case WAMessageStubType.GROUP_PARTICIPANT_REMOVE: + participants = message.messageStubParameters || [] + emitParticipantsUpdate('remove') + // mark the chat read only if you left the group + if(participantsIncludesMe()) { + chat.readOnly = true + } + + break + case WAMessageStubType.GROUP_PARTICIPANT_ADD: + case WAMessageStubType.GROUP_PARTICIPANT_INVITE: + case WAMessageStubType.GROUP_PARTICIPANT_ADD_REQUEST_JOIN: + participants = message.messageStubParameters || [] + if(participantsIncludesMe()) { + chat.readOnly = false + } + + emitParticipantsUpdate('add') + break + case WAMessageStubType.GROUP_PARTICIPANT_DEMOTE: + participants = message.messageStubParameters || [] + emitParticipantsUpdate('demote') + break + case WAMessageStubType.GROUP_PARTICIPANT_PROMOTE: + participants = message.messageStubParameters || [] + emitParticipantsUpdate('promote') + break + case WAMessageStubType.GROUP_CHANGE_ANNOUNCE: + const announceValue = message.messageStubParameters?.[0] + emitGroupUpdate({ announce: announceValue === 'true' || announceValue === 'on' }) + break + case WAMessageStubType.GROUP_CHANGE_RESTRICT: + const restrictValue = message.messageStubParameters?.[0] + emitGroupUpdate({ restrict: restrictValue === 'true' || restrictValue === 'on' }) + break + case WAMessageStubType.GROUP_CHANGE_SUBJECT: + const name = message.messageStubParameters?.[0] + chat.name = name + emitGroupUpdate({ subject: name }) + break + case WAMessageStubType.GROUP_CHANGE_INVITE_LINK: + const code = message.messageStubParameters?.[0] + emitGroupUpdate({ inviteCode: code }) + break + } + } else if(content?.pollUpdateMessage) { + const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey! + // we need to fetch the poll creation message to get the poll enc key + const pollMsg = await getMessage(creationMsgKey) + if(pollMsg) { + const meIdNormalised = jidNormalizedUser(meId) + const pollCreatorJid = getKeyAuthor(creationMsgKey, meIdNormalised) + const voterJid = getKeyAuthor(message.key!, meIdNormalised) + const pollEncKey = pollMsg.messageContextInfo?.messageSecret! + + try { + const voteMsg = decryptPollVote( + content.pollUpdateMessage.vote!, + { + pollEncKey, + pollCreatorJid, + pollMsgId: creationMsgKey.id!, + voterJid, + } + ) + ev.emit('messages.update', [ + { + key: creationMsgKey, + update: { + pollUpdates: [ + { + pollUpdateMessageKey: message.key, + vote: voteMsg, + senderTimestampMs: message.messageTimestamp, + } + ] + } + } + ]) + } catch(err) { + logger?.warn( + { err, creationMsgKey }, + 'failed to decrypt poll vote' + ) + } + } else { + logger?.warn( + { creationMsgKey }, + 'poll creation message not found, cannot decrypt update' + ) + } + } + + if(Object.keys(chat).length > 1) { + ev.emit('chats.update', [chat]) + } +} + +export default processMessage \ No newline at end of file diff --git a/src/Utils/signal.ts b/src/Utils/signal.ts new file mode 100644 index 00000000000..e1c44b96134 --- /dev/null +++ b/src/Utils/signal.ts @@ -0,0 +1,177 @@ +import { KEY_BUNDLE_TYPE } from '../Defaults' +import { SignalRepository } from '../Types' +import { AuthenticationCreds, AuthenticationState, KeyPair, SignalIdentity, SignalKeyStore, SignedKeyPair } from '../Types/Auth' +import { assertNodeErrorFree, BinaryNode, getBinaryNodeChild, getBinaryNodeChildBuffer, getBinaryNodeChildren, getBinaryNodeChildUInt, jidDecode, JidWithDevice, S_WHATSAPP_NET } from '../WABinary' +import { Curve, generateSignalPubKey } from './crypto' +import { encodeBigEndian } from './generics' + +export const createSignalIdentity = ( + wid: string, + accountSignatureKey: Uint8Array +): SignalIdentity => { + return { + identifier: { name: wid, deviceId: 0 }, + identifierKey: generateSignalPubKey(accountSignatureKey) + } +} + +export const getPreKeys = async({ get }: SignalKeyStore, min: number, limit: number) => { + const idList: string[] = [] + for(let id = min; id < limit;id++) { + idList.push(id.toString()) + } + + return get('pre-key', idList) +} + +export const generateOrGetPreKeys = (creds: AuthenticationCreds, range: number) => { + const avaliable = creds.nextPreKeyId - creds.firstUnuploadedPreKeyId + const remaining = range - avaliable + const lastPreKeyId = creds.nextPreKeyId + remaining - 1 + const newPreKeys: { [id: number]: KeyPair } = { } + if(remaining > 0) { + for(let i = creds.nextPreKeyId;i <= lastPreKeyId;i++) { + newPreKeys[i] = Curve.generateKeyPair() + } + } + + return { + newPreKeys, + lastPreKeyId, + preKeysRange: [creds.firstUnuploadedPreKeyId, range] as const, + } +} + +export const xmppSignedPreKey = (key: SignedKeyPair): BinaryNode => ( + { + tag: 'skey', + attrs: { }, + content: [ + { tag: 'id', attrs: { }, content: encodeBigEndian(key.keyId, 3) }, + { tag: 'value', attrs: { }, content: key.keyPair.public }, + { tag: 'signature', attrs: { }, content: key.signature } + ] + } +) + +export const xmppPreKey = (pair: KeyPair, id: number): BinaryNode => ( + { + tag: 'key', + attrs: { }, + content: [ + { tag: 'id', attrs: { }, content: encodeBigEndian(id, 3) }, + { tag: 'value', attrs: { }, content: pair.public } + ] + } +) + +export const parseAndInjectE2ESessions = async( + node: BinaryNode, + repository: SignalRepository +) => { + const extractKey = (key: BinaryNode) => ( + key ? ({ + keyId: getBinaryNodeChildUInt(key, 'id', 3)!, + publicKey: generateSignalPubKey(getBinaryNodeChildBuffer(key, 'value')!)!, + signature: getBinaryNodeChildBuffer(key, 'signature')!, + }) : undefined + ) + const nodes = getBinaryNodeChildren(getBinaryNodeChild(node, 'list'), 'user') + for(const node of nodes) { + assertNodeErrorFree(node) + } + + await Promise.all( + nodes.map( + async node => { + const signedKey = getBinaryNodeChild(node, 'skey')! + const key = getBinaryNodeChild(node, 'key')! + const identity = getBinaryNodeChildBuffer(node, 'identity')! + const jid = node.attrs.jid + const registrationId = getBinaryNodeChildUInt(node, 'registration', 4) + + await repository.injectE2ESession({ + jid, + session: { + registrationId: registrationId!, + identityKey: generateSignalPubKey(identity), + signedPreKey: extractKey(signedKey)!, + preKey: extractKey(key)! + } + }) + } + ) + ) +} + +export const extractDeviceJids = (result: BinaryNode, myJid: string, excludeZeroDevices: boolean) => { + const { user: myUser, device: myDevice } = jidDecode(myJid)! + const extracted: JidWithDevice[] = [] + for(const node of result.content as BinaryNode[]) { + const list = getBinaryNodeChild(node, 'list')?.content + if(list && Array.isArray(list)) { + for(const item of list) { + const { user } = jidDecode(item.attrs.jid)! + const devicesNode = getBinaryNodeChild(item, 'devices') + const deviceListNode = getBinaryNodeChild(devicesNode, 'device-list') + if(Array.isArray(deviceListNode?.content)) { + for(const { tag, attrs } of deviceListNode!.content) { + const device = +attrs.id + if( + tag === 'device' && // ensure the "device" tag + (!excludeZeroDevices || device !== 0) && // if zero devices are not-excluded, or device is non zero + (myUser !== user || myDevice !== device) && // either different user or if me user, not this device + (device === 0 || !!attrs['key-index']) // ensure that "key-index" is specified for "non-zero" devices, produces a bad req otherwise + ) { + extracted.push({ user, device }) + } + } + } + } + } + } + + return extracted +} + +/** + * get the next N keys for upload or processing + * @param count number of pre-keys to get or generate + */ +export const getNextPreKeys = async({ creds, keys }: AuthenticationState, count: number) => { + const { newPreKeys, lastPreKeyId, preKeysRange } = generateOrGetPreKeys(creds, count) + + const update: Partial = { + nextPreKeyId: Math.max(lastPreKeyId + 1, creds.nextPreKeyId), + firstUnuploadedPreKeyId: Math.max(creds.firstUnuploadedPreKeyId, lastPreKeyId + 1) + } + + await keys.set({ 'pre-key': newPreKeys }) + + const preKeys = await getPreKeys(keys, preKeysRange[0], preKeysRange[0] + preKeysRange[1]) + + return { update, preKeys } +} + +export const getNextPreKeysNode = async(state: AuthenticationState, count: number) => { + const { creds } = state + const { update, preKeys } = await getNextPreKeys(state, count) + + const node: BinaryNode = { + tag: 'iq', + attrs: { + xmlns: 'encrypt', + type: 'set', + to: S_WHATSAPP_NET, + }, + content: [ + { tag: 'registration', attrs: { }, content: encodeBigEndian(creds.registrationId) }, + { tag: 'type', attrs: { }, content: KEY_BUNDLE_TYPE }, + { tag: 'identity', attrs: { }, content: creds.signedIdentityKey.public }, + { tag: 'list', attrs: { }, content: Object.keys(preKeys).map(k => xmppPreKey(preKeys[+k], +k)) }, + xmppSignedPreKey(creds.signedPreKey) + ] + } + + return { update, node } +} \ No newline at end of file diff --git a/src/Utils/use-multi-file-auth-state.ts b/src/Utils/use-multi-file-auth-state.ts new file mode 100644 index 00000000000..4758d3c421f --- /dev/null +++ b/src/Utils/use-multi-file-auth-state.ts @@ -0,0 +1,90 @@ +import { mkdir, readFile, stat, unlink, writeFile } from 'fs/promises' +import { join } from 'path' +import { proto } from '../../WAProto' +import { AuthenticationCreds, AuthenticationState, SignalDataTypeMap } from '../Types' +import { initAuthCreds } from './auth-utils' +import { BufferJSON } from './generics' + +/** + * stores the full authentication state in a single folder. + * Far more efficient than singlefileauthstate + * + * Again, I wouldn't endorse this for any production level use other than perhaps a bot. + * Would recommend writing an auth state for use with a proper SQL or No-SQL DB + * */ +export const useMultiFileAuthState = async(folder: string): Promise<{ state: AuthenticationState, saveCreds: () => Promise }> => { + + const writeData = (data: any, file: string) => { + return writeFile(join(folder, fixFileName(file)!), JSON.stringify(data, BufferJSON.replacer)) + } + + const readData = async(file: string) => { + try { + const data = await readFile(join(folder, fixFileName(file)!), { encoding: 'utf-8' }) + return JSON.parse(data, BufferJSON.reviver) + } catch(error) { + return null + } + } + + const removeData = async(file: string) => { + try { + await unlink(join(folder, fixFileName(file)!)) + } catch{ + + } + } + + const folderInfo = await stat(folder).catch(() => { }) + if(folderInfo) { + if(!folderInfo.isDirectory()) { + throw new Error(`found something that is not a directory at ${folder}, either delete it or specify a different location`) + } + } else { + await mkdir(folder, { recursive: true }) + } + + const fixFileName = (file?: string) => file?.replace(/\//g, '__')?.replace(/:/g, '-') + + const creds: AuthenticationCreds = await readData('creds.json') || initAuthCreds() + + return { + state: { + creds, + keys: { + get: async(type, ids) => { + const data: { [_: string]: SignalDataTypeMap[typeof type] } = { } + await Promise.all( + ids.map( + async id => { + let value = await readData(`${type}-${id}.json`) + if(type === 'app-state-sync-key' && value) { + value = proto.Message.AppStateSyncKeyData.fromObject(value) + } + + data[id] = value + } + ) + ) + + return data + }, + set: async(data) => { + const tasks: Promise[] = [] + for(const category in data) { + for(const id in data[category]) { + const value = data[category][id] + const file = `${category}-${id}.json` + tasks.push(value ? writeData(value, file) : removeData(file)) + } + } + + await Promise.all(tasks) + } + } + }, + saveCreds: () => { + return writeData(creds, 'creds.json') + } + } +} \ No newline at end of file diff --git a/src/Utils/validate-connection.ts b/src/Utils/validate-connection.ts new file mode 100644 index 00000000000..444634d853f --- /dev/null +++ b/src/Utils/validate-connection.ts @@ -0,0 +1,208 @@ +import { Boom } from '@hapi/boom' +import { createHash } from 'crypto' +import { proto } from '../../WAProto' +import { KEY_BUNDLE_TYPE } from '../Defaults' +import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types' +import { BinaryNode, getBinaryNodeChild, jidDecode, S_WHATSAPP_NET } from '../WABinary' +import { Curve, hmacSign } from './crypto' +import { encodeBigEndian } from './generics' +import { createSignalIdentity } from './signal' + +type ClientPayloadConfig = Pick + +const getUserAgent = ({ version }: ClientPayloadConfig): proto.ClientPayload.IUserAgent => { + const osVersion = '0.1' + return { + appVersion: { + primary: version[0], + secondary: version[1], + tertiary: version[2], + }, + platform: proto.ClientPayload.UserAgent.Platform.WEB, + releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE, + mcc: '000', + mnc: '000', + osVersion: osVersion, + manufacturer: '', + device: 'Desktop', + osBuildNumber: osVersion, + localeLanguageIso6391: 'en', + localeCountryIso31661Alpha2: 'US', + } +} + +const PLATFORM_MAP = { + 'Mac OS': proto.ClientPayload.WebInfo.WebSubPlatform.DARWIN, + 'Windows': proto.ClientPayload.WebInfo.WebSubPlatform.WIN32 +} + +const getWebInfo = (config: ClientPayloadConfig): proto.ClientPayload.IWebInfo => { + let webSubPlatform = proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER + if(config.syncFullHistory && PLATFORM_MAP[config.browser[0]]) { + webSubPlatform = PLATFORM_MAP[config.browser[0]] + } + + return { webSubPlatform } +} + +const getClientPayload = (config: ClientPayloadConfig): proto.IClientPayload => { + return { + connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN, + connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED, + userAgent: getUserAgent(config), + webInfo: getWebInfo(config), + } +} + +export const generateLoginNode = (userJid: string, config: ClientPayloadConfig): proto.IClientPayload => { + const { user, device } = jidDecode(userJid)! + const payload: proto.IClientPayload = { + ...getClientPayload(config), + passive: true, + username: +user, + device: device, + } + return proto.ClientPayload.fromObject(payload) +} + +export const generateRegistrationNode = ( + { registrationId, signedPreKey, signedIdentityKey }: SignalCreds, + config: ClientPayloadConfig +) => { + // the app version needs to be md5 hashed + // and passed in + const appVersionBuf = createHash('md5') + .update(config.version.join('.')) // join as string + .digest() + const browserVersion = config.browser[2].split('.') + + const companion: proto.IDeviceProps = { + os: config.browser[0], + version: { + primary: +(browserVersion[0] || 0), + secondary: +(browserVersion[1] || 1), + tertiary: +(browserVersion[2] || 0), + }, + platformType: proto.DeviceProps.PlatformType[config.browser[1].toUpperCase()] + || proto.DeviceProps.PlatformType.UNKNOWN, + requireFullSync: config.syncFullHistory, + } + + const companionProto = proto.DeviceProps.encode(companion).finish() + + const registerPayload: proto.IClientPayload = { + ...getClientPayload(config), + passive: false, + devicePairingData: { + buildHash: appVersionBuf, + deviceProps: companionProto, + eRegid: encodeBigEndian(registrationId), + eKeytype: KEY_BUNDLE_TYPE, + eIdent: signedIdentityKey.public, + eSkeyId: encodeBigEndian(signedPreKey.keyId, 3), + eSkeyVal: signedPreKey.keyPair.public, + eSkeySig: signedPreKey.signature, + }, + } + + return proto.ClientPayload.fromObject(registerPayload) +} + +export const configureSuccessfulPairing = ( + stanza: BinaryNode, + { advSecretKey, signedIdentityKey, signalIdentities }: Pick +) => { + const msgId = stanza.attrs.id + + const pairSuccessNode = getBinaryNodeChild(stanza, 'pair-success') + + const deviceIdentityNode = getBinaryNodeChild(pairSuccessNode, 'device-identity') + const platformNode = getBinaryNodeChild(pairSuccessNode, 'platform') + const deviceNode = getBinaryNodeChild(pairSuccessNode, 'device') + const businessNode = getBinaryNodeChild(pairSuccessNode, 'biz') + + if(!deviceIdentityNode || !deviceNode) { + throw new Boom('Missing device-identity or device in pair success node', { data: stanza }) + } + + const bizName = businessNode?.attrs.name + const jid = deviceNode.attrs.jid + + const { details, hmac } = proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content as Buffer) + // check HMAC matches + const advSign = hmacSign(details, Buffer.from(advSecretKey, 'base64')) + if(Buffer.compare(hmac, advSign) !== 0) { + throw new Boom('Invalid account signature') + } + + const account = proto.ADVSignedDeviceIdentity.decode(details) + const { accountSignatureKey, accountSignature, details: deviceDetails } = account + // verify the device signature matches + const accountMsg = Buffer.concat([ Buffer.from([6, 0]), deviceDetails, signedIdentityKey.public ]) + if(!Curve.verify(accountSignatureKey, accountMsg, accountSignature)) { + throw new Boom('Failed to verify account signature') + } + + // sign the details with our identity key + const deviceMsg = Buffer.concat([ Buffer.from([6, 1]), deviceDetails, signedIdentityKey.public, accountSignatureKey ]) + account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg) + + const identity = createSignalIdentity(jid, accountSignatureKey) + const accountEnc = encodeSignedDeviceIdentity(account, false) + + const deviceIdentity = proto.ADVDeviceIdentity.decode(account.details) + + const reply: BinaryNode = { + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'result', + id: msgId, + }, + content: [ + { + tag: 'pair-device-sign', + attrs: { }, + content: [ + { + tag: 'device-identity', + attrs: { 'key-index': deviceIdentity.keyIndex.toString() }, + content: accountEnc + } + ] + } + ] + } + + const authUpdate: Partial = { + account, + me: { id: jid, name: bizName }, + signalIdentities: [ + ...(signalIdentities || []), + identity + ], + platform: platformNode?.attrs.name + } + + return { + creds: authUpdate, + reply + } +} + +export const encodeSignedDeviceIdentity = ( + account: proto.IADVSignedDeviceIdentity, + includeSignatureKey: boolean +) => { + account = { ...account } + // set to null if we are not to include the signature key + // or if we are including the signature key but it is empty + if(!includeSignatureKey || !account.accountSignatureKey?.length) { + account.accountSignatureKey = null + } + + const accountEnc = proto.ADVSignedDeviceIdentity + .encode(account) + .finish() + return accountEnc +} \ No newline at end of file diff --git a/src/WABinary/constants.ts b/src/WABinary/constants.ts new file mode 100644 index 00000000000..0e4c4398600 --- /dev/null +++ b/src/WABinary/constants.ts @@ -0,0 +1,42 @@ + +export const TAGS = { + LIST_EMPTY: 0, + DICTIONARY_0: 236, + DICTIONARY_1: 237, + DICTIONARY_2: 238, + DICTIONARY_3: 239, + AD_JID: 247, + LIST_8: 248, + LIST_16: 249, + JID_PAIR: 250, + HEX_8: 251, + BINARY_8: 252, + BINARY_20: 253, + BINARY_32: 254, + NIBBLE_8: 255, + PACKED_MAX: 127, + SINGLE_BYTE_MAX: 256, + STREAM_END: 2 +} +export const DOUBLE_BYTE_TOKENS = [ + ['media-for1-1.cdn.whatsapp.net', 'relay', 'media-gru2-2.cdn.whatsapp.net', 'uncompressed', 'medium', 'voip_settings', 'device', 'reason', 'media-lim1-1.cdn.whatsapp.net', 'media-qro1-2.cdn.whatsapp.net', 'media-gru1-2.cdn.whatsapp.net', 'action', 'features', 'media-gru2-1.cdn.whatsapp.net', 'media-gru1-1.cdn.whatsapp.net', 'media-otp1-1.cdn.whatsapp.net', 'kyc-id', 'priority', 'phash', 'mute', 'token', '100', 'media-qro1-1.cdn.whatsapp.net', 'none', 'media-mrs2-2.cdn.whatsapp.net', 'sign_credential', '03', 'media-mrs2-1.cdn.whatsapp.net', 'protocol', 'timezone', 'transport', 'eph_setting', '1080', 'original_dimensions', 'media-frx5-1.cdn.whatsapp.net', 'background', 'disable', 'original_image_url', '5', 'transaction-id', 'direct_path', '103', 'appointment_only', 'request_image_url', 'peer_pid', 'address', '105', '104', '102', 'media-cdt1-1.cdn.whatsapp.net', '101', '109', '110', '106', 'background_location', 'v_id', 'sync', 'status-old', '111', '107', 'ppic', 'media-scl2-1.cdn.whatsapp.net', 'business_profile', '108', 'invite', '04', 'audio_duration', 'media-mct1-1.cdn.whatsapp.net', 'media-cdg2-1.cdn.whatsapp.net', 'media-los2-1.cdn.whatsapp.net', 'invis', 'net', 'voip_payload_type', 'status-revoke-delay', '404', 'state', 'use_correct_order_for_hmac_sha1', 'ver', 'media-mad1-1.cdn.whatsapp.net', 'order', '540', 'skey', 'blinded_credential', 'android', 'contact_remove', 'enable_downlink_relay_latency_only', 'duration', 'enable_vid_one_way_codec_nego', '6', 'media-sof1-1.cdn.whatsapp.net', 'accept', 'all', 'signed_credential', 'media-atl3-1.cdn.whatsapp.net', 'media-lhr8-1.cdn.whatsapp.net', 'website', '05', 'latitude', 'media-dfw5-1.cdn.whatsapp.net', 'forbidden', 'enable_audio_piggyback_network_mtu_fix', 'media-dfw5-2.cdn.whatsapp.net', 'note.m4r', 'media-atl3-2.cdn.whatsapp.net', 'jb_nack_discard_count_fix', 'longitude', 'Opening.m4r', 'media-arn2-1.cdn.whatsapp.net', 'email', 'timestamp', 'admin', 'media-pmo1-1.cdn.whatsapp.net', 'America/Sao_Paulo', 'contact_add', 'media-sin6-1.cdn.whatsapp.net', 'interactive', '8000', 'acs_public_key', 'sigquit_anr_detector_release_rollover_percent', 'media.fmed1-2.fna.whatsapp.net', 'groupadd', 'enabled_for_video_upgrade', 'latency_update_threshold', 'media-frt3-2.cdn.whatsapp.net', 'calls_row_constraint_layout', 'media.fgbb2-1.fna.whatsapp.net', 'mms4_media_retry_notification_encryption_enabled', 'timeout', 'media-sin6-3.cdn.whatsapp.net', 'audio_nack_jitter_multiplier', 'jb_discard_count_adjust_pct_rc', 'audio_reserve_bps', 'delta', 'account_sync', 'default', 'media.fjed4-6.fna.whatsapp.net', '06', 'lock_video_orientation', 'media-frt3-1.cdn.whatsapp.net', 'w:g2', 'media-sin6-2.cdn.whatsapp.net', 'audio_nack_algo_mask', 'media.fgbb2-2.fna.whatsapp.net', 'media.fmed1-1.fna.whatsapp.net', 'cond_range_target_bitrate', 'mms4_server_error_receipt_encryption_enabled', 'vid_rc_dyn', 'fri', 'cart_v1_1_order_message_changes_enabled', 'reg_push', 'jb_hist_deposit_value', 'privatestats', 'media.fist7-2.fna.whatsapp.net', 'thu', 'jb_discard_count_adjust_pct', 'mon', 'group_call_video_maximization_enabled', 'mms_cat_v1_forward_hot_override_enabled', 'audio_nack_new_rtt', 'media.fsub2-3.fna.whatsapp.net', 'media_upload_aggressive_retry_exponential_backoff_enabled', 'tue', 'wed', 'media.fruh4-2.fna.whatsapp.net', 'audio_nack_max_seq_req', 'max_rtp_audio_packet_resends', 'jb_hist_max_cdf_value', '07', 'audio_nack_max_jb_delay', 'mms_forward_partially_downloaded_video', 'media-lcy1-1.cdn.whatsapp.net', 'resume', 'jb_inband_fec_aware', 'new_commerce_entry_point_enabled', '480', 'payments_upi_generate_qr_amount_limit', 'sigquit_anr_detector_rollover_percent', 'media.fsdu2-1.fna.whatsapp.net', 'fbns', 'aud_pkt_reorder_pct', 'dec', 'stop_probing_before_accept_send', 'media_upload_max_aggressive_retries', 'edit_business_profile_new_mode_enabled', 'media.fhex4-1.fna.whatsapp.net', 'media.fjed4-3.fna.whatsapp.net', 'sigquit_anr_detector_64bit_rollover_percent', 'cond_range_ema_jb_last_delay', 'watls_enable_early_data_http_get', 'media.fsdu2-2.fna.whatsapp.net', 'message_qr_disambiguation_enabled', 'media-mxp1-1.cdn.whatsapp.net', 'sat', 'vertical', 'media.fruh4-5.fna.whatsapp.net', '200', 'media-sof1-2.cdn.whatsapp.net', '-1', 'height', 'product_catalog_hide_show_items_enabled', 'deep_copy_frm_last', 'tsoffline', 'vp8/h.264', 'media.fgye5-3.fna.whatsapp.net', 'media.ftuc1-2.fna.whatsapp.net', 'smb_upsell_chat_banner_enabled', 'canonical', '08', '9', '.', 'media.fgyd4-4.fna.whatsapp.net', 'media.fsti4-1.fna.whatsapp.net', 'mms_vcache_aggregation_enabled', 'mms_hot_content_timespan_in_seconds', 'nse_ver', 'rte', 'third_party_sticker_web_sync', 'cond_range_target_total_bitrate', 'media_upload_aggressive_retry_enabled', 'instrument_spam_report_enabled', 'disable_reconnect_tone', 'move_media_folder_from_sister_app', 'one_tap_calling_in_group_chat_size', '10', 'storage_mgmt_banner_threshold_mb', 'enable_backup_passive_mode', 'sharechat_inline_player_enabled', 'media.fcnq2-1.fna.whatsapp.net', 'media.fhex4-2.fna.whatsapp.net', 'media.fist6-3.fna.whatsapp.net', 'ephemeral_drop_column_stage', 'reconnecting_after_network_change_threshold_ms', 'media-lhr8-2.cdn.whatsapp.net', 'cond_jb_last_delay_ema_alpha', 'entry_point_block_logging_enabled', 'critical_event_upload_log_config', 'respect_initial_bitrate_estimate', 'smaller_image_thumbs_status_enabled', 'media.fbtz1-4.fna.whatsapp.net', 'media.fjed4-1.fna.whatsapp.net', 'width', '720', 'enable_frame_dropper', 'enable_one_side_mode', 'urn:xmpp:whatsapp:dirty', 'new_sticker_animation_behavior_v2', 'media.flim3-2.fna.whatsapp.net', 'media.fuio6-2.fna.whatsapp.net', 'skip_forced_signaling', 'dleq_proof', 'status_video_max_bitrate', 'lazy_send_probing_req', 'enhanced_storage_management', 'android_privatestats_endpoint_dit_enabled', 'media.fscl13-2.fna.whatsapp.net', 'video_duration'], + ['group_call_discoverability_enabled', 'media.faep9-2.fna.whatsapp.net', 'msgr', 'bloks_loggedin_access_app_id', 'db_status_migration_step', 'watls_prefer_ip6', 'jabber:iq:privacy', '68', 'media.fsaw1-11.fna.whatsapp.net', 'mms4_media_conn_persist_enabled', 'animated_stickers_thread_clean_up', 'media.fcgk3-2.fna.whatsapp.net', 'media.fcgk4-6.fna.whatsapp.net', 'media.fgye5-2.fna.whatsapp.net', 'media.flpb1-1.fna.whatsapp.net', 'media.fsub2-1.fna.whatsapp.net', 'media.fuio6-3.fna.whatsapp.net', 'not-allowed', 'partial_pjpeg_bw_threshold', 'cap_estimated_bitrate', 'mms_chatd_resume_check_over_thrift', 'smb_upsell_business_profile_enabled', 'product_catalog_webclient', 'groups', 'sigquit_anr_detector_release_updated_rollout', 'syncd_key_rotation_enabled', 'media.fdmm2-1.fna.whatsapp.net', 'media-hou1-1.cdn.whatsapp.net', 'remove_old_chat_notifications', 'smb_biztools_deeplink_enabled', 'use_downloadable_filters_int', 'group_qr_codes_enabled', 'max_receipt_processing_time', 'optimistic_image_processing_enabled', 'smaller_video_thumbs_status_enabled', 'watls_early_data', 'reconnecting_before_relay_failover_threshold_ms', 'cond_range_packet_loss_pct', 'groups_privacy_blacklist', 'status-revoke-drop', 'stickers_animated_thumbnail_download', 'dedupe_transcode_shared_images', 'dedupe_transcode_shared_videos', 'media.fcnq2-2.fna.whatsapp.net', 'media.fgyd4-1.fna.whatsapp.net', 'media.fist7-1.fna.whatsapp.net', 'media.flim3-3.fna.whatsapp.net', 'add_contact_by_qr_enabled', 'https://faq.whatsapp.com/payments', 'multicast_limit_global', 'sticker_notification_preview', 'smb_better_catalog_list_adapters_enabled', 'bloks_use_minscript_android', 'pen_smoothing_enabled', 'media.fcgk4-5.fna.whatsapp.net', 'media.fevn1-3.fna.whatsapp.net', 'media.fpoj7-1.fna.whatsapp.net', 'media-arn2-2.cdn.whatsapp.net', 'reconnecting_before_network_change_threshold_ms', 'android_media_use_fresco_for_gifs', 'cond_in_congestion', 'status_image_max_edge', 'sticker_search_enabled', 'starred_stickers_web_sync', 'db_blank_me_jid_migration_step', 'media.fist6-2.fna.whatsapp.net', 'media.ftuc1-1.fna.whatsapp.net', '09', 'anr_fast_logs_upload_rollout', 'camera_core_integration_enabled', '11', 'third_party_sticker_caching', 'thread_dump_contact_support', 'wam_privatestats_enabled', 'vcard_as_document_size_kb', 'maxfpp', 'fbip', 'ephemeral_allow_group_members', 'media-bom1-2.cdn.whatsapp.net', 'media-xsp1-1.cdn.whatsapp.net', 'disable_prewarm', 'frequently_forwarded_max', 'media.fbtz1-5.fna.whatsapp.net', 'media.fevn7-1.fna.whatsapp.net', 'media.fgyd4-2.fna.whatsapp.net', 'sticker_tray_animation_fully_visible_items', 'green_alert_banner_duration', 'reconnecting_after_p2p_failover_threshold_ms', 'connected', 'share_biz_vcard_enabled', 'stickers_animation', '0a', '1200', 'WhatsApp', 'group_description_length', 'p_v_id', 'payments_upi_intent_transaction_limit', 'frequently_forwarded_messages', 'media-xsp1-2.cdn.whatsapp.net', 'media.faep8-1.fna.whatsapp.net', 'media.faep8-2.fna.whatsapp.net', 'media.faep9-1.fna.whatsapp.net', 'media.fdmm2-2.fna.whatsapp.net', 'media.fgzt3-1.fna.whatsapp.net', 'media.flim4-2.fna.whatsapp.net', 'media.frao1-1.fna.whatsapp.net', 'media.fscl9-2.fna.whatsapp.net', 'media.fsub2-2.fna.whatsapp.net', 'superadmin', 'media.fbog10-1.fna.whatsapp.net', 'media.fcgh28-1.fna.whatsapp.net', 'media.fjdo10-1.fna.whatsapp.net', 'third_party_animated_sticker_import', 'delay_fec', 'attachment_picker_refresh', 'android_linked_devices_re_auth_enabled', 'rc_dyn', 'green_alert_block_jitter', 'add_contact_logging_enabled', 'biz_message_logging_enabled', 'conversation_media_preview_v2', 'media-jnb1-1.cdn.whatsapp.net', 'ab_key', 'media.fcgk4-2.fna.whatsapp.net', 'media.fevn1-1.fna.whatsapp.net', 'media.fist6-1.fna.whatsapp.net', 'media.fruh4-4.fna.whatsapp.net', 'media.fsti4-2.fna.whatsapp.net', 'mms_vcard_autodownload_size_kb', 'watls_enabled', 'notif_ch_override_off', 'media.fsaw1-14.fna.whatsapp.net', 'media.fscl13-1.fna.whatsapp.net', 'db_group_participant_migration_step', '1020', 'cond_range_sterm_rtt', 'invites_logging_enabled', 'triggered_block_enabled', 'group_call_max_participants', 'media-iad3-1.cdn.whatsapp.net', 'product_catalog_open_deeplink', 'shops_required_tos_version', 'image_max_kbytes', 'cond_low_quality_vid_mode', 'db_receipt_migration_step', 'jb_early_prob_hist_shrink', 'media.fdmm2-3.fna.whatsapp.net', 'media.fdmm2-4.fna.whatsapp.net', 'media.fruh4-1.fna.whatsapp.net', 'media.fsaw2-2.fna.whatsapp.net', 'remove_geolocation_videos', 'new_animation_behavior', 'fieldstats_beacon_chance', '403', 'authkey_reset_on_ban', 'continuous_ptt_playback', 'reconnecting_after_relay_failover_threshold_ms', 'false', 'group', 'sun', 'conversation_swipe_to_reply', 'ephemeral_messages_setting', 'smaller_video_thumbs_enabled', 'md_device_sync_enabled', 'bloks_shops_pdp_url_regex', 'lasso_integration_enabled', 'media-bom1-1.cdn.whatsapp.net', 'new_backup_format_enabled', '256', 'media.faep6-1.fna.whatsapp.net', 'media.fasr1-1.fna.whatsapp.net', 'media.fbtz1-7.fna.whatsapp.net', 'media.fesb4-1.fna.whatsapp.net', 'media.fjdo1-2.fna.whatsapp.net', 'media.frba2-1.fna.whatsapp.net', 'watls_no_dns', '600', 'db_broadcast_me_jid_migration_step', 'new_wam_runtime_enabled', 'group_update', 'enhanced_block_enabled', 'sync_wifi_threshold_kb', 'mms_download_nc_cat', 'bloks_minification_enabled', 'ephemeral_messages_enabled', 'reject', 'voip_outgoing_xml_signaling', 'creator', 'dl_bw', 'payments_request_messages', 'target_bitrate', 'bloks_rendercore_enabled', 'media-hbe1-1.cdn.whatsapp.net', 'media-hel3-1.cdn.whatsapp.net', 'media-kut2-2.cdn.whatsapp.net', 'media-lax3-1.cdn.whatsapp.net', 'media-lax3-2.cdn.whatsapp.net', 'sticker_pack_deeplink_enabled', 'hq_image_bw_threshold', 'status_info', 'voip', 'dedupe_transcode_videos', 'grp_uii_cleanup', 'linked_device_max_count', 'media.flim1-1.fna.whatsapp.net', 'media.fsaw2-1.fna.whatsapp.net', 'reconnecting_after_call_active_threshold_ms', '1140', 'catalog_pdp_new_design', 'media.fbtz1-10.fna.whatsapp.net', 'media.fsaw1-15.fna.whatsapp.net', '0b', 'consumer_rc_provider', 'mms_async_fast_forward_ttl', 'jb_eff_size_fix', 'voip_incoming_xml_signaling', 'media_provider_share_by_uuid', 'suspicious_links', 'dedupe_transcode_images', 'green_alert_modal_start', 'media-cgk1-1.cdn.whatsapp.net', 'media-lga3-1.cdn.whatsapp.net', 'template_doc_mime_types', 'important_messages', 'user_add', 'vcard_max_size_kb', 'media.fada2-1.fna.whatsapp.net', 'media.fbog2-5.fna.whatsapp.net', 'media.fbtz1-3.fna.whatsapp.net', 'media.fcgk3-1.fna.whatsapp.net', 'media.fcgk7-1.fna.whatsapp.net', 'media.flim1-3.fna.whatsapp.net', 'media.fscl9-1.fna.whatsapp.net', 'ctwa_context_enterprise_enabled', 'media.fsaw1-13.fna.whatsapp.net', 'media.fuio11-2.fna.whatsapp.net', 'status_collapse_muted', 'db_migration_level_force', 'recent_stickers_web_sync', 'bloks_session_state', 'bloks_shops_enabled', 'green_alert_setting_deep_links_enabled', 'restrict_groups', 'battery', 'green_alert_block_start', 'refresh', 'ctwa_context_enabled', 'md_messaging_enabled', 'status_image_quality', 'md_blocklist_v2_server', 'media-del1-1.cdn.whatsapp.net', '13', 'userrate', 'a_v_id', 'cond_rtt_ema_alpha', 'invalid'], + ['media.fada1-1.fna.whatsapp.net', 'media.fadb3-2.fna.whatsapp.net', 'media.fbhz2-1.fna.whatsapp.net', 'media.fcor2-1.fna.whatsapp.net', 'media.fjed4-2.fna.whatsapp.net', 'media.flhe4-1.fna.whatsapp.net', 'media.frak1-2.fna.whatsapp.net', 'media.fsub6-3.fna.whatsapp.net', 'media.fsub6-7.fna.whatsapp.net', 'media.fvvi1-1.fna.whatsapp.net', 'search_v5_eligible', 'wam_real_time_enabled', 'report_disk_event', 'max_tx_rott_based_bitrate', 'product', 'media.fjdo10-2.fna.whatsapp.net', 'video_frame_crc_sample_interval', 'media_max_autodownload', '15', 'h.264', 'wam_privatestats_buffer_count', 'md_phash_v2_enabled', 'account_transfer_enabled', 'business_product_catalog', 'enable_non_dyn_codec_param_fix', 'is_user_under_epd_jurisdiction', 'media.fbog2-4.fna.whatsapp.net', 'media.fbtz1-2.fna.whatsapp.net', 'media.fcfc1-1.fna.whatsapp.net', 'media.fjed4-5.fna.whatsapp.net', 'media.flhe4-2.fna.whatsapp.net', 'media.flim1-2.fna.whatsapp.net', 'media.flos5-1.fna.whatsapp.net', 'android_key_store_auth_ver', '010', 'anr_process_monitor', 'delete_old_auth_key', 'media.fcor10-3.fna.whatsapp.net', 'storage_usage_enabled', 'android_camera2_support_level', 'dirty', 'consumer_content_provider', 'status_video_max_duration', '0c', 'bloks_cache_enabled', 'media.fadb2-2.fna.whatsapp.net', 'media.fbko1-1.fna.whatsapp.net', 'media.fbtz1-9.fna.whatsapp.net', 'media.fcgk4-4.fna.whatsapp.net', 'media.fesb4-2.fna.whatsapp.net', 'media.fevn1-2.fna.whatsapp.net', 'media.fist2-4.fna.whatsapp.net', 'media.fjdo1-1.fna.whatsapp.net', 'media.fruh4-6.fna.whatsapp.net', 'media.fsrg5-1.fna.whatsapp.net', 'media.fsub6-6.fna.whatsapp.net', 'minfpp', '5000', 'locales', 'video_max_bitrate', 'use_new_auth_key', 'bloks_http_enabled', 'heartbeat_interval', 'media.fbog11-1.fna.whatsapp.net', 'ephemeral_group_query_ts', 'fec_nack', 'search_in_storage_usage', 'c', 'media-amt2-1.cdn.whatsapp.net', 'linked_devices_ui_enabled', '14', 'async_data_load_on_startup', 'voip_incoming_xml_ack', '16', 'db_migration_step', 'init_bwe', 'max_participants', 'wam_buffer_count', 'media.fada2-2.fna.whatsapp.net', 'media.fadb3-1.fna.whatsapp.net', 'media.fcor2-2.fna.whatsapp.net', 'media.fdiy1-2.fna.whatsapp.net', 'media.frba3-2.fna.whatsapp.net', 'media.fsaw2-3.fna.whatsapp.net', '1280', 'status_grid_enabled', 'w:biz', 'product_catalog_deeplink', 'media.fgye10-2.fna.whatsapp.net', 'media.fuio11-1.fna.whatsapp.net', 'optimistic_upload', 'work_manager_init', 'lc', 'catalog_message', 'cond_net_medium', 'enable_periodical_aud_rr_processing', 'cond_range_ema_rtt', 'media-tir2-1.cdn.whatsapp.net', 'frame_ms', 'group_invite_sending', 'payments_web_enabled', 'wallpapers_v2', '0d', 'browser', 'hq_image_max_edge', 'image_edit_zoom', 'linked_devices_re_auth_enabled', 'media.faly3-2.fna.whatsapp.net', 'media.fdoh5-3.fna.whatsapp.net', 'media.fesb3-1.fna.whatsapp.net', 'media.fknu1-1.fna.whatsapp.net', 'media.fmex3-1.fna.whatsapp.net', 'media.fruh4-3.fna.whatsapp.net', '255', 'web_upgrade_to_md_modal', 'audio_piggyback_timeout_msec', 'enable_audio_oob_fec_feature', 'from_ip', 'image_max_edge', 'message_qr_enabled', 'powersave', 'receipt_pre_acking', 'video_max_edge', 'full', '011', '012', 'enable_audio_oob_fec_for_sender', 'md_voip_enabled', 'enable_privatestats', 'max_fec_ratio', 'payments_cs_faq_url', 'media-xsp1-3.cdn.whatsapp.net', 'hq_image_quality', 'media.fasr1-2.fna.whatsapp.net', 'media.fbog3-1.fna.whatsapp.net', 'media.ffjr1-6.fna.whatsapp.net', 'media.fist2-3.fna.whatsapp.net', 'media.flim4-3.fna.whatsapp.net', 'media.fpbc2-4.fna.whatsapp.net', 'media.fpku1-1.fna.whatsapp.net', 'media.frba1-1.fna.whatsapp.net', 'media.fudi1-1.fna.whatsapp.net', 'media.fvvi1-2.fna.whatsapp.net', 'gcm_fg_service', 'enable_dec_ltr_size_check', 'clear', 'lg', 'media.fgru11-1.fna.whatsapp.net', '18', 'media-lga3-2.cdn.whatsapp.net', 'pkey', '0e', 'max_subject', 'cond_range_lterm_rtt', 'announcement_groups', 'biz_profile_options', 's_t', 'media.fabv2-1.fna.whatsapp.net', 'media.fcai3-1.fna.whatsapp.net', 'media.fcgh1-1.fna.whatsapp.net', 'media.fctg1-4.fna.whatsapp.net', 'media.fdiy1-1.fna.whatsapp.net', 'media.fisb4-1.fna.whatsapp.net', 'media.fpku1-2.fna.whatsapp.net', 'media.fros9-1.fna.whatsapp.net', 'status_v3_text', 'usync_sidelist', '17', 'announcement', '...', 'md_group_notification', '0f', 'animated_pack_in_store', '013', 'America/Mexico_City', '1260', 'media-ams4-1.cdn.whatsapp.net', 'media-cgk1-2.cdn.whatsapp.net', 'media-cpt1-1.cdn.whatsapp.net', 'media-maa2-1.cdn.whatsapp.net', 'media.fgye10-1.fna.whatsapp.net', 'e', 'catalog_cart', 'hfm_string_changes', 'init_bitrate', 'packless_hsm', 'group_info', 'America/Belem', '50', '960', 'cond_range_bwe', 'decode', 'encode', 'media.fada1-8.fna.whatsapp.net', 'media.fadb1-2.fna.whatsapp.net', 'media.fasu6-1.fna.whatsapp.net', 'media.fbog4-1.fna.whatsapp.net', 'media.fcgk9-2.fna.whatsapp.net', 'media.fdoh5-2.fna.whatsapp.net', 'media.ffjr1-2.fna.whatsapp.net', 'media.fgua1-1.fna.whatsapp.net', 'media.fgye1-1.fna.whatsapp.net', 'media.fist1-4.fna.whatsapp.net', 'media.fpbc2-2.fna.whatsapp.net', 'media.fres2-1.fna.whatsapp.net', 'media.fsdq1-2.fna.whatsapp.net', 'media.fsub6-5.fna.whatsapp.net', 'profilo_enabled', 'template_hsm', 'use_disorder_prefetching_timer', 'video_codec_priority', 'vpx_max_qp', 'ptt_reduce_recording_delay', '25', 'iphone', 'Windows', 's_o', 'Africa/Lagos', 'abt', 'media-kut2-1.cdn.whatsapp.net', 'media-mba1-1.cdn.whatsapp.net', 'media-mxp1-2.cdn.whatsapp.net', 'md_blocklist_v2', 'url_text', 'enable_short_offset', 'group_join_permissions', 'enable_audio_piggyback_feature', 'image_quality', 'media.fcgk7-2.fna.whatsapp.net', 'media.fcgk8-2.fna.whatsapp.net', 'media.fclo7-1.fna.whatsapp.net', 'media.fcmn1-1.fna.whatsapp.net', 'media.feoh1-1.fna.whatsapp.net', 'media.fgyd4-3.fna.whatsapp.net', 'media.fjed4-4.fna.whatsapp.net', 'media.flim1-4.fna.whatsapp.net', 'media.flim2-4.fna.whatsapp.net', 'media.fplu6-1.fna.whatsapp.net', 'media.frak1-1.fna.whatsapp.net', 'media.fsdq1-1.fna.whatsapp.net', 'to_ip', '015', 'vp8', '19', '21', '1320', 'auth_key_ver', 'message_processing_dedup', 'server-error', 'wap4_enabled', '420', '014', 'cond_range_rtt', 'ptt_fast_lock_enabled', 'media-ort2-1.cdn.whatsapp.net', 'fwd_ui_start_ts'], + ['contact_blacklist', 'Asia/Jakarta', 'media.fepa10-1.fna.whatsapp.net', 'media.fmex10-3.fna.whatsapp.net', 'disorder_prefetching_start_when_empty', 'America/Bogota', 'use_local_probing_rx_bitrate', 'America/Argentina/Buenos_Aires', 'cross_post', 'media.fabb1-1.fna.whatsapp.net', 'media.fbog4-2.fna.whatsapp.net', 'media.fcgk9-1.fna.whatsapp.net', 'media.fcmn2-1.fna.whatsapp.net', 'media.fdel3-1.fna.whatsapp.net', 'media.ffjr1-1.fna.whatsapp.net', 'media.fgdl5-1.fna.whatsapp.net', 'media.flpb1-2.fna.whatsapp.net', 'media.fmex2-1.fna.whatsapp.net', 'media.frba2-2.fna.whatsapp.net', 'media.fros2-2.fna.whatsapp.net', 'media.fruh2-1.fna.whatsapp.net', 'media.fybz2-2.fna.whatsapp.net', 'options', '20', 'a', '017', '018', 'mute_always', 'user_notice', 'Asia/Kolkata', 'gif_provider', 'locked', 'media-gua1-1.cdn.whatsapp.net', 'piggyback_exclude_force_flush', '24', 'media.frec39-1.fna.whatsapp.net', 'user_remove', 'file_max_size', 'cond_packet_loss_pct_ema_alpha', 'media.facc1-1.fna.whatsapp.net', 'media.fadb2-1.fna.whatsapp.net', 'media.faly3-1.fna.whatsapp.net', 'media.fbdo6-2.fna.whatsapp.net', 'media.fcmn2-2.fna.whatsapp.net', 'media.fctg1-3.fna.whatsapp.net', 'media.ffez1-2.fna.whatsapp.net', 'media.fist1-3.fna.whatsapp.net', 'media.fist2-2.fna.whatsapp.net', 'media.flim2-2.fna.whatsapp.net', 'media.fmct2-3.fna.whatsapp.net', 'media.fpei3-1.fna.whatsapp.net', 'media.frba3-1.fna.whatsapp.net', 'media.fsdu8-2.fna.whatsapp.net', 'media.fstu2-1.fna.whatsapp.net', 'media_type', 'receipt_agg', '016', 'enable_pli_for_crc_mismatch', 'live', 'enc_rekey', 'frskmsg', 'd', 'media.fdel11-2.fna.whatsapp.net', 'proto', '2250', 'audio_piggyback_enable_cache', 'skip_nack_if_ltrp_sent', 'mark_dtx_jb_frames', 'web_service_delay', '7282', 'catalog_send_all', 'outgoing', '360', '30', 'LIMITED', '019', 'audio_picker', 'bpv2_phase', 'media.fada1-7.fna.whatsapp.net', 'media.faep7-1.fna.whatsapp.net', 'media.fbko1-2.fna.whatsapp.net', 'media.fbni1-2.fna.whatsapp.net', 'media.fbtz1-1.fna.whatsapp.net', 'media.fbtz1-8.fna.whatsapp.net', 'media.fcjs3-1.fna.whatsapp.net', 'media.fesb3-2.fna.whatsapp.net', 'media.fgdl5-4.fna.whatsapp.net', 'media.fist2-1.fna.whatsapp.net', 'media.flhe2-2.fna.whatsapp.net', 'media.flim2-1.fna.whatsapp.net', 'media.fmex1-1.fna.whatsapp.net', 'media.fpat3-2.fna.whatsapp.net', 'media.fpat3-3.fna.whatsapp.net', 'media.fros2-1.fna.whatsapp.net', 'media.fsdu8-1.fna.whatsapp.net', 'media.fsub3-2.fna.whatsapp.net', 'payments_chat_plugin', 'cond_congestion_no_rtcp_thr', 'green_alert', 'not-a-biz', '..', 'shops_pdp_urls_config', 'source', 'media-dus1-1.cdn.whatsapp.net', 'mute_video', '01b', 'currency', 'max_keys', 'resume_check', 'contact_array', 'qr_scanning', '23', 'b', 'media.fbfh15-1.fna.whatsapp.net', 'media.flim22-1.fna.whatsapp.net', 'media.fsdu11-1.fna.whatsapp.net', 'media.fsdu15-1.fna.whatsapp.net', 'Chrome', 'fts_version', '60', 'media.fada1-6.fna.whatsapp.net', 'media.faep4-2.fna.whatsapp.net', 'media.fbaq5-1.fna.whatsapp.net', 'media.fbni1-1.fna.whatsapp.net', 'media.fcai3-2.fna.whatsapp.net', 'media.fdel3-2.fna.whatsapp.net', 'media.fdmm3-2.fna.whatsapp.net', 'media.fhex3-1.fna.whatsapp.net', 'media.fisb4-2.fna.whatsapp.net', 'media.fkhi5-2.fna.whatsapp.net', 'media.flos2-1.fna.whatsapp.net', 'media.fmct2-1.fna.whatsapp.net', 'media.fntr7-1.fna.whatsapp.net', 'media.frak3-1.fna.whatsapp.net', 'media.fruh5-2.fna.whatsapp.net', 'media.fsub6-1.fna.whatsapp.net', 'media.fuab1-2.fna.whatsapp.net', 'media.fuio1-1.fna.whatsapp.net', 'media.fver1-1.fna.whatsapp.net', 'media.fymy1-1.fna.whatsapp.net', 'product_catalog', '1380', 'audio_oob_fec_max_pkts', '22', '254', 'media-ort2-2.cdn.whatsapp.net', 'media-sjc3-1.cdn.whatsapp.net', '1600', '01a', '01c', '405', 'key_frame_interval', 'body', 'media.fcgh20-1.fna.whatsapp.net', 'media.fesb10-2.fna.whatsapp.net', '125', '2000', 'media.fbsb1-1.fna.whatsapp.net', 'media.fcmn3-2.fna.whatsapp.net', 'media.fcpq1-1.fna.whatsapp.net', 'media.fdel1-2.fna.whatsapp.net', 'media.ffor2-1.fna.whatsapp.net', 'media.fgdl1-4.fna.whatsapp.net', 'media.fhex2-1.fna.whatsapp.net', 'media.fist1-2.fna.whatsapp.net', 'media.fjed5-2.fna.whatsapp.net', 'media.flim6-4.fna.whatsapp.net', 'media.flos2-2.fna.whatsapp.net', 'media.fntr6-2.fna.whatsapp.net', 'media.fpku3-2.fna.whatsapp.net', 'media.fros8-1.fna.whatsapp.net', 'media.fymy1-2.fna.whatsapp.net', 'ul_bw', 'ltrp_qp_offset', 'request', 'nack', 'dtx_delay_state_reset', 'timeoffline', '28', '01f', '32', 'enable_ltr_pool', 'wa_msys_crypto', '01d', '58', 'dtx_freeze_hg_update', 'nack_if_rpsi_throttled', '253', '840', 'media.famd15-1.fna.whatsapp.net', 'media.fbog17-2.fna.whatsapp.net', 'media.fcai19-2.fna.whatsapp.net', 'media.fcai21-4.fna.whatsapp.net', 'media.fesb10-4.fna.whatsapp.net', 'media.fesb10-5.fna.whatsapp.net', 'media.fmaa12-1.fna.whatsapp.net', 'media.fmex11-3.fna.whatsapp.net', 'media.fpoa33-1.fna.whatsapp.net', '1050', '021', 'clean', 'cond_range_ema_packet_loss_pct', 'media.fadb6-5.fna.whatsapp.net', 'media.faqp4-1.fna.whatsapp.net', 'media.fbaq3-1.fna.whatsapp.net', 'media.fbel2-1.fna.whatsapp.net', 'media.fblr4-2.fna.whatsapp.net', 'media.fclo8-1.fna.whatsapp.net', 'media.fcoo1-2.fna.whatsapp.net', 'media.ffjr1-4.fna.whatsapp.net', 'media.ffor9-1.fna.whatsapp.net', 'media.fisb3-1.fna.whatsapp.net', 'media.fkhi2-2.fna.whatsapp.net', 'media.fkhi4-1.fna.whatsapp.net', 'media.fpbc1-2.fna.whatsapp.net', 'media.fruh2-2.fna.whatsapp.net', 'media.fruh5-1.fna.whatsapp.net', 'media.fsub3-1.fna.whatsapp.net', 'payments_transaction_limit', '252', '27', '29', 'tintagel', '01e', '237', '780', 'callee_updated_payload', '020', '257', 'price', '025', '239', 'payments_cs_phone_number', 'mediaretry', 'w:auth:backup:token', 'Glass.caf', 'max_bitrate', '240', '251', '660', 'media.fbog16-1.fna.whatsapp.net', 'media.fcgh21-1.fna.whatsapp.net', 'media.fkul19-2.fna.whatsapp.net', 'media.flim21-2.fna.whatsapp.net', 'media.fmex10-4.fna.whatsapp.net', '64', '33', '34', '35', 'interruption', 'media.fabv3-1.fna.whatsapp.net', 'media.fadb6-1.fna.whatsapp.net', 'media.fagr1-1.fna.whatsapp.net', 'media.famd1-1.fna.whatsapp.net', 'media.famm6-1.fna.whatsapp.net', 'media.faqp2-3.fna.whatsapp.net'], + +] +export const SINGLE_BYTE_TOKENS: (string | null)[] = [ + '', 'xmlstreamstart', 'xmlstreamend', 's.whatsapp.net', 'type', 'participant', 'from', 'receipt', 'id', 'broadcast', 'status', 'message', 'notification', 'notify', 'to', 'jid', 'user', 'class', 'offline', 'g.us', 'result', 'mediatype', 'enc', 'skmsg', 'off_cnt', 'xmlns', 'presence', 'participants', 'ack', 't', 'iq', 'device_hash', 'read', 'value', 'media', 'picture', 'chatstate', 'unavailable', 'text', 'urn:xmpp:whatsapp:push', 'devices', 'verified_name', 'contact', 'composing', 'edge_routing', 'routing_info', 'item', 'image', 'verified_level', 'get', 'fallback_hostname', '2', 'media_conn', '1', 'v', 'handshake', 'fallback_class', 'count', 'config', 'offline_preview', 'download_buckets', 'w:profile:picture', 'set', 'creation', 'location', 'fallback_ip4', 'msg', 'urn:xmpp:ping', 'fallback_ip6', 'call-creator', 'relaylatency', 'success', 'subscribe', 'video', 'business_hours_config', 'platform', 'hostname', 'version', 'unknown', '0', 'ping', 'hash', 'edit', 'subject', 'max_buckets', 'download', 'delivery', 'props', 'sticker', 'name', 'last', 'contacts', 'business', 'primary', 'preview', 'w:p', 'pkmsg', 'call-id', 'retry', 'prop', 'call', 'auth_ttl', 'available', 'relay_id', 'last_id', 'day_of_week', 'w', 'host', 'seen', 'bits', 'list', 'atn', 'upload', 'is_new', 'w:stats', 'key', 'paused', 'specific_hours', 'multicast', 'stream:error', 'mmg.whatsapp.net', 'code', 'deny', 'played', 'profile', 'fna', 'device-list', 'close_time', 'latency', 'gcm', 'pop', 'audio', '26', 'w:web', 'open_time', 'error', 'auth', 'ip4', 'update', 'profile_options', 'config_value', 'category', 'catalog_not_created', '00', 'config_code', 'mode', 'catalog_status', 'ip6', 'blocklist', 'registration', '7', 'web', 'fail', 'w:m', 'cart_enabled', 'ttl', 'gif', '300', 'device_orientation', 'identity', 'query', '401', 'media-gig2-1.cdn.whatsapp.net', 'in', '3', 'te2', 'add', 'fallback', 'categories', 'ptt', 'encrypt', 'notice', 'thumbnail-document', 'item-not-found', '12', 'thumbnail-image', 'stage', 'thumbnail-link', 'usync', 'out', 'thumbnail-video', '8', '01', 'context', 'sidelist', 'thumbnail-gif', 'terminate', 'not-authorized', 'orientation', 'dhash', 'capability', 'side_list', 'md-app-state', 'description', 'serial', 'readreceipts', 'te', 'business_hours', 'md-msg-hist', 'tag', 'attribute_padding', 'document', 'open_24h', 'delete', 'expiration', 'active', 'prev_v_id', 'true', 'passive', 'index', '4', 'conflict', 'remove', 'w:gp2', 'config_expo_key', 'screen_height', 'replaced', '02', 'screen_width', 'uploadfieldstat', '2:47DEQpj8', 'media-bog1-1.cdn.whatsapp.net', 'encopt', 'url', 'catalog_exists', 'keygen', 'rate', 'offer', 'opus', 'media-mia3-1.cdn.whatsapp.net', 'privacy', 'media-mia3-2.cdn.whatsapp.net', 'signature', 'preaccept', 'token_id', 'media-eze1-1.cdn.whatsapp.net' +] + +export const TOKEN_MAP: { [token: string]: { dict?: number, index: number } } = { } + +for(let i = 0;i < SINGLE_BYTE_TOKENS.length;i++) { + TOKEN_MAP[SINGLE_BYTE_TOKENS[i]!] = { index: i } +} + +for(let i = 0;i < DOUBLE_BYTE_TOKENS.length;i++) { + for(let j = 0;j < DOUBLE_BYTE_TOKENS[i].length;j++) { + TOKEN_MAP[DOUBLE_BYTE_TOKENS[i][j]] = { dict: i, index: j } + } +} \ No newline at end of file diff --git a/src/WABinary/decode.ts b/src/WABinary/decode.ts new file mode 100644 index 00000000000..6095c55c397 --- /dev/null +++ b/src/WABinary/decode.ts @@ -0,0 +1,265 @@ +import { inflateSync } from 'zlib' +import * as constants from './constants' +import { jidEncode } from './jid-utils' +import type { BinaryNode, BinaryNodeCodingOptions } from './types' + +export const decompressingIfRequired = (buffer: Buffer) => { + if(2 & buffer.readUInt8()) { + buffer = inflateSync(buffer.slice(1)) + } else { // nodes with no compression have a 0x00 prefix, we remove that + buffer = buffer.slice(1) + } + + return buffer +} + +export const decodeDecompressedBinaryNode = ( + buffer: Buffer, + opts: Pick, + indexRef: { index: number } = { index: 0 } +): BinaryNode => { + const { DOUBLE_BYTE_TOKENS, SINGLE_BYTE_TOKENS, TAGS } = opts + + const checkEOS = (length: number) => { + if(indexRef.index + length > buffer.length) { + throw new Error('end of stream') + } + } + + const next = () => { + const value = buffer[indexRef.index] + indexRef.index += 1 + return value + } + + const readByte = () => { + checkEOS(1) + return next() + } + + const readBytes = (n: number) => { + checkEOS(n) + const value = buffer.slice(indexRef.index, indexRef.index + n) + indexRef.index += n + return value + } + + const readStringFromChars = (length: number) => { + return readBytes(length).toString('utf-8') + } + + const readInt = (n: number, littleEndian = false) => { + checkEOS(n) + let val = 0 + for(let i = 0; i < n; i++) { + const shift = littleEndian ? i : n - 1 - i + val |= next() << (shift * 8) + } + + return val + } + + const readInt20 = () => { + checkEOS(3) + return ((next() & 15) << 16) + (next() << 8) + next() + } + + const unpackHex = (value: number) => { + if(value >= 0 && value < 16) { + return value < 10 ? '0'.charCodeAt(0) + value : 'A'.charCodeAt(0) + value - 10 + } + + throw new Error('invalid hex: ' + value) + } + + const unpackNibble = (value: number) => { + if(value >= 0 && value <= 9) { + return '0'.charCodeAt(0) + value + } + + switch (value) { + case 10: + return '-'.charCodeAt(0) + case 11: + return '.'.charCodeAt(0) + case 15: + return '\0'.charCodeAt(0) + default: + throw new Error('invalid nibble: ' + value) + } + } + + const unpackByte = (tag: number, value: number) => { + if(tag === TAGS.NIBBLE_8) { + return unpackNibble(value) + } else if(tag === TAGS.HEX_8) { + return unpackHex(value) + } else { + throw new Error('unknown tag: ' + tag) + } + } + + const readPacked8 = (tag: number) => { + const startByte = readByte() + let value = '' + + for(let i = 0; i < (startByte & 127); i++) { + const curByte = readByte() + value += String.fromCharCode(unpackByte(tag, (curByte & 0xf0) >> 4)) + value += String.fromCharCode(unpackByte(tag, curByte & 0x0f)) + } + + if(startByte >> 7 !== 0) { + value = value.slice(0, -1) + } + + return value + } + + const isListTag = (tag: number) => { + return tag === TAGS.LIST_EMPTY || tag === TAGS.LIST_8 || tag === TAGS.LIST_16 + } + + const readListSize = (tag: number) => { + switch (tag) { + case TAGS.LIST_EMPTY: + return 0 + case TAGS.LIST_8: + return readByte() + case TAGS.LIST_16: + return readInt(2) + default: + throw new Error('invalid tag for list size: ' + tag) + } + } + + const readJidPair = () => { + const i = readString(readByte()) + const j = readString(readByte()) + if(j) { + return (i || '') + '@' + j + } + + throw new Error('invalid jid pair: ' + i + ', ' + j) + } + + const readAdJid = () => { + const agent = readByte() + const device = readByte() + const user = readString(readByte()) + + return jidEncode(user, 's.whatsapp.net', device, agent) + } + + const readString = (tag: number): string => { + if(tag >= 1 && tag < SINGLE_BYTE_TOKENS.length) { + return SINGLE_BYTE_TOKENS[tag] || '' + } + + switch (tag) { + case TAGS.DICTIONARY_0: + case TAGS.DICTIONARY_1: + case TAGS.DICTIONARY_2: + case TAGS.DICTIONARY_3: + return getTokenDouble(tag - TAGS.DICTIONARY_0, readByte()) + case TAGS.LIST_EMPTY: + return '' + case TAGS.BINARY_8: + return readStringFromChars(readByte()) + case TAGS.BINARY_20: + return readStringFromChars(readInt20()) + case TAGS.BINARY_32: + return readStringFromChars(readInt(4)) + case TAGS.JID_PAIR: + return readJidPair() + case TAGS.AD_JID: + return readAdJid() + case TAGS.HEX_8: + case TAGS.NIBBLE_8: + return readPacked8(tag) + default: + throw new Error('invalid string with tag: ' + tag) + } + } + + const readList = (tag: number) => { + const items: BinaryNode[] = [] + const size = readListSize(tag) + for(let i = 0;i < size;i++) { + items.push(decodeDecompressedBinaryNode(buffer, opts, indexRef)) + } + + return items + } + + const getTokenDouble = (index1: number, index2: number) => { + const dict = DOUBLE_BYTE_TOKENS[index1] + if(!dict) { + throw new Error(`Invalid double token dict (${index1})`) + } + + const value = dict[index2] + if(typeof value === 'undefined') { + throw new Error(`Invalid double token (${index2})`) + } + + return value + } + + const listSize = readListSize(readByte()) + const header = readString(readByte()) + if(!listSize || !header.length) { + throw new Error('invalid node') + } + + const attrs: BinaryNode['attrs'] = { } + let data: BinaryNode['content'] + if(listSize === 0 || !header) { + throw new Error('invalid node') + } + + // read the attributes in + const attributesLength = (listSize - 1) >> 1 + for(let i = 0; i < attributesLength; i++) { + const key = readString(readByte()) + const value = readString(readByte()) + + attrs[key] = value + } + + if(listSize % 2 === 0) { + const tag = readByte() + if(isListTag(tag)) { + data = readList(tag) + } else { + let decoded: Buffer | string + switch (tag) { + case TAGS.BINARY_8: + decoded = readBytes(readByte()) + break + case TAGS.BINARY_20: + decoded = readBytes(readInt20()) + break + case TAGS.BINARY_32: + decoded = readBytes(readInt(4)) + break + default: + decoded = readString(tag) + break + } + + data = decoded + } + } + + return { + tag: header, + attrs, + content: data + } +} + +export const decodeBinaryNode = (buff: Buffer): BinaryNode => { + const decompBuff = decompressingIfRequired(buff) + return decodeDecompressedBinaryNode(decompBuff, constants) +} \ No newline at end of file diff --git a/src/WABinary/encode.ts b/src/WABinary/encode.ts new file mode 100644 index 00000000000..929c2a3e28a --- /dev/null +++ b/src/WABinary/encode.ts @@ -0,0 +1,236 @@ + +import * as constants from './constants' +import { FullJid, jidDecode } from './jid-utils' +import type { BinaryNode, BinaryNodeCodingOptions } from './types' + +export const encodeBinaryNode = ( + { tag, attrs, content }: BinaryNode, + opts: Pick = constants, + buffer: number[] = [0] +) => { + const { TAGS, TOKEN_MAP } = opts + + const pushByte = (value: number) => buffer.push(value & 0xff) + + const pushInt = (value: number, n: number, littleEndian = false) => { + for(let i = 0; i < n; i++) { + const curShift = littleEndian ? i : n - 1 - i + buffer.push((value >> (curShift * 8)) & 0xff) + } + } + + const pushBytes = (bytes: Uint8Array | Buffer | number[]) => ( + bytes.forEach (b => buffer.push(b)) + ) + const pushInt16 = (value: number) => { + pushBytes([(value >> 8) & 0xff, value & 0xff]) + } + + const pushInt20 = (value: number) => ( + pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff]) + ) + const writeByteLength = (length: number) => { + if(length >= 4294967296) { + throw new Error('string too large to encode: ' + length) + } + + if(length >= 1 << 20) { + pushByte(TAGS.BINARY_32) + pushInt(length, 4) // 32 bit integer + } else if(length >= 256) { + pushByte(TAGS.BINARY_20) + pushInt20(length) + } else { + pushByte(TAGS.BINARY_8) + pushByte(length) + } + } + + const writeStringRaw = (str: string) => { + const bytes = Buffer.from (str, 'utf-8') + writeByteLength(bytes.length) + pushBytes(bytes) + } + + const writeJid = ({ agent, device, user, server }: FullJid) => { + if(typeof agent !== 'undefined' || typeof device !== 'undefined') { + pushByte(TAGS.AD_JID) + pushByte(agent || 0) + pushByte(device || 0) + writeString(user) + } else { + pushByte(TAGS.JID_PAIR) + if(user.length) { + writeString(user) + } else { + pushByte(TAGS.LIST_EMPTY) + } + + writeString(server) + } + } + + const packNibble = (char: string) => { + switch (char) { + case '-': + return 10 + case '.': + return 11 + case '\0': + return 15 + default: + if(char >= '0' && char <= '9') { + return char.charCodeAt(0) - '0'.charCodeAt(0) + } + + throw new Error(`invalid byte for nibble "${char}"`) + } + } + + const packHex = (char: string) => { + if(char >= '0' && char <= '9') { + return char.charCodeAt(0) - '0'.charCodeAt(0) + } + + if(char >= 'A' && char <= 'F') { + return 10 + char.charCodeAt(0) - 'A'.charCodeAt(0) + } + + if(char >= 'a' && char <= 'f') { + return 10 + char.charCodeAt(0) - 'a'.charCodeAt(0) + } + + if(char === '\0') { + return 15 + } + + throw new Error(`Invalid hex char "${char}"`) + } + + const writePackedBytes = (str: string, type: 'nibble' | 'hex') => { + if(str.length > TAGS.PACKED_MAX) { + throw new Error('Too many bytes to pack') + } + + pushByte(type === 'nibble' ? TAGS.NIBBLE_8 : TAGS.HEX_8) + + let roundedLength = Math.ceil(str.length / 2.0) + if(str.length % 2 !== 0) { + roundedLength |= 128 + } + + pushByte(roundedLength) + const packFunction = type === 'nibble' ? packNibble : packHex + + const packBytePair = (v1: string, v2: string) => { + const result = (packFunction(v1) << 4) | packFunction(v2) + return result + } + + const strLengthHalf = Math.floor(str.length / 2) + for(let i = 0; i < strLengthHalf;i++) { + pushByte(packBytePair(str[2 * i], str[2 * i + 1])) + } + + if(str.length % 2 !== 0) { + pushByte(packBytePair(str[str.length - 1], '\x00')) + } + } + + const isNibble = (str: string) => { + if(str.length > TAGS.PACKED_MAX) { + return false + } + + for(let i = 0;i < str.length;i++) { + const char = str[i] + const isInNibbleRange = char >= '0' && char <= '9' + if(!isInNibbleRange && char !== '-' && char !== '.') { + return false + } + } + + return true + } + + const isHex = (str: string) => { + if(str.length > TAGS.PACKED_MAX) { + return false + } + + for(let i = 0;i < str.length;i++) { + const char = str[i] + const isInNibbleRange = char >= '0' && char <= '9' + if(!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) { + return false + } + } + + return true + } + + const writeString = (str: string) => { + const tokenIndex = TOKEN_MAP[str] + if(tokenIndex) { + if(typeof tokenIndex.dict === 'number') { + pushByte(TAGS.DICTIONARY_0 + tokenIndex.dict) + } + + pushByte(tokenIndex.index) + } else if(isNibble(str)) { + writePackedBytes(str, 'nibble') + } else if(isHex(str)) { + writePackedBytes(str, 'hex') + } else if(str) { + const decodedJid = jidDecode(str) + if(decodedJid) { + writeJid(decodedJid) + } else { + writeStringRaw(str) + } + } + } + + const writeListStart = (listSize: number) => { + if(listSize === 0) { + pushByte(TAGS.LIST_EMPTY) + } else if(listSize < 256) { + pushBytes([TAGS.LIST_8, listSize]) + } else { + pushByte(TAGS.LIST_16) + pushInt16(listSize) + } + } + + const validAttributes = Object.keys(attrs).filter(k => ( + typeof attrs[k] !== 'undefined' && attrs[k] !== null + )) + + writeListStart(2 * validAttributes.length + 1 + (typeof content !== 'undefined' ? 1 : 0)) + writeString(tag) + + for(const key of validAttributes) { + if(typeof attrs[key] === 'string') { + writeString(key) + writeString(attrs[key]) + } + } + + if(typeof content === 'string') { + writeString(content) + } else if(Buffer.isBuffer(content) || content instanceof Uint8Array) { + writeByteLength(content.length) + pushBytes(content) + } else if(Array.isArray(content)) { + writeListStart(content.length) + for(const item of content) { + encodeBinaryNode(item, opts, buffer) + } + } else if(typeof content === 'undefined') { + // do nothing + } else { + throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`) + } + + return Buffer.from(buffer) +} \ No newline at end of file diff --git a/src/WABinary/generic-utils.ts b/src/WABinary/generic-utils.ts new file mode 100644 index 00000000000..dd386207f1a --- /dev/null +++ b/src/WABinary/generic-utils.ts @@ -0,0 +1,90 @@ +import { Boom } from '@hapi/boom' +import { proto } from '../../WAProto' +import { BinaryNode } from './types' + +// some extra useful utilities + +export const getBinaryNodeChildren = (node: BinaryNode | undefined, childTag: string) => { + if(Array.isArray(node?.content)) { + return node!.content.filter(item => item.tag === childTag) + } + + return [] +} + +export const getAllBinaryNodeChildren = ({ content }: BinaryNode) => { + if(Array.isArray(content)) { + return content + } + + return [] +} + +export const getBinaryNodeChild = (node: BinaryNode | undefined, childTag: string) => { + if(Array.isArray(node?.content)) { + return node?.content.find(item => item.tag === childTag) + } +} + +export const getBinaryNodeChildBuffer = (node: BinaryNode | undefined, childTag: string) => { + const child = getBinaryNodeChild(node, childTag)?.content + if(Buffer.isBuffer(child) || child instanceof Uint8Array) { + return child + } +} + +export const getBinaryNodeChildString = (node: BinaryNode | undefined, childTag: string) => { + const child = getBinaryNodeChild(node, childTag)?.content + if(Buffer.isBuffer(child) || child instanceof Uint8Array) { + return Buffer.from(child).toString('utf-8') + } else if(typeof child === 'string') { + return child + } +} + +export const getBinaryNodeChildUInt = (node: BinaryNode, childTag: string, length: number) => { + const buff = getBinaryNodeChildBuffer(node, childTag) + if(buff) { + return bufferToUInt(buff, length) + } +} + +export const assertNodeErrorFree = (node: BinaryNode) => { + const errNode = getBinaryNodeChild(node, 'error') + if(errNode) { + throw new Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code }) + } +} + +export const reduceBinaryNodeToDictionary = (node: BinaryNode, tag: string) => { + const nodes = getBinaryNodeChildren(node, tag) + const dict = nodes.reduce( + (dict, { attrs }) => { + dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value + return dict + }, { } as { [_: string]: string } + ) + return dict +} + +export const getBinaryNodeMessages = ({ content }: BinaryNode) => { + const msgs: proto.WebMessageInfo[] = [] + if(Array.isArray(content)) { + for(const item of content) { + if(item.tag === 'message') { + msgs.push(proto.WebMessageInfo.decode(item.content as Buffer)) + } + } + } + + return msgs +} + +function bufferToUInt(e: Uint8Array | Buffer, t: number) { + let a = 0 + for(let i = 0; i < t; i++) { + a = 256 * a + e[i] + } + + return a +} \ No newline at end of file diff --git a/src/WABinary/index.ts b/src/WABinary/index.ts new file mode 100644 index 00000000000..ecf0c9feb89 --- /dev/null +++ b/src/WABinary/index.ts @@ -0,0 +1,5 @@ +export * from './encode' +export * from './decode' +export * from './generic-utils' +export * from './jid-utils' +export * from './types' \ No newline at end of file diff --git a/src/WABinary/jid-utils.ts b/src/WABinary/jid-utils.ts new file mode 100644 index 00000000000..840f7700230 --- /dev/null +++ b/src/WABinary/jid-utils.ts @@ -0,0 +1,64 @@ +export const S_WHATSAPP_NET = '@s.whatsapp.net' +export const OFFICIAL_BIZ_JID = '16505361212@c.us' +export const SERVER_JID = 'server@c.us' +export const PSA_WID = '0@c.us' +export const STORIES_JID = 'status@broadcast' + +export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' + +export type JidWithDevice = { + user: string + device?: number +} + +export type FullJid = JidWithDevice & { + server: JidServer | string + agent?: number +} + +export const jidEncode = (user: string | number | null, server: JidServer, device?: number, agent?: number) => { + return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}` +} + +export const jidDecode = (jid: string | undefined): FullJid | undefined => { + const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1 + if(sepIdx < 0) { + return undefined + } + + const server = jid!.slice(sepIdx + 1) + const userCombined = jid!.slice(0, sepIdx) + + const [userAgent, device] = userCombined.split(':') + const [user, agent] = userAgent.split('_') + + return { + server, + user, + agent: agent ? +agent : undefined, + device: device ? +device : undefined + } +} + +/** is the jid a user */ +export const areJidsSameUser = (jid1: string | undefined, jid2: string | undefined) => ( + jidDecode(jid1)?.user === jidDecode(jid2)?.user +) +/** is the jid a user */ +export const isJidUser = (jid: string | undefined) => (jid?.endsWith('@s.whatsapp.net')) +/** is the jid a broadcast */ +export const isJidBroadcast = (jid: string | undefined) => (jid?.endsWith('@broadcast')) +/** is the jid a group */ +export const isJidGroup = (jid: string | undefined) => (jid?.endsWith('@g.us')) +/** is the jid the status broadcast */ +export const isJidStatusBroadcast = (jid: string) => jid === 'status@broadcast' + +export const jidNormalizedUser = (jid: string | undefined) => { + const result = jidDecode(jid) + if(!result) { + return '' + } + + const { user, server } = result + return jidEncode(user, server === 'c.us' ? 's.whatsapp.net' : server as JidServer) +} \ No newline at end of file diff --git a/src/WABinary/types.ts b/src/WABinary/types.ts new file mode 100644 index 00000000000..dcc0ea23c22 --- /dev/null +++ b/src/WABinary/types.ts @@ -0,0 +1,17 @@ +import * as constants from './constants' +/** + * the binary node WA uses internally for communication + * + * this is manipulated soley as an object and it does not have any functions. + * This is done for easy serialization, to prevent running into issues with prototypes & + * to maintain functional code structure + * */ +export type BinaryNode = { + tag: string + attrs: { [key: string]: string } + content?: BinaryNode[] | string | Uint8Array +} +export type BinaryNodeAttributes = BinaryNode['attrs'] +export type BinaryNodeData = BinaryNode['content'] + +export type BinaryNodeCodingOptions = typeof constants \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000000..e9eed52786a --- /dev/null +++ b/src/index.ts @@ -0,0 +1,12 @@ +import makeWASocket from './Socket' + +export * from '../WAProto' +export * from './Utils' +export * from './Types' +export * from './Store' +export * from './Defaults' +export * from './WABinary' + +export type WASocket = ReturnType + +export default makeWASocket \ No newline at end of file diff --git a/test.js b/test.js deleted file mode 100644 index b8ab28f0030..00000000000 --- a/test.js +++ /dev/null @@ -1,45 +0,0 @@ -const WhatsAppWeb = require("./WhatsAppWeb") -const fs = require("fs") - -let client = new WhatsAppWeb() // instantiate -try { - const file = fs.readFileSync("auth_info.json") // load a closed session back if it exists - const authInfo = JSON.parse(file) - client.login( authInfo ) // log back in using the info we just loaded -} catch { - // if no auth info exists, start a new session - client.connect() // start a new session, with QR code scanning and what not -} -// called once the client connects successfully to the WhatsApp servers -client.handlers.onConnected = () => { - const authInfo = client.base64EncodedAuthInfo() // get all the auth info we need to restore this session - fs.writeFileSync("auth_info.json", JSON.stringify(authInfo, null, "\t")) // save this info to a file - /* - Note: one can take this file and login again from any computer without having to scan the QR code, and get full access to one's WhatsApp - Despite the convenience, be careful with this file - */ -} -// called when you have a pending unread message or recieve a new message -client.handlers.onUnreadMessage = (m) => { - console.log("recieved message: " + JSON.stringify(m)) // log and see what the message looks like - - /* send a message after at least a 1 second timeout after recieving a message, otherwise WhatsApp will reject the message otherwise */ - setTimeout(() => client.sendReadReceipt(m.key.remoteJid, m.key.id), 2*1000) // send a read reciept for the message in 2 seconds - setTimeout(() => client.updatePresence(m.key.remoteJid, WhatsAppWeb.Presence.composing), 2.5*1000) // let them know you're typing in 2.5 seconds - setTimeout(() => client.sendTextMessage(m.key.remoteJid, "hello!"), 4*1000) // send the actual message after 4 seconds -} -// called if an error occurs -client.handlers.onError = (err) => console.log(err) -client.handlers.onDisconnect = () => { /* internet got disconnected, save chats here or whatever; will reconnect automatically */ } - - -const readline = require('readline').createInterface({ - input: process.stdin, - output: process.stdout -}) -readline.question("type exit to disconnect\n", (txt) => { - if (txt === "exit") { - client.close() - process.exit(0) - } -}) \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000000..3f8dd8cd69c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "es2018", + "module": "commonjs", + "experimentalDecorators": true, + "allowJs": false, + "checkJs": false, + "outDir": "lib", + "strict": false, + "strictNullChecks": true, + "skipLibCheck": true, + "noImplicitThis": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "lib": ["es2020", "esnext.array", "DOM"] + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules", "src/Tests/*", "src/Binary/GenerateStatics.ts"] +} diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 00000000000..5c7b1d192b4 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,8 @@ +{ + "entryPoints": ["./src/index.ts"], + "excludePrivate": true, + "excludeProtected": true, + "excludeExternals": true, + "includeVersion": false, + "out": "docs" +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000000..43a983d191e --- /dev/null +++ b/yarn.lock @@ -0,0 +1,5206 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@adiwajshing/eslint-config@git+https://github.com/adiwajshing/eslint-config": + version "1.0.0" + resolved "git+ssh://git@github.com/adiwajshing/eslint-config.git#5ec841a7281fc27232d570b30fd410dce5de76c8" + dependencies: + "@typescript-eslint/eslint-plugin" "^5.33.1" + "@typescript-eslint/parser" "^5.33.1" + eslint-plugin-react "^7.30.0" + eslint-plugin-simple-import-sort "^7.0.0" + +"@adiwajshing/keyed-db@^0.2.4": + version "0.2.4" + resolved "https://registry.npmjs.org/@adiwajshing/keyed-db/-/keyed-db-0.2.4.tgz" + integrity sha512-yprSnAtj80/VKuDqRcFFLDYltoNV8tChNwFfIgcf6PGD4sjzWIBgs08pRuTqGH5mk5wgL6PBRSsMCZqtZwzFEw== + +"@ampproject/remapping@^2.1.0": + version "2.2.0" + resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz" + integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== + dependencies: + "@jridgewell/gen-mapping" "^0.1.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz" + integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== + dependencies: + "@babel/highlight" "^7.16.7" + +"@babel/compat-data@^7.17.10": + version "7.17.10" + resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.10.tgz" + integrity sha512-GZt/TCsG70Ms19gfZO1tM4CVnXsPgEPBCpJu+Qz3L0LUDsY5nZqFZglIoPC1kIYOtNBZlrnFT+klg12vFGZXrw== + +"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.7.2", "@babel/core@^7.8.0": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.18.2.tgz" + integrity sha512-A8pri1YJiC5UnkdrWcmfZTJTV85b4UXTAfImGmCfYmax4TR9Cw8sDS0MOk++Gp2mE/BefVJ5nwy5yzqNJbP/DQ== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.18.2" + "@babel/helper-compilation-targets" "^7.18.2" + "@babel/helper-module-transforms" "^7.18.0" + "@babel/helpers" "^7.18.2" + "@babel/parser" "^7.18.0" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.18.2" + "@babel/types" "^7.18.2" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.1" + semver "^6.3.0" + +"@babel/generator@^7.18.2", "@babel/generator@^7.7.2": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz" + integrity sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw== + dependencies: + "@babel/types" "^7.18.2" + "@jridgewell/gen-mapping" "^0.3.0" + jsesc "^2.5.1" + +"@babel/helper-compilation-targets@^7.18.2": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.2.tgz" + integrity sha512-s1jnPotJS9uQnzFtiZVBUxe67CuBa679oWFHpxYYnTpRL/1ffhyX44R9uYiXoa/pLXcY9H2moJta0iaanlk/rQ== + dependencies: + "@babel/compat-data" "^7.17.10" + "@babel/helper-validator-option" "^7.16.7" + browserslist "^4.20.2" + semver "^6.3.0" + +"@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.18.2": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.2.tgz" + integrity sha512-14GQKWkX9oJzPiQQ7/J36FTXcD4kSp8egKjO9nINlSKiHITRA9q/R74qu8S9xlc/b/yjsJItQUeeh3xnGN0voQ== + +"@babel/helper-function-name@^7.17.9": + version "7.17.9" + resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz" + integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg== + dependencies: + "@babel/template" "^7.16.7" + "@babel/types" "^7.17.0" + +"@babel/helper-hoist-variables@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz" + integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-module-imports@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz" + integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-module-transforms@^7.18.0": + version "7.18.0" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.0.tgz" + integrity sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA== + dependencies: + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-module-imports" "^7.16.7" + "@babel/helper-simple-access" "^7.17.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-validator-identifier" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.18.0" + "@babel/types" "^7.18.0" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.17.12", "@babel/helper-plugin-utils@^7.8.0": + version "7.17.12" + resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz" + integrity sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA== + +"@babel/helper-simple-access@^7.17.7": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.2.tgz" + integrity sha512-7LIrjYzndorDY88MycupkpQLKS1AFfsVRm2k/9PtKScSy5tZq0McZTj+DiMRynboZfIqOKvo03pmhTaUgiD6fQ== + dependencies: + "@babel/types" "^7.18.2" + +"@babel/helper-split-export-declaration@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz" + integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-validator-identifier@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz" + integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== + +"@babel/helper-validator-option@^7.16.7": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz" + integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== + +"@babel/helpers@^7.18.2": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.2.tgz" + integrity sha512-j+d+u5xT5utcQSzrh9p+PaJX94h++KN+ng9b9WEJq7pkUPAd61FGqhjuUEdfknb3E/uDBb7ruwEeKkIxNJPIrg== + dependencies: + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.18.2" + "@babel/types" "^7.18.2" + +"@babel/highlight@^7.16.7": + version "7.17.12" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz" + integrity sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.7", "@babel/parser@^7.18.0": + version "7.18.3" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.18.3.tgz" + integrity sha512-rL50YcEuHbbauAFAysNsJA4/f89fGTOBRNs9P81sniKnKAr4xULe5AecolcsKbi88xu0ByWYDj/S1AJ3FSFuSQ== + +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-class-properties@^7.8.3": + version "7.12.13" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== + dependencies: + "@babel/helper-plugin-utils" "^7.12.13" + +"@babel/plugin-syntax-import-meta@^7.8.3": + version "7.10.4" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": + version "7.10.4" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-numeric-separator@^7.8.3": + version "7.10.4" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" + +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" + +"@babel/plugin-syntax-top-level-await@^7.8.3": + version "7.14.5" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" + +"@babel/plugin-syntax-typescript@^7.7.2": + version "7.17.12" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.17.12.tgz" + integrity sha512-TYY0SXFiO31YXtNg3HtFwNJHjLsAyIIhAhNWkQ5whPPS7HWUFlg9z0Ta4qAQNjQbP1wsSt/oKkmZ/4/WWdMUpw== + dependencies: + "@babel/helper-plugin-utils" "^7.17.12" + +"@babel/runtime@^7.7.2": + version "7.19.0" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz" + integrity sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA== + dependencies: + regenerator-runtime "^0.13.4" + +"@babel/template@^7.16.7", "@babel/template@^7.3.3": + version "7.16.7" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz" + integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/parser" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/traverse@^7.18.0", "@babel/traverse@^7.18.2", "@babel/traverse@^7.7.2": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.2.tgz" + integrity sha512-9eNwoeovJ6KH9zcCNnENY7DMFwTU9JdGCFtqNLfUAqtUHRCOsTOqWoffosP8vKmNYeSBUv3yVJXjfd8ucwOjUA== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.18.2" + "@babel/helper-environment-visitor" "^7.18.2" + "@babel/helper-function-name" "^7.17.9" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.18.0" + "@babel/types" "^7.18.2" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.16.7", "@babel/types@^7.17.0", "@babel/types@^7.18.0", "@babel/types@^7.18.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.18.2" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.18.2.tgz" + integrity sha512-0On6B8A4/+mFUto5WERt3EEuG1NznDirvwca1O8UwXQHVY8g3R7OzYgxXdOfMwLO08UrpUD/2+3Bclyq+/C94Q== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@eslint/eslintrc@^1.3.0": + version "1.3.0" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz" + integrity sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.3.2" + globals "^13.15.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@hapi/boom@^9.1.3": + version "9.1.4" + resolved "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz" + integrity sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw== + dependencies: + "@hapi/hoek" "9.x.x" + +"@hapi/hoek@9.x.x": + version "9.3.0" + resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" + integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== + +"@humanwhocodes/config-array@^0.9.2": + version "0.9.5" + resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz" + integrity sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2": + version "0.1.3" + resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== + +"@jest/console@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/console/-/console-27.5.1.tgz" + integrity sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg== + dependencies: + "@jest/types" "^27.5.1" + "@types/node" "*" + chalk "^4.0.0" + jest-message-util "^27.5.1" + jest-util "^27.5.1" + slash "^3.0.0" + +"@jest/core@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/core/-/core-27.5.1.tgz" + integrity sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ== + dependencies: + "@jest/console" "^27.5.1" + "@jest/reporters" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/transform" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.8.1" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-changed-files "^27.5.1" + jest-config "^27.5.1" + jest-haste-map "^27.5.1" + jest-message-util "^27.5.1" + jest-regex-util "^27.5.1" + jest-resolve "^27.5.1" + jest-resolve-dependencies "^27.5.1" + jest-runner "^27.5.1" + jest-runtime "^27.5.1" + jest-snapshot "^27.5.1" + jest-util "^27.5.1" + jest-validate "^27.5.1" + jest-watcher "^27.5.1" + micromatch "^4.0.4" + rimraf "^3.0.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz" + integrity sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA== + dependencies: + "@jest/fake-timers" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + jest-mock "^27.5.1" + +"@jest/fake-timers@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz" + integrity sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ== + dependencies: + "@jest/types" "^27.5.1" + "@sinonjs/fake-timers" "^8.0.1" + "@types/node" "*" + jest-message-util "^27.5.1" + jest-mock "^27.5.1" + jest-util "^27.5.1" + +"@jest/globals@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz" + integrity sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q== + dependencies: + "@jest/environment" "^27.5.1" + "@jest/types" "^27.5.1" + expect "^27.5.1" + +"@jest/reporters@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/reporters/-/reporters-27.5.1.tgz" + integrity sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/transform" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + chalk "^4.0.0" + collect-v8-coverage "^1.0.0" + exit "^0.1.2" + glob "^7.1.2" + graceful-fs "^4.2.9" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^5.1.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.1.3" + jest-haste-map "^27.5.1" + jest-resolve "^27.5.1" + jest-util "^27.5.1" + jest-worker "^27.5.1" + slash "^3.0.0" + source-map "^0.6.0" + string-length "^4.0.1" + terminal-link "^2.0.0" + v8-to-istanbul "^8.1.0" + +"@jest/source-map@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-27.5.1.tgz" + integrity sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg== + dependencies: + callsites "^3.0.0" + graceful-fs "^4.2.9" + source-map "^0.6.0" + +"@jest/test-result@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/test-result/-/test-result-27.5.1.tgz" + integrity sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag== + dependencies: + "@jest/console" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" + +"@jest/test-sequencer@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz" + integrity sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ== + dependencies: + "@jest/test-result" "^27.5.1" + graceful-fs "^4.2.9" + jest-haste-map "^27.5.1" + jest-runtime "^27.5.1" + +"@jest/transform@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/transform/-/transform-27.5.1.tgz" + integrity sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw== + dependencies: + "@babel/core" "^7.1.0" + "@jest/types" "^27.5.1" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^1.4.0" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^27.5.1" + jest-regex-util "^27.5.1" + jest-util "^27.5.1" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + source-map "^0.6.1" + write-file-atomic "^3.0.0" + +"@jest/types@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz" + integrity sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^16.0.0" + chalk "^4.0.0" + +"@jimp/bmp@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.1.tgz" + integrity sha512-iwyNYQeBawrdg/f24x3pQ5rEx+/GwjZcCXd3Kgc+ZUd+Ivia7sIqBsOnDaMZdKCBPlfW364ekexnlOqyVa0NWg== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + bmp-js "^0.1.0" + +"@jimp/core@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/core/-/core-0.16.1.tgz" + integrity sha512-la7kQia31V6kQ4q1kI/uLimu8FXx7imWVajDGtwUG8fzePLWDFJyZl0fdIXVCL1JW2nBcRHidUot6jvlRDi2+g== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + any-base "^1.1.0" + buffer "^5.2.0" + exif-parser "^0.1.12" + file-type "^9.0.0" + load-bmfont "^1.3.1" + mkdirp "^0.5.1" + phin "^2.9.1" + pixelmatch "^4.0.2" + tinycolor2 "^1.4.1" + +"@jimp/custom@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.1.tgz" + integrity sha512-DNUAHNSiUI/j9hmbatD6WN/EBIyeq4AO0frl5ETtt51VN1SvE4t4v83ZA/V6ikxEf3hxLju4tQ5Pc3zmZkN/3A== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/core" "^0.16.1" + +"@jimp/gif@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.1.tgz" + integrity sha512-r/1+GzIW1D5zrP4tNrfW+3y4vqD935WBXSc8X/wm23QTY9aJO9Lw6PEdzpYCEY+SOklIFKaJYUAq/Nvgm/9ryw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + gifwrap "^0.9.2" + omggif "^1.0.9" + +"@jimp/jpeg@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.1.tgz" + integrity sha512-8352zrdlCCLFdZ/J+JjBslDvml+fS3Z8gttdml0We759PnnZGqrnPRhkOEOJbNUlE+dD4ckLeIe6NPxlS/7U+w== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + jpeg-js "0.4.2" + +"@jimp/plugin-blit@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.1.tgz" + integrity sha512-fKFNARm32RoLSokJ8WZXHHH2CGzz6ire2n1Jh6u+XQLhk9TweT1DcLHIXwQMh8oR12KgjbgsMGvrMVlVknmOAg== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-blur@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.1.tgz" + integrity sha512-1WhuLGGj9MypFKRcPvmW45ht7nXkOKu+lg3n2VBzIB7r4kKNVchuI59bXaCYQumOLEqVK7JdB4glaDAbCQCLyw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-circle@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.1.tgz" + integrity sha512-JK7yi1CIU7/XL8hdahjcbGA3V7c+F+Iw+mhMQhLEi7Q0tCnZ69YJBTamMiNg3fWPVfMuvWJJKOBRVpwNTuaZRg== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-color@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.1.tgz" + integrity sha512-9yQttBAO5SEFj7S6nJK54f+1BnuBG4c28q+iyzm1JjtnehjqMg6Ljw4gCSDCvoCQ3jBSYHN66pmwTV74SU1B7A== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + tinycolor2 "^1.4.1" + +"@jimp/plugin-contain@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.1.tgz" + integrity sha512-44F3dUIjBDHN+Ym/vEfg+jtjMjAqd2uw9nssN67/n4FdpuZUVs7E7wadKY1RRNuJO+WgcD5aDQcsvurXMETQTg== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-cover@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.1.tgz" + integrity sha512-YztWCIldBAVo0zxcQXR+a/uk3/TtYnpKU2CanOPJ7baIuDlWPsG+YE4xTsswZZc12H9Kl7CiziEbDtvF9kwA/Q== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-crop@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.1.tgz" + integrity sha512-UQdva9oQzCVadkyo3T5Tv2CUZbf0klm2cD4cWMlASuTOYgaGaFHhT9st+kmfvXjKL8q3STkBu/zUPV6PbuV3ew== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-displace@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.1.tgz" + integrity sha512-iVAWuz2+G6Heu8gVZksUz+4hQYpR4R0R/RtBzpWEl8ItBe7O6QjORAkhxzg+WdYLL2A/Yd4ekTpvK0/qW8hTVw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-dither@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.1.tgz" + integrity sha512-tADKVd+HDC9EhJRUDwMvzBXPz4GLoU6s5P7xkVq46tskExYSptgj5713J5Thj3NMgH9Rsqu22jNg1H/7tr3V9Q== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-fisheye@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.1.tgz" + integrity sha512-BWHnc5hVobviTyIRHhIy9VxI1ACf4CeSuCfURB6JZm87YuyvgQh5aX5UDKtOz/3haMHXBLP61ZBxlNpMD8CG4A== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-flip@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.1.tgz" + integrity sha512-KdxTf0zErfZ8DyHkImDTnQBuHby+a5YFdoKI/G3GpBl3qxLBvC+PWkS2F/iN3H7wszP7/TKxTEvWL927pypT0w== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-gaussian@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.1.tgz" + integrity sha512-u9n4wjskh3N1mSqketbL6tVcLU2S5TEaFPR40K6TDv4phPLZALi1Of7reUmYpVm8mBDHt1I6kGhuCJiWvzfGyg== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-invert@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.1.tgz" + integrity sha512-2DKuyVXANH8WDpW9NG+PYFbehzJfweZszFYyxcaewaPLN0GxvxVLOGOPP1NuUTcHkOdMFbE0nHDuB7f+sYF/2w== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-mask@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.1.tgz" + integrity sha512-snfiqHlVuj4bSFS0v96vo2PpqCDMe4JB+O++sMo5jF5mvGcGL6AIeLo8cYqPNpdO6BZpBJ8MY5El0Veckhr39Q== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-normalize@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.1.tgz" + integrity sha512-dOQfIOvGLKDKXPU8xXWzaUeB0nvkosHw6Xg1WhS1Z5Q0PazByhaxOQkSKgUryNN/H+X7UdbDvlyh/yHf3ITRaw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-print@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.1.tgz" + integrity sha512-ceWgYN40jbN4cWRxixym+csyVymvrryuKBQ+zoIvN5iE6OyS+2d7Mn4zlNgumSczb9GGyZZESIgVcBDA1ezq0Q== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + load-bmfont "^1.4.0" + +"@jimp/plugin-resize@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.1.tgz" + integrity sha512-u4JBLdRI7dargC04p2Ha24kofQBk3vhaf0q8FwSYgnCRwxfvh2RxvhJZk9H7Q91JZp6wgjz/SjvEAYjGCEgAwQ== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-rotate@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.1.tgz" + integrity sha512-ZUU415gDQ0VjYutmVgAYYxC9Og9ixu2jAGMCU54mSMfuIlmohYfwARQmI7h4QB84M76c9hVLdONWjuo+rip/zg== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-scale@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.1.tgz" + integrity sha512-jM2QlgThIDIc4rcyughD5O7sOYezxdafg/2Xtd1csfK3z6fba3asxDwthqPZAgitrLgiKBDp6XfzC07Y/CefUw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-shadow@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.1.tgz" + integrity sha512-MeD2Is17oKzXLnsphAa1sDstTu6nxscugxAEk3ji0GV1FohCvpHBcec0nAq6/czg4WzqfDts+fcPfC79qWmqrA== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugin-threshold@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.1.tgz" + integrity sha512-iGW8U/wiCSR0+6syrPioVGoSzQFt4Z91SsCRbgNKTAk7D+XQv6OI78jvvYg4o0c2FOlwGhqz147HZV5utoSLxA== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + +"@jimp/plugins@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.1.tgz" + integrity sha512-c+lCqa25b+4q6mJZSetlxhMoYuiltyS+ValLzdwK/47+aYsq+kcJNl+TuxIEKf59yr9+5rkbpsPkZHLF/V7FFA== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/plugin-blit" "^0.16.1" + "@jimp/plugin-blur" "^0.16.1" + "@jimp/plugin-circle" "^0.16.1" + "@jimp/plugin-color" "^0.16.1" + "@jimp/plugin-contain" "^0.16.1" + "@jimp/plugin-cover" "^0.16.1" + "@jimp/plugin-crop" "^0.16.1" + "@jimp/plugin-displace" "^0.16.1" + "@jimp/plugin-dither" "^0.16.1" + "@jimp/plugin-fisheye" "^0.16.1" + "@jimp/plugin-flip" "^0.16.1" + "@jimp/plugin-gaussian" "^0.16.1" + "@jimp/plugin-invert" "^0.16.1" + "@jimp/plugin-mask" "^0.16.1" + "@jimp/plugin-normalize" "^0.16.1" + "@jimp/plugin-print" "^0.16.1" + "@jimp/plugin-resize" "^0.16.1" + "@jimp/plugin-rotate" "^0.16.1" + "@jimp/plugin-scale" "^0.16.1" + "@jimp/plugin-shadow" "^0.16.1" + "@jimp/plugin-threshold" "^0.16.1" + timm "^1.6.1" + +"@jimp/png@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/png/-/png-0.16.1.tgz" + integrity sha512-iyWoCxEBTW0OUWWn6SveD4LePW89kO7ZOy5sCfYeDM/oTPLpR8iMIGvZpZUz1b8kvzFr27vPst4E5rJhGjwsdw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/utils" "^0.16.1" + pngjs "^3.3.3" + +"@jimp/tiff@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.1.tgz" + integrity sha512-3K3+xpJS79RmSkAvFMgqY5dhSB+/sxhwTFA9f4AVHUK0oKW+u6r52Z1L0tMXHnpbAdR9EJ+xaAl2D4x19XShkQ== + dependencies: + "@babel/runtime" "^7.7.2" + utif "^2.0.1" + +"@jimp/types@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/types/-/types-0.16.1.tgz" + integrity sha512-g1w/+NfWqiVW4CaXSJyD28JQqZtm2eyKMWPhBBDCJN9nLCN12/Az0WFF3JUAktzdsEC2KRN2AqB1a2oMZBNgSQ== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/bmp" "^0.16.1" + "@jimp/gif" "^0.16.1" + "@jimp/jpeg" "^0.16.1" + "@jimp/png" "^0.16.1" + "@jimp/tiff" "^0.16.1" + timm "^1.6.1" + +"@jimp/utils@^0.16.1": + version "0.16.1" + resolved "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.1.tgz" + integrity sha512-8fULQjB0x4LzUSiSYG6ZtQl355sZjxbv8r9PPAuYHzS9sGiSHJQavNqK/nKnpDsVkU88/vRGcE7t3nMU0dEnVw== + dependencies: + "@babel/runtime" "^7.7.2" + regenerator-runtime "^0.13.3" + +"@jridgewell/gen-mapping@^0.1.0": + version "0.1.1" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz" + integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== + dependencies: + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/gen-mapping@^0.3.0": + version "0.3.1" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz" + integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg== + dependencies: + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.0.7" + resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz" + integrity sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA== + +"@jridgewell/set-array@^1.0.0": + version "1.1.1" + resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.1.tgz" + integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.13" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz" + integrity sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.13" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz" + integrity sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + +"@sinonjs/commons@^1.7.0": + version "1.8.3" + resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz" + integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== + dependencies: + type-detect "4.0.8" + +"@sinonjs/fake-timers@^8.0.1": + version "8.1.0" + resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz" + integrity sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg== + dependencies: + "@sinonjs/commons" "^1.7.0" + +"@tokenizer/token@^0.3.0": + version "0.3.0" + resolved "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz" + integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== + +"@tootallnate/once@1": + version "1.1.2" + resolved "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz" + integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== + +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.3" + resolved "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz" + integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + +"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": + version "7.1.19" + resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz" + integrity sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + +"@types/babel__generator@*": + version "7.6.4" + resolved "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz" + integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== + dependencies: + "@babel/types" "^7.0.0" + +"@types/babel__template@*": + version "7.4.1" + resolved "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz" + integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": + version "7.17.1" + resolved "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.17.1.tgz" + integrity sha512-kVzjari1s2YVi77D3w1yuvohV2idweYXMCDzqBiVNN63TcDWrIlTVOYpqVrvbbyOE/IyzBoTKF0fdnLPEORFxA== + dependencies: + "@babel/types" "^7.3.0" + +"@types/got@^9.6.11": + version "9.6.12" + resolved "https://registry.npmjs.org/@types/got/-/got-9.6.12.tgz" + integrity sha512-X4pj/HGHbXVLqTpKjA2ahI4rV/nNBc9mGO2I/0CgAra+F2dKgMXnENv2SRpemScBzBAI4vMelIVYViQxlSE6xA== + dependencies: + "@types/node" "*" + "@types/tough-cookie" "*" + form-data "^2.5.0" + +"@types/graceful-fs@^4.1.2": + version "4.1.5" + resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz" + integrity sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw== + dependencies: + "@types/node" "*" + +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.4" + resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^3.0.0": + version "3.0.1" + resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz" + integrity sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw== + dependencies: + "@types/istanbul-lib-report" "*" + +"@types/jest@^27.5.1": + version "27.5.1" + resolved "https://registry.npmjs.org/@types/jest/-/jest-27.5.1.tgz" + integrity sha512-fUy7YRpT+rHXto1YlL+J9rs0uLGyiqVt3ZOTQR+4ROc47yNl8WLdVLgUloBRhOxP1PZvguHl44T3H0wAWxahYQ== + dependencies: + jest-matcher-utils "^27.0.0" + pretty-format "^27.0.0" + +"@types/json-schema@^7.0.9": + version "7.0.11" + resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + +"@types/long@^4.0.0", "@types/long@^4.0.1": + version "4.0.2" + resolved "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== + +"@types/node@*", "@types/node@^16.0.0": + version "16.11.38" + resolved "https://registry.npmjs.org/@types/node/-/node-16.11.38.tgz" + integrity sha512-hjO/0K140An3GWDw2HJfq7gko3wWeznbjXgg+rzPdVzhe198hp4x2i1dgveAOEiFKd8sOilAxzoSJiVv5P/CUg== + +"@types/node@16.9.1": + version "16.9.1" + resolved "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz" + integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g== + +"@types/node@>=13.7.0": + version "17.0.38" + resolved "https://registry.npmjs.org/@types/node/-/node-17.0.38.tgz" + integrity sha512-5jY9RhV7c0Z4Jy09G+NIDTsCZ5G0L5n+Z+p+Y7t5VJHM30bgwzSjVtlcBxqAj+6L/swIlvtOSzr8rBk/aNyV2g== + +"@types/node@^10.1.0": + version "10.17.60" + resolved "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz" + integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== + +"@types/prettier@^2.1.5": + version "2.6.3" + resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.3.tgz" + integrity sha512-ymZk3LEC/fsut+/Q5qejp6R9O1rMxz3XaRHDV6kX8MrGAhOSPqVARbDi+EZvInBpw+BnCX3TD240byVkOfQsHg== + +"@types/semver@^7.3.12": + version "7.3.13" + resolved "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz" + integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + +"@types/sharp@^0.29.4": + version "0.29.5" + resolved "https://registry.npmjs.org/@types/sharp/-/sharp-0.29.5.tgz" + integrity sha512-3TC+S3H5RwnJmLYMHrcdfNjz/CaApKmujjY9b6PU/pE6n0qfooi99YqXGWoW8frU9EWYj/XTI35Pzxa+ThAZ5Q== + dependencies: + "@types/node" "*" + +"@types/stack-utils@^2.0.0": + version "2.0.1" + resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz" + integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== + +"@types/tough-cookie@*": + version "4.0.2" + resolved "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz" + integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw== + +"@types/ws@^8.0.0": + version "8.5.3" + resolved "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz" + integrity sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w== + dependencies: + "@types/node" "*" + +"@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + +"@types/yargs@^16.0.0": + version "16.0.4" + resolved "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz" + integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/eslint-plugin@^5.33.1": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz" + integrity sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg== + dependencies: + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/type-utils" "5.52.0" + "@typescript-eslint/utils" "5.52.0" + debug "^4.3.4" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + regexpp "^3.2.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.33.1": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.52.0.tgz" + integrity sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA== + dependencies: + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/typescript-estree" "5.52.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.52.0": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz" + integrity sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw== + dependencies: + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/visitor-keys" "5.52.0" + +"@typescript-eslint/type-utils@5.52.0": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz" + integrity sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw== + dependencies: + "@typescript-eslint/typescript-estree" "5.52.0" + "@typescript-eslint/utils" "5.52.0" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.52.0": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.52.0.tgz" + integrity sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ== + +"@typescript-eslint/typescript-estree@5.52.0": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz" + integrity sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ== + dependencies: + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/visitor-keys" "5.52.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.52.0": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.52.0.tgz" + integrity sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA== + dependencies: + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/typescript-estree" "5.52.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.52.0": + version "5.52.0" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz" + integrity sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA== + dependencies: + "@typescript-eslint/types" "5.52.0" + eslint-visitor-keys "^3.3.0" + +abab@^2.0.3, abab@^2.0.5: + version "2.0.6" + resolved "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== + +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + +acorn-globals@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz" + integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== + dependencies: + acorn "^7.1.1" + acorn-walk "^7.1.1" + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn-walk@^7.1.1: + version "7.2.0" + resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz" + integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== + +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@^7.1.1: + version "7.4.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + +acorn@^8.2.4, acorn@^8.4.1, acorn@^8.7.1: + version "8.7.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== + +agent-base@6: + version "6.0.2" + resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz" + integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== + dependencies: + debug "4" + +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-escapes@^4.2.1: + version "4.3.2" + resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== + dependencies: + type-fest "^0.21.3" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^5.0.0: + version "5.2.0" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== + +any-base@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz" + integrity sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg== + +anymatch@^3.0.3: + version "3.1.2" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz" + integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +are-we-there-yet@~1.1.2: + version "1.1.7" + resolved "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz" + integrity sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +array-includes@^3.1.5: + version "3.1.5" + resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz" + integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + get-intrinsic "^1.1.1" + is-string "^1.0.7" + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +array.prototype.flatmap@^1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz" + integrity sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.2" + es-shim-unscopables "^1.0.0" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +atomic-sleep@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz" + integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== + +axios@^1.3.3: + version "1.3.3" + resolved "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz" + integrity sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA== + dependencies: + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + +babel-jest@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz" + integrity sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg== + dependencies: + "@jest/transform" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/babel__core" "^7.1.14" + babel-plugin-istanbul "^6.1.1" + babel-preset-jest "^27.5.1" + chalk "^4.0.0" + graceful-fs "^4.2.9" + slash "^3.0.0" + +babel-plugin-istanbul@^6.1.1: + version "6.1.1" + resolved "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz" + integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^5.0.4" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz" + integrity sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ== + dependencies: + "@babel/template" "^7.3.3" + "@babel/types" "^7.3.3" + "@types/babel__core" "^7.0.0" + "@types/babel__traverse" "^7.0.6" + +babel-preset-current-node-syntax@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz" + integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.8.3" + "@babel/plugin-syntax-import-meta" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-top-level-await" "^7.8.3" + +babel-preset-jest@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz" + integrity sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag== + dependencies: + babel-plugin-jest-hoist "^27.5.1" + babel-preset-current-node-syntax "^1.0.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bl@^4.0.3: + version "4.1.0" + resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + +bmp-js@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz" + integrity sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw== + +boolbase@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz" + integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +browser-process-hrtime@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz" + integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== + +browserslist@^4.20.2: + version "4.20.3" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.20.3.tgz" + integrity sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg== + dependencies: + caniuse-lite "^1.0.30001332" + electron-to-chromium "^1.4.118" + escalade "^3.1.1" + node-releases "^2.0.3" + picocolors "^1.0.0" + +bs-logger@0.x: + version "0.2.6" + resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + +bser@2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== + dependencies: + node-int64 "^0.4.0" + +buffer-equal@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz" + integrity sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA== + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +buffer@^5.2.0, buffer@^5.5.0: + version "5.7.1" + resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.2.0: + version "6.3.0" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001332: + version "1.0.30001344" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001344.tgz" + integrity sha512-0ZFjnlCaXNOAYcV7i+TtdKBp0L/3XEU2MF/x6Du1lrh+SRX4IfzIVL4HNJg5pB2PmFb8rszIGyOvsZnqqRoc2g== + +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +char-regex@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== + +cheerio-select@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz" + integrity sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g== + dependencies: + boolbase "^1.0.0" + css-select "^5.1.0" + css-what "^6.1.0" + domelementtype "^2.3.0" + domhandler "^5.0.3" + domutils "^3.0.1" + +cheerio@1.0.0-rc.11: + version "1.0.0-rc.11" + resolved "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.11.tgz" + integrity sha512-bQwNaDIBKID5ts/DsdhxrjqFXYfLw4ste+wMKqWA8DyKcS4qwsPP4Bk8ZNaTJjvpiX/qW3BT4sU7d6Bh5i+dag== + dependencies: + cheerio-select "^2.1.0" + dom-serializer "^2.0.0" + domhandler "^5.0.3" + domutils "^3.0.1" + htmlparser2 "^8.0.1" + parse5 "^7.0.0" + parse5-htmlparser2-tree-adapter "^7.0.0" + tslib "^2.4.0" + +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + +ci-info@^3.2.0: + version "3.3.1" + resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.3.1.tgz" + integrity sha512-SXgeMX9VwDe7iFFaEWkA5AstuER9YKqy4EhHqr4DVqkwmD9rpVimkMKWHdjn30Ja45txyjhSn63lVX69eVCckg== + +cjs-module-lexer@^1.0.0: + version "1.2.2" + resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz" + integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== + +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + +clone@2.x: + version "2.1.2" + resolved "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz" + integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz" + integrity sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA== + +collect-v8-coverage@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz" + integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@^1.0.0, color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +color-string@^1.9.0: + version "1.9.1" + resolved "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz" + integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + +color@^4.2.3: + version "4.2.3" + resolved "https://registry.npmjs.org/color/-/color-4.2.3.tgz" + integrity sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A== + dependencies: + color-convert "^2.0.1" + color-string "^1.9.0" + +combined-stream@^1.0.6, combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz" + integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== + +content-type@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz" + integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== + +convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: + version "1.8.0" + resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz" + integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== + dependencies: + safe-buffer "~5.1.1" + +core-util-is@~1.0.0: + version "1.0.3" + resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" + integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +cross-fetch@3.1.5: + version "3.1.5" + resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz" + integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== + dependencies: + node-fetch "2.6.7" + +cross-spawn@^7.0.2, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +css-select@^5.1.0: + version "5.1.0" + resolved "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz" + integrity sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg== + dependencies: + boolbase "^1.0.0" + css-what "^6.1.0" + domhandler "^5.0.2" + domutils "^3.0.1" + nth-check "^2.0.1" + +css-what@^6.1.0: + version "6.1.0" + resolved "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz" + integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== + +cssom@^0.4.4: + version "0.4.4" + resolved "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz" + integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== + +cssom@~0.3.6: + version "0.3.8" + resolved "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz" + integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== + dependencies: + cssom "~0.3.6" + +curve25519-js@^0.0.4: + version "0.0.4" + resolved "https://registry.npmjs.org/curve25519-js/-/curve25519-js-0.0.4.tgz" + integrity sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w== + +data-urls@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz" + integrity sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== + dependencies: + abab "^2.0.3" + whatwg-mimetype "^2.3.0" + whatwg-url "^8.0.0" + +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +decimal.js@^10.2.1: + version "10.3.1" + resolved "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz" + integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== + +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz" + integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@^0.1.3, deep-is@~0.1.3: + version "0.1.4" + resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + +deepmerge@^4.2.2: + version "4.2.2" + resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz" + integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== + +define-properties@^1.1.3, define-properties@^1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== + dependencies: + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz" + integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== + +detect-libc@^2.0.0, detect-libc@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz" + integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w== + +detect-newline@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== + +diff-sequences@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.5.1.tgz" + integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +dom-serializer@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz" + integrity sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg== + dependencies: + domelementtype "^2.3.0" + domhandler "^5.0.2" + entities "^4.2.0" + +dom-walk@^0.1.0: + version "0.1.2" + resolved "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz" + integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== + +domelementtype@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz" + integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== + +domexception@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz" + integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== + dependencies: + webidl-conversions "^5.0.0" + +domhandler@^5.0.1, domhandler@^5.0.2, domhandler@^5.0.3: + version "5.0.3" + resolved "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz" + integrity sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w== + dependencies: + domelementtype "^2.3.0" + +domutils@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz" + integrity sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q== + dependencies: + dom-serializer "^2.0.0" + domelementtype "^2.3.0" + domhandler "^5.0.1" + +duplexify@^4.1.2: + version "4.1.2" + resolved "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz" + integrity sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.0" + +electron-to-chromium@^1.4.118: + version "1.4.141" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.141.tgz" + integrity sha512-mfBcbqc0qc6RlxrsIgLG2wCqkiPAjEezHxGTu7p3dHHFOurH4EjS9rFZndX5axC8264rI1Pcbw8uQP39oZckeA== + +emittery@^0.8.1: + version "0.8.1" + resolved "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz" + integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +entities@^4.2.0, entities@^4.3.0, entities@^4.4.0: + version "4.4.0" + resolved "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz" + integrity sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5: + version "1.20.1" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz" + integrity sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + function.prototype.name "^1.1.5" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" + has "^1.0.3" + has-property-descriptors "^1.0.0" + has-symbols "^1.0.3" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-weakref "^1.0.2" + object-inspect "^1.12.0" + object-keys "^1.1.1" + object.assign "^4.1.2" + regexp.prototype.flags "^1.4.3" + string.prototype.trimend "^1.0.5" + string.prototype.trimstart "^1.0.5" + unbox-primitive "^1.0.2" + +es-shim-unscopables@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz" + integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== + dependencies: + has "^1.0.3" + +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== + +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +escodegen@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz" + integrity sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.6.1" + +eslint-plugin-react@^7.30.0: + version "7.30.1" + resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.1.tgz" + integrity sha512-NbEvI9jtqO46yJA3wcRF9Mo0lF9T/jhdHqhCHXiXtD+Zcb98812wvokjWpU7Q4QH5edo6dmqrukxVvWWXHlsUg== + dependencies: + array-includes "^3.1.5" + array.prototype.flatmap "^1.3.0" + doctrine "^2.1.0" + estraverse "^5.3.0" + jsx-ast-utils "^2.4.1 || ^3.0.0" + minimatch "^3.1.2" + object.entries "^1.1.5" + object.fromentries "^2.0.5" + object.hasown "^1.1.1" + object.values "^1.1.5" + prop-types "^15.8.1" + resolve "^2.0.0-next.3" + semver "^6.3.0" + string.prototype.matchall "^4.0.7" + +eslint-plugin-simple-import-sort@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz" + integrity sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw== + +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== + +eslint@^8.0.0: + version "8.16.0" + resolved "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz" + integrity sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA== + dependencies: + "@eslint/eslintrc" "^1.3.0" + "@humanwhocodes/config-array" "^0.9.2" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.3.2" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^6.0.1" + globals "^13.15.0" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + regexpp "^3.2.0" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + +espree@^9.3.2: + version "9.3.2" + resolved "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz" + integrity sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA== + dependencies: + acorn "^8.7.1" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.3.0" + +esprima@^4.0.0, esprima@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: + version "5.3.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exif-parser@^0.1.12: + version "0.1.12" + resolved "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz" + integrity sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw== + +exit@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== + +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + +expect@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz" + integrity sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw== + dependencies: + "@jest/types" "^27.5.1" + jest-get-type "^27.5.1" + jest-matcher-utils "^27.5.1" + jest-message-util "^27.5.1" + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.2.9: + version "3.2.12" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: + version "2.0.6" + resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fast-redact@^3.0.0: + version "3.1.1" + resolved "https://registry.npmjs.org/fast-redact/-/fast-redact-3.1.1.tgz" + integrity sha512-odVmjC8x8jNeMZ3C+rPMESzXVSEU8tSWSHv9HFxP2mm89G/1WwqhrerJDQm9Zus8X6aoRgQDThKqptdNA6bt+A== + +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + +fb-watchman@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.1.tgz" + integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== + dependencies: + bser "2.1.1" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +file-type@16.5.3: + version "16.5.3" + resolved "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz" + integrity sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A== + dependencies: + readable-web-to-node-stream "^3.0.0" + strtok3 "^6.2.4" + token-types "^4.1.1" + +file-type@^9.0.0: + version "9.0.0" + resolved "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz" + integrity sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw== + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flatted@^3.1.0: + version "3.2.5" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz" + integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== + +follow-redirects@^1.15.0: + version "1.15.2" + resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + +form-data@^2.5.0: + version "2.5.1" + resolved "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz" + integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@^2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +function.prototype.name@^1.1.5: + version "1.1.5" + resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" + integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== + +functions-have-names@^1.2.2: + version "1.2.3" + resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + +futoin-hkdf@^1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/futoin-hkdf/-/futoin-hkdf-1.5.1.tgz" + integrity sha512-g5d0Qp7ks55hYmYmfqn4Nz18XH49lcCR+vvIvHT92xXnsJaGZmY1EtWQWilJ6BQp57heCIXM/rRo+AFep8hGgg== + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== + +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: + version "1.1.2" + resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz" + integrity sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.3" + +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== + +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" + +gifwrap@^0.9.2: + version "0.9.4" + resolved "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz" + integrity sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ== + dependencies: + image-q "^4.0.0" + omggif "^1.0.10" + +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz" + integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= + +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.2.0: + version "7.2.3" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +global@~4.4.0: + version "4.4.0" + resolved "https://registry.npmjs.org/global/-/global-4.4.0.tgz" + integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== + dependencies: + min-document "^2.19.0" + process "^0.11.10" + +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^13.15.0: + version "13.15.0" + resolved "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz" + integrity sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog== + dependencies: + type-fest "^0.20.2" + +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + +graceful-fs@^4.2.9: + version "4.2.10" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + +has-bigints@^1.0.1, has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + +has-symbols@^1.0.2, has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +html-encoding-sniffer@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz" + integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== + dependencies: + whatwg-encoding "^1.0.5" + +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== + +htmlparser2@^8.0.1: + version "8.0.1" + resolved "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz" + integrity sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA== + dependencies: + domelementtype "^2.3.0" + domhandler "^5.0.2" + domutils "^3.0.1" + entities "^4.3.0" + +http-proxy-agent@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz" + integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== + dependencies: + "@tootallnate/once" "1" + agent-base "6" + debug "4" + +https-proxy-agent@^5.0.0: + version "5.0.1" + resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== + dependencies: + agent-base "6" + debug "4" + +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ieee754@^1.1.13, ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +ignore@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz" + integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== + +image-q@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz" + integrity sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw== + dependencies: + "@types/node" "16.9.1" + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +import-local@^3.0.2: + version "3.1.0" + resolved "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@~1.3.0: + version "1.3.8" + resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +internal-slot@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz" + integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== + dependencies: + get-intrinsic "^1.1.0" + has "^1.0.3" + side-channel "^1.0.4" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-arrayish@^0.3.1: + version "0.3.2" + resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== + +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-callable@^1.1.4, is-callable@^1.2.4: + version "1.2.4" + resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== + +is-core-module@^2.8.1: + version "2.9.0" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== + dependencies: + has "^1.0.3" + +is-core-module@^2.9.0: + version "2.10.0" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz" + integrity sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg== + dependencies: + has "^1.0.3" + +is-date-object@^1.0.1: + version "1.0.5" + resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz" + integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== + dependencies: + has-tostringtag "^1.0.0" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-function@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz" + integrity sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ== + +is-generator-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== + +is-number-object@^1.0.4: + version "1.0.7" + resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz" + integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== + dependencies: + has-tostringtag "^1.0.0" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== + +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +is-string@^1.0.5, is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" + +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== + dependencies: + has-symbols "^1.0.2" + +is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +is-weakref@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz" + integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== + +istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: + version "5.2.0" + resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz" + integrity sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^6.3.0" + +istanbul-lib-report@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz" + integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== + dependencies: + istanbul-lib-coverage "^3.0.0" + make-dir "^3.0.0" + supports-color "^7.1.0" + +istanbul-lib-source-maps@^4.0.0: + version "4.0.1" + resolved "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz" + integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== + dependencies: + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" + source-map "^0.6.1" + +istanbul-reports@^3.1.3: + version "3.1.4" + resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz" + integrity sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw== + dependencies: + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" + +jest-changed-files@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.5.1.tgz" + integrity sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw== + dependencies: + "@jest/types" "^27.5.1" + execa "^5.0.0" + throat "^6.0.1" + +jest-circus@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-circus/-/jest-circus-27.5.1.tgz" + integrity sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw== + dependencies: + "@jest/environment" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + dedent "^0.7.0" + expect "^27.5.1" + is-generator-fn "^2.0.0" + jest-each "^27.5.1" + jest-matcher-utils "^27.5.1" + jest-message-util "^27.5.1" + jest-runtime "^27.5.1" + jest-snapshot "^27.5.1" + jest-util "^27.5.1" + pretty-format "^27.5.1" + slash "^3.0.0" + stack-utils "^2.0.3" + throat "^6.0.1" + +jest-cli@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-cli/-/jest-cli-27.5.1.tgz" + integrity sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw== + dependencies: + "@jest/core" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/types" "^27.5.1" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + import-local "^3.0.2" + jest-config "^27.5.1" + jest-util "^27.5.1" + jest-validate "^27.5.1" + prompts "^2.0.1" + yargs "^16.2.0" + +jest-config@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-config/-/jest-config-27.5.1.tgz" + integrity sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA== + dependencies: + "@babel/core" "^7.8.0" + "@jest/test-sequencer" "^27.5.1" + "@jest/types" "^27.5.1" + babel-jest "^27.5.1" + chalk "^4.0.0" + ci-info "^3.2.0" + deepmerge "^4.2.2" + glob "^7.1.1" + graceful-fs "^4.2.9" + jest-circus "^27.5.1" + jest-environment-jsdom "^27.5.1" + jest-environment-node "^27.5.1" + jest-get-type "^27.5.1" + jest-jasmine2 "^27.5.1" + jest-regex-util "^27.5.1" + jest-resolve "^27.5.1" + jest-runner "^27.5.1" + jest-util "^27.5.1" + jest-validate "^27.5.1" + micromatch "^4.0.4" + parse-json "^5.2.0" + pretty-format "^27.5.1" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz" + integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== + dependencies: + chalk "^4.0.0" + diff-sequences "^27.5.1" + jest-get-type "^27.5.1" + pretty-format "^27.5.1" + +jest-docblock@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.5.1.tgz" + integrity sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ== + dependencies: + detect-newline "^3.0.0" + +jest-each@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-each/-/jest-each-27.5.1.tgz" + integrity sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ== + dependencies: + "@jest/types" "^27.5.1" + chalk "^4.0.0" + jest-get-type "^27.5.1" + jest-util "^27.5.1" + pretty-format "^27.5.1" + +jest-environment-jsdom@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz" + integrity sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw== + dependencies: + "@jest/environment" "^27.5.1" + "@jest/fake-timers" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + jest-mock "^27.5.1" + jest-util "^27.5.1" + jsdom "^16.6.0" + +jest-environment-node@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.5.1.tgz" + integrity sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw== + dependencies: + "@jest/environment" "^27.5.1" + "@jest/fake-timers" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + jest-mock "^27.5.1" + jest-util "^27.5.1" + +jest-get-type@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.5.1.tgz" + integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== + +jest-haste-map@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.5.1.tgz" + integrity sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng== + dependencies: + "@jest/types" "^27.5.1" + "@types/graceful-fs" "^4.1.2" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^27.5.1" + jest-serializer "^27.5.1" + jest-util "^27.5.1" + jest-worker "^27.5.1" + micromatch "^4.0.4" + walker "^1.0.7" + optionalDependencies: + fsevents "^2.3.2" + +jest-jasmine2@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz" + integrity sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ== + dependencies: + "@jest/environment" "^27.5.1" + "@jest/source-map" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + chalk "^4.0.0" + co "^4.6.0" + expect "^27.5.1" + is-generator-fn "^2.0.0" + jest-each "^27.5.1" + jest-matcher-utils "^27.5.1" + jest-message-util "^27.5.1" + jest-runtime "^27.5.1" + jest-snapshot "^27.5.1" + jest-util "^27.5.1" + pretty-format "^27.5.1" + throat "^6.0.1" + +jest-leak-detector@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz" + integrity sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ== + dependencies: + jest-get-type "^27.5.1" + pretty-format "^27.5.1" + +jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz" + integrity sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw== + dependencies: + chalk "^4.0.0" + jest-diff "^27.5.1" + jest-get-type "^27.5.1" + pretty-format "^27.5.1" + +jest-message-util@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz" + integrity sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^27.5.1" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^27.5.1" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz" + integrity sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og== + dependencies: + "@jest/types" "^27.5.1" + "@types/node" "*" + +jest-pnp-resolver@^1.2.2: + version "1.2.2" + resolved "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz" + integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== + +jest-regex-util@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz" + integrity sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg== + +jest-resolve-dependencies@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz" + integrity sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg== + dependencies: + "@jest/types" "^27.5.1" + jest-regex-util "^27.5.1" + jest-snapshot "^27.5.1" + +jest-resolve@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz" + integrity sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw== + dependencies: + "@jest/types" "^27.5.1" + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^27.5.1" + jest-pnp-resolver "^1.2.2" + jest-util "^27.5.1" + jest-validate "^27.5.1" + resolve "^1.20.0" + resolve.exports "^1.1.0" + slash "^3.0.0" + +jest-runner@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-runner/-/jest-runner-27.5.1.tgz" + integrity sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ== + dependencies: + "@jest/console" "^27.5.1" + "@jest/environment" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/transform" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.8.1" + graceful-fs "^4.2.9" + jest-docblock "^27.5.1" + jest-environment-jsdom "^27.5.1" + jest-environment-node "^27.5.1" + jest-haste-map "^27.5.1" + jest-leak-detector "^27.5.1" + jest-message-util "^27.5.1" + jest-resolve "^27.5.1" + jest-runtime "^27.5.1" + jest-util "^27.5.1" + jest-worker "^27.5.1" + source-map-support "^0.5.6" + throat "^6.0.1" + +jest-runtime@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.5.1.tgz" + integrity sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A== + dependencies: + "@jest/environment" "^27.5.1" + "@jest/fake-timers" "^27.5.1" + "@jest/globals" "^27.5.1" + "@jest/source-map" "^27.5.1" + "@jest/test-result" "^27.5.1" + "@jest/transform" "^27.5.1" + "@jest/types" "^27.5.1" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + execa "^5.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^27.5.1" + jest-message-util "^27.5.1" + jest-mock "^27.5.1" + jest-regex-util "^27.5.1" + jest-resolve "^27.5.1" + jest-snapshot "^27.5.1" + jest-util "^27.5.1" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-serializer@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.5.1.tgz" + integrity sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w== + dependencies: + "@types/node" "*" + graceful-fs "^4.2.9" + +jest-snapshot@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.5.1.tgz" + integrity sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA== + dependencies: + "@babel/core" "^7.7.2" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/traverse" "^7.7.2" + "@babel/types" "^7.0.0" + "@jest/transform" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/babel__traverse" "^7.0.4" + "@types/prettier" "^2.1.5" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^27.5.1" + graceful-fs "^4.2.9" + jest-diff "^27.5.1" + jest-get-type "^27.5.1" + jest-haste-map "^27.5.1" + jest-matcher-utils "^27.5.1" + jest-message-util "^27.5.1" + jest-util "^27.5.1" + natural-compare "^1.4.0" + pretty-format "^27.5.1" + semver "^7.3.2" + +jest-util@^27.0.0, jest-util@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz" + integrity sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw== + dependencies: + "@jest/types" "^27.5.1" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + +jest-validate@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz" + integrity sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ== + dependencies: + "@jest/types" "^27.5.1" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^27.5.1" + leven "^3.1.0" + pretty-format "^27.5.1" + +jest-watcher@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.5.1.tgz" + integrity sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw== + dependencies: + "@jest/test-result" "^27.5.1" + "@jest/types" "^27.5.1" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + jest-util "^27.5.1" + string-length "^4.0.1" + +jest-worker@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + +jest@^27.0.6: + version "27.5.1" + resolved "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz" + integrity sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ== + dependencies: + "@jest/core" "^27.5.1" + import-local "^3.0.2" + jest-cli "^27.5.1" + +jimp@^0.16.1: + version "0.16.1" + resolved "https://registry.npmjs.org/jimp/-/jimp-0.16.1.tgz" + integrity sha512-+EKVxbR36Td7Hfd23wKGIeEyHbxShZDX6L8uJkgVW3ESA9GiTEPK08tG1XI2r/0w5Ch0HyJF5kPqF9K7EmGjaw== + dependencies: + "@babel/runtime" "^7.7.2" + "@jimp/custom" "^0.16.1" + "@jimp/plugins" "^0.16.1" + "@jimp/types" "^0.16.1" + regenerator-runtime "^0.13.3" + +jpeg-js@0.4.2: + version "0.4.2" + resolved "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.2.tgz" + integrity sha512-+az2gi/hvex7eLTMTlbRLOhH6P6WFdk2ITI8HJsaH2VqYO0I594zXSYEP+tf4FW+8Cy68ScDXoAsQdyQanv3sw== + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +jsdom@^16.6.0: + version "16.7.0" + resolved "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz" + integrity sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw== + dependencies: + abab "^2.0.5" + acorn "^8.2.4" + acorn-globals "^6.0.0" + cssom "^0.4.4" + cssstyle "^2.3.0" + data-urls "^2.0.0" + decimal.js "^10.2.1" + domexception "^2.0.1" + escodegen "^2.0.0" + form-data "^3.0.0" + html-encoding-sniffer "^2.0.1" + http-proxy-agent "^4.0.1" + https-proxy-agent "^5.0.0" + is-potential-custom-element-name "^1.0.1" + nwsapi "^2.2.0" + parse5 "6.0.1" + saxes "^5.0.1" + symbol-tree "^3.2.4" + tough-cookie "^4.0.0" + w3c-hr-time "^1.0.2" + w3c-xmlserializer "^2.0.0" + webidl-conversions "^6.1.0" + whatwg-encoding "^1.0.5" + whatwg-mimetype "^2.3.0" + whatwg-url "^8.5.0" + ws "^7.4.6" + xml-name-validator "^3.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +json5@2.x, json5@^2.2.1: + version "2.2.3" + resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + +jsonc-parser@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz" + integrity sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA== + +"jsx-ast-utils@^2.4.1 || ^3.0.0": + version "3.3.3" + resolved "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.3.tgz" + integrity sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw== + dependencies: + array-includes "^3.1.5" + object.assign "^4.1.3" + +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +levn@~0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +"libsignal@git+https://github.com/adiwajshing/libsignal-node": + version "2.0.1" + resolved "git+ssh://git@github.com/adiwajshing/libsignal-node.git#11dbd962ea108187c79a7c46fe4d6f790e23da97" + dependencies: + curve25519-js "^0.0.4" + protobufjs "6.8.8" + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +link-preview-js@^3.0.0: + version "3.0.4" + resolved "https://registry.npmjs.org/link-preview-js/-/link-preview-js-3.0.4.tgz" + integrity sha512-xsuxMigAZd4xmj6BIwMNuQjjpJdh0DWeIo1NXQgaoWSi9Z/dzz/Kxy6vzzsUonFlMTPJ1i0EC8aeOg/xrOMidg== + dependencies: + abort-controller "^3.0.0" + cheerio "1.0.0-rc.11" + cross-fetch "3.1.5" + url "0.11.0" + +load-bmfont@^1.3.1, load-bmfont@^1.4.0: + version "1.4.1" + resolved "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.1.tgz" + integrity sha512-8UyQoYmdRDy81Brz6aLAUhfZLwr5zV0L3taTQ4hju7m6biuwiWiJXjPhBJxbUQJA8PrkvJ/7Enqmwk2sM14soA== + dependencies: + buffer-equal "0.0.1" + mime "^1.3.4" + parse-bmfont-ascii "^1.0.3" + parse-bmfont-binary "^1.0.5" + parse-bmfont-xml "^1.1.4" + phin "^2.9.1" + xhr "^2.0.1" + xtend "^4.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +lodash.memoize@4.x: + version "4.1.2" + resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz" + integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash@^4.7.0: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +long@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + +loose-envify@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +lunr@^2.3.9: + version "2.3.9" + resolved "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz" + integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== + +make-dir@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + +make-error@1.x, make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== + dependencies: + tmpl "1.0.5" + +marked@^4.0.12: + version "4.0.16" + resolved "https://registry.npmjs.org/marked/-/marked-4.0.16.tgz" + integrity sha512-wahonIQ5Jnyatt2fn8KqF/nIqZM8mh3oRu2+l5EANGMhu6RFjiSG52QNE2eWzFMI94HqYSgN184NurgNG6CztA== + +media-typer@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz" + integrity sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw== + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime@^1.3.4: + version "1.6.0" + resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +min-document@^2.19.0: + version "2.19.0" + resolved "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz" + integrity sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ== + dependencies: + dom-walk "^0.1.0" + +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^5.0.1: + version "5.1.0" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz" + integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== + dependencies: + brace-expansion "^2.0.1" + +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: + version "1.2.6" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz" + integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== + +mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: + version "0.5.3" + resolved "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + +mkdirp@^0.5.1: + version "0.5.6" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz" + integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== + dependencies: + minimist "^1.2.6" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +music-metadata@^7.12.3: + version "7.12.3" + resolved "https://registry.npmjs.org/music-metadata/-/music-metadata-7.12.3.tgz" + integrity sha512-6pZngaroNxGBf8KZjE8reGZJiS533eJq7dBFsyoiEAZIORQAxmVVx20ABh9W2tsLT+5mKYyDzcNi5GuHf3jitg== + dependencies: + "@tokenizer/token" "^0.3.0" + content-type "^1.0.4" + debug "^4.3.4" + file-type "16.5.3" + media-typer "^1.1.0" + strtok3 "^6.3.0" + token-types "^4.2.0" + +napi-build-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz" + integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== + +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +node-abi@^3.3.0: + version "3.22.0" + resolved "https://registry.npmjs.org/node-abi/-/node-abi-3.22.0.tgz" + integrity sha512-u4uAs/4Zzmp/jjsD9cyFYDXeISfUWaAVWshPmDZOFOv4Xl4SbzTXm53I04C2uRueYJ+0t5PEtLH/owbn2Npf/w== + dependencies: + semver "^7.3.5" + +node-addon-api@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.0.0.tgz" + integrity sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA== + +node-cache@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz" + integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== + dependencies: + clone "2.x" + +node-fetch@2.6.7: + version "2.6.7" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-releases@^2.0.3: + version "2.0.5" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.5.tgz" + integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q== + +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +npmlog@^4.0.1: + version "4.1.2" + resolved "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +nth-check@^2.0.1: + version "2.1.1" + resolved "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz" + integrity sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w== + dependencies: + boolbase "^1.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +nwsapi@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz" + integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== + +object-assign@^4.1.0, object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +object-inspect@^1.12.0, object-inspect@^1.9.0: + version "1.12.2" + resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz" + integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== + +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object.assign@^4.1.2, object.assign@^4.1.3: + version "4.1.4" + resolved "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz" + integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + has-symbols "^1.0.3" + object-keys "^1.1.1" + +object.entries@^1.1.5: + version "1.1.5" + resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz" + integrity sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + +object.fromentries@^2.0.5: + version "2.0.5" + resolved "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz" + integrity sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + +object.hasown@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz" + integrity sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A== + dependencies: + define-properties "^1.1.4" + es-abstract "^1.19.5" + +object.values@^1.1.5: + version "1.1.5" + resolved "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz" + integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + +omggif@^1.0.10, omggif@^1.0.9: + version "1.0.10" + resolved "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz" + integrity sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw== + +on-exit-leak-free@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz" + integrity sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg== + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +optionator@^0.8.1: + version "0.8.3" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.6" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + word-wrap "~1.2.3" + +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +pako@^1.0.5: + version "1.0.11" + resolved "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz" + integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-bmfont-ascii@^1.0.3: + version "1.0.6" + resolved "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz" + integrity sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA== + +parse-bmfont-binary@^1.0.5: + version "1.0.6" + resolved "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz" + integrity sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA== + +parse-bmfont-xml@^1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz" + integrity sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ== + dependencies: + xml-parse-from-string "^1.0.0" + xml2js "^0.4.5" + +parse-headers@^2.0.0: + version "2.0.5" + resolved "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz" + integrity sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA== + +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +parse5-htmlparser2-tree-adapter@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz" + integrity sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g== + dependencies: + domhandler "^5.0.2" + parse5 "^7.0.0" + +parse5@6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== + +parse5@^7.0.0: + version "7.1.1" + resolved "https://registry.npmjs.org/parse5/-/parse5-7.1.1.tgz" + integrity sha512-kwpuwzB+px5WUg9pyK0IcK/shltJN5/OVhQagxhCQNtT9Y9QRZqNY2e1cmbu/paRh5LMnz/oVTVLBpjFmMZhSg== + dependencies: + entities "^4.4.0" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +peek-readable@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz" + integrity sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg== + +phin@^2.9.1: + version "2.9.3" + resolved "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz" + integrity sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pino-abstract-transport@v0.5.0: + version "0.5.0" + resolved "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz" + integrity sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ== + dependencies: + duplexify "^4.1.2" + split2 "^4.0.0" + +pino-std-serializers@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz" + integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== + +pino@^7.0.0: + version "7.11.0" + resolved "https://registry.npmjs.org/pino/-/pino-7.11.0.tgz" + integrity sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.0.0" + on-exit-leak-free "^0.2.0" + pino-abstract-transport v0.5.0 + pino-std-serializers "^4.0.0" + process-warning "^1.0.0" + quick-format-unescaped "^4.0.3" + real-require "^0.1.0" + safe-stable-stringify "^2.1.0" + sonic-boom "^2.2.1" + thread-stream "^0.15.1" + +pirates@^4.0.4: + version "4.0.5" + resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz" + integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== + +pixelmatch@^4.0.2: + version "4.0.2" + resolved "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz" + integrity sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA== + dependencies: + pngjs "^3.0.0" + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + +pngjs@^3.0.0, pngjs@^3.3.3: + version "3.4.0" + resolved "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz" + integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== + +prebuild-install@^7.1.0: + version "7.1.0" + resolved "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.0.tgz" + integrity sha512-CNcMgI1xBypOyGqjp3wOc8AAo1nMhZS3Cwd3iHIxOdAUbb+YxdNuM4Z5iIrZ8RLvOsf3F3bl7b7xGq6DjQoNYA== + dependencies: + detect-libc "^2.0.0" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.3" + mkdirp-classic "^0.5.3" + napi-build-utils "^1.0.1" + node-abi "^3.3.0" + npmlog "^4.0.1" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^4.0.0" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +pretty-format@^27.0.0, pretty-format@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz" + integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ== + dependencies: + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" + react-is "^17.0.1" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +process-warning@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz" + integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== + +process@^0.11.10: + version "0.11.10" + resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + +prompts@^2.0.1: + version "2.4.2" + resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + +prop-types@^15.8.1: + version "15.8.1" + resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.13.1" + +protobufjs@6.8.8: + version "6.8.8" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz" + integrity sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.0" + "@types/node" "^10.1.0" + long "^4.0.0" + +protobufjs@^6.11.3: + version "6.11.3" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.3.tgz" + integrity sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + +psl@^1.1.33: + version "1.8.0" + resolved "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz" + integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qrcode-terminal@^0.12.0: + version "0.12.0" + resolved "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz" + integrity sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ== + +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz" + integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +quick-format-unescaped@^4.0.3: + version "4.0.4" + resolved "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz" + integrity sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg== + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +react-is@^16.13.1: + version "16.13.1" + resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + +react-is@^17.0.1: + version "17.0.2" + resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" + integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== + +readable-stream@^2.0.6: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-web-to-node-stream@^3.0.0: + version "3.0.2" + resolved "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz" + integrity sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw== + dependencies: + readable-stream "^3.6.0" + +real-require@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz" + integrity sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg== + +regenerator-runtime@^0.13.3, regenerator-runtime@^0.13.4: + version "0.13.9" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz" + integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== + +regexp.prototype.flags@^1.4.1, regexp.prototype.flags@^1.4.3: + version "1.4.3" + resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz" + integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + functions-have-names "^1.2.2" + +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve.exports@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.0.tgz" + integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== + +resolve@^1.20.0: + version "1.22.0" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz" + integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== + dependencies: + is-core-module "^2.8.1" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +resolve@^2.0.0-next.3: + version "2.0.0-next.4" + resolved "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz" + integrity sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ== + dependencies: + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.0, rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +safe-buffer@^5.0.1, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-stable-stringify@^2.1.0: + version "2.3.1" + resolved "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz" + integrity sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg== + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sax@>=0.6.0: + version "1.2.4" + resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== + +saxes@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz" + integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== + dependencies: + xmlchars "^2.2.0" + +semver@7.x, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7: + version "7.3.7" + resolved "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz" + integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== + dependencies: + lru-cache "^6.0.0" + +semver@^6.0.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +sharp@^0.30.5: + version "0.30.5" + resolved "https://registry.npmjs.org/sharp/-/sharp-0.30.5.tgz" + integrity sha512-0T28KxqY4DzUMLSAp1/IhGVeHpPIQyp1xt7esmuXCAfyi/+6tYMUeRhQok+E/+E52Yk5yFjacXp90cQOkmkl4w== + dependencies: + color "^4.2.3" + detect-libc "^2.0.1" + node-addon-api "^5.0.0" + prebuild-install "^7.1.0" + semver "^7.3.7" + simple-get "^4.0.1" + tar-fs "^2.1.1" + tunnel-agent "^0.6.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +shiki@^0.10.1: + version "0.10.1" + resolved "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz" + integrity sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng== + dependencies: + jsonc-parser "^3.0.0" + vscode-oniguruma "^1.6.1" + vscode-textmate "5.2.0" + +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: + version "3.0.7" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^4.0.0, simple-get@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz" + integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== + dependencies: + decompress-response "^6.0.0" + once "^1.3.1" + simple-concat "^1.0.0" + +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz" + integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo= + dependencies: + is-arrayish "^0.3.1" + +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +sonic-boom@^2.2.1: + version "2.8.0" + resolved "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.8.0.tgz" + integrity sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg== + dependencies: + atomic-sleep "^1.0.0" + +source-map-support@^0.5.6: + version "0.5.21" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +source-map@^0.7.3: + version "0.7.3" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz" + integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== + +split2@^4.0.0: + version "4.1.0" + resolved "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz" + integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ== + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +stack-utils@^2.0.3: + version "2.0.5" + resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.5.tgz" + integrity sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA== + dependencies: + escape-string-regexp "^2.0.0" + +stream-shift@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz" + integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== + +string-length@^4.0.1: + version "4.0.2" + resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string.prototype.matchall@^4.0.7: + version "4.0.7" + resolved "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz" + integrity sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + get-intrinsic "^1.1.1" + has-symbols "^1.0.3" + internal-slot "^1.0.3" + regexp.prototype.flags "^1.4.1" + side-channel "^1.0.4" + +string.prototype.trimend@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz" + integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + +string.prototype.trimstart@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz" + integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +strtok3@^6.2.4, strtok3@^6.3.0: + version "6.3.0" + resolved "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz" + integrity sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw== + dependencies: + "@tokenizer/token" "^0.3.0" + peek-readable "^4.1.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.0.0, supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-hyperlinks@^2.0.0: + version "2.2.0" + resolved "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz" + integrity sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ== + dependencies: + has-flag "^4.0.0" + supports-color "^7.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +tar-fs@^2.0.0, tar-fs@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz" + integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.1.4" + +tar-stream@^2.1.4: + version "2.2.0" + resolved "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + +terminal-link@^2.0.0: + version "2.1.1" + resolved "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz" + integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== + dependencies: + ansi-escapes "^4.2.1" + supports-hyperlinks "^2.0.0" + +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +thread-stream@^0.15.1: + version "0.15.2" + resolved "https://registry.npmjs.org/thread-stream/-/thread-stream-0.15.2.tgz" + integrity sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA== + dependencies: + real-require "^0.1.0" + +throat@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/throat/-/throat-6.0.1.tgz" + integrity sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w== + +timm@^1.6.1: + version "1.7.1" + resolved "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz" + integrity sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw== + +tinycolor2@^1.4.1: + version "1.4.2" + resolved "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.2.tgz" + integrity sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA== + +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +token-types@^4.1.1, token-types@^4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/token-types/-/token-types-4.2.0.tgz" + integrity sha512-P0rrp4wUpefLncNamWIef62J0v0kQR/GfDVji9WKY7GDCWy5YbVSrKUTam07iWPZQGy0zWNOfstYTykMmPNR7w== + dependencies: + "@tokenizer/token" "^0.3.0" + ieee754 "^1.2.1" + +tough-cookie@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz" + integrity sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg== + dependencies: + psl "^1.1.33" + punycode "^2.1.1" + universalify "^0.1.2" + +tr46@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz" + integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== + dependencies: + punycode "^2.1.1" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + +ts-jest@^27.0.3: + version "27.1.5" + resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz" + integrity sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA== + dependencies: + bs-logger "0.x" + fast-json-stable-stringify "2.x" + jest-util "^27.0.0" + json5 "2.x" + lodash.memoize "4.x" + make-error "1.x" + semver "7.x" + yargs-parser "20.x" + +ts-node@^10.8.1: + version "10.8.1" + resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.8.1.tgz" + integrity sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.4.0: + version "2.4.1" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== + +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +typedoc@^0.22.0: + version "0.22.15" + resolved "https://registry.npmjs.org/typedoc/-/typedoc-0.22.15.tgz" + integrity sha512-CMd1lrqQbFvbx6S9G6fL4HKp3GoIuhujJReWqlIvSb2T26vGai+8Os3Mde7Pn832pXYemd9BMuuYWhFpL5st0Q== + dependencies: + glob "^7.2.0" + lunr "^2.3.9" + marked "^4.0.12" + minimatch "^5.0.1" + shiki "^0.10.1" + +typescript@^4.0.0: + version "4.6.4" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz" + integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== + +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + +universalify@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +url@0.11.0: + version "0.11.0" + resolved "https://registry.npmjs.org/url/-/url-0.11.0.tgz" + integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= + dependencies: + punycode "1.3.2" + querystring "0.2.0" + +utif@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz" + integrity sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg== + dependencies: + pako "^1.0.5" + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +v8-compile-cache@^2.0.3: + version "2.3.0" + resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + +v8-to-istanbul@^8.1.0: + version "8.1.1" + resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz" + integrity sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" + source-map "^0.7.3" + +vscode-oniguruma@^1.6.1: + version "1.6.2" + resolved "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz" + integrity sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA== + +vscode-textmate@5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz" + integrity sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ== + +w3c-hr-time@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz" + integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== + dependencies: + browser-process-hrtime "^1.0.0" + +w3c-xmlserializer@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz" + integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== + dependencies: + xml-name-validator "^3.0.0" + +walker@^1.0.7: + version "1.0.8" + resolved "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== + dependencies: + makeerror "1.0.12" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + +webidl-conversions@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz" + integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== + +webidl-conversions@^6.1.0: + version "6.1.0" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz" + integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== + +whatwg-encoding@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== + dependencies: + iconv-lite "0.4.24" + +whatwg-mimetype@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +whatwg-url@^8.0.0, whatwg-url@^8.5.0: + version "8.7.0" + resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz" + integrity sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg== + dependencies: + lodash "^4.7.0" + tr46 "^2.1.0" + webidl-conversions "^6.1.0" + +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0: + version "1.1.5" + resolved "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz" + integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== + dependencies: + string-width "^1.0.2 || 2 || 3 || 4" + +word-wrap@^1.2.3, word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write-file-atomic@^3.0.0: + version "3.0.3" + resolved "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz" + integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== + dependencies: + imurmurhash "^0.1.4" + is-typedarray "^1.0.0" + signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" + +ws@^7.4.6: + version "7.5.8" + resolved "https://registry.npmjs.org/ws/-/ws-7.5.8.tgz" + integrity sha512-ri1Id1WinAX5Jqn9HejiGb8crfRio0Qgu8+MtL36rlTA6RLsMdWt1Az/19A2Qij6uSHUMphEFaTKa4WG+UNHNw== + +ws@^8.0.0: + version "8.7.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz" + integrity sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg== + +xhr@^2.0.1: + version "2.6.0" + resolved "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz" + integrity sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA== + dependencies: + global "~4.4.0" + is-function "^1.0.1" + parse-headers "^2.0.0" + xtend "^4.0.0" + +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== + +xml-parse-from-string@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz" + integrity sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g== + +xml2js@^0.4.5: + version "0.4.23" + resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz" + integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== + dependencies: + sax ">=0.6.0" + xmlbuilder "~11.0.0" + +xmlbuilder@~11.0.0: + version "11.0.1" + resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz" + integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== + +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + +xtend@^4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@20.x, yargs-parser@^20.2.2: + version "20.2.9" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + +yargs@^16.2.0: + version "16.2.0" + resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==